napoleon/ipay88

dev-master / 1.0.x-dev 2020-09-10 03:05 UTC

This package is auto-updated.

Last update: 2024-06-10 11:44:36 UTC


README

68747470733a2f2f7777772e6970617938382e636f6d2f696d6167652f6970617938385f6c6f676f5f776964652e706e67
68747470733a2f2f706f7365722e707567782e6f72672f6e61706f6c656f6e2f6970617938382f762f737461626c653f666f726d61743d666c61742d737175617265 68747470733a2f2f706f7365722e707567782e6f72672f6e61706f6c656f6e2f6970617938382f646f776e6c6f6164733f666f726d61743d666c61742d737175617265 68747470733a2f2f706f7365722e707567782e6f72672f6e61706f6c656f6e2f6970617938382f6c6963656e73653f666f726d61743d666c61742d737175617265 68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e61706f6c656f6e3130313339322f6970617938382f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572 68747470733a2f2f7472617669732d63692e6f72672f6e61706f6c656f6e3130313339322f6970617938382e7376673f6272616e63683d6d6173746572

Installation

composer require napoleon/ipay88 dev-master

Example code

To generate form fields that are hidden, this will use in page hopping.

<?php

use Napoleon\IPay88\IPay88;

$payment = new IPay88;

$payment->setRequestParameters([
    'PaymentId' => 1,
    'RefNo' => 'your-unique-ref-code',
    'Amount' => 15,
    'ProdDesc' => 'The description',
    'UserName' => 'John Doe',
    'UserEmail' => 'john@example.com',
    'UserContact' => '09123456789',
    'ResponseURL' => 'www.your-response-url.com',
    'BackendURL' => 'www.your-backend-url.com'
]);

$payment->render();

Or you can simply chain $payment->setRequestParamaters([...])->render()

To be able the IPay88 to do an action for your record, it needs an API comming from you. You can use the Response::class to initiate. see example below.

<?php

use Napoleon\IPay88\Response;

$response = new Response;

$response->run( function($success) {
    if ($success) {
        return # Do something if it succeed
    }
    
    return # Do something if it fails
});

$response->run() function expects 1 parameter to be a callback function.

$success variable is the boolean status of the transaction record made by the user.

$response->getFields() will return ALL the data available from IPay88, the function optionally wants an string data, to be specify what field you want to get.

Todos:

  • function to send a http request.
  • function that requery the transaction

Note:

Feel free to edit this doc and create PR for the missing todos.