PHP code example of interswitch / laravel-interswitch

1. Go to this page and download the library: Download interswitch/laravel-interswitch library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

interswitch / laravel-interswitch example snippets


INTERSWITCH_ENV=TEST

INTERSWITCH_ENV=LIVE

INTERSWITCH_REDIRECT_URL=
INTERSWITCH_PAY_ITEM_ID= 
INTERSWITCH_MERCHANT_CODE= 

use Interswitch\Interswitch\Facades\Interswitch;

...

Interswitch::confirmTransaction();

{
"transactionReference": "y84KWu1617176725",
"responseCode": "00",
"responseDescription": "Approved by Financial Institution",
"paymentReference": "FBN|WEB|MX26070|31-03-2021|3511400|927085",
"returnedReference": "1287984345",
"cardNumber": "",
"approvedAmount": "15000",
"amount": "15000",
"mac": ""
}

use Interswitch\Interswitch\Facades\Interswitch;

...

Interswitch::confirmTransaction(transactionReference, amount);

{
"paymentReference": "FBN|WEB|MX26070|31-03-2021|3511400|927085",
"responseCode": "00",
"responseDescription": "Approved by Financial Institution",
"amount": "15000",
"transactionDate": "2021-03-31T08:45:31",
"merchantReference": "y84KWu1617176725"
}

INTERSWITCH_ENV=LIVE
bash
php artisan vendor:publish --provider="Interswitch\Interswitch\InterswitchServiceProvider"