PHP code example of ogunsakindamilola / laravel-interswitch

1. Go to this page and download the library: Download ogunsakindamilola/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/ */

    

ogunsakindamilola / laravel-interswitch example snippets




return [
    /**
     *  Your payment environment
     *  Accepts LIVE or TEST
     *
     */

    'env' => env('INTERSWITCH_ENV', 'TEST'),

    'currency' => 566,

    /**
     *  Interswitch payment gateway of choice
     *  Accepts WEBPAY or PAYDIRECT
     *
     */

    'gateway' => env('INTERSWITCH_GATEWAY'),

    /**
     *  Redirect URL
     *  This is the URL Interswitch redirects you to
     *  **PLEASE DO NOT CHANGE**  `The cost of using magic will be your soul`
     */

    'systemRedirectUrl' => 'interswitch-pay-redirect',


    /**
     *  This is the redirect url defined by you in your environment file
     *
     */

    'redirectUrl' => env('INTERSWITCH_REDIRECT_URL'),

    /**
     *  Live credentials as defined in your environment variables
     *
     */


    'live' => [
        'requestUrl' => env('INTERSWITCH_REQUEST_URL'),
        'queryUrl' => env('INTERSWITCH_QUERY_URL'),
        'macKey' => env('INTERSWITCH_MAC_KEY'),
        'itemId' => env('INTERSWITCH_ITEM_ID'),
        'productId' => env('INTERSWITCH_PRODUCT_ID'),
    ],

    /**
     *  This are the default test credentials of interswitch for both gateways
     *
     */

    'test' => [
        'webPay' => [
            'requestUrl' => 'https://sandbox.interswitchng.com/webpay/pay',
            'queryUrl' => 'https://sandbox.interswitchng.com/webpay/api/v1/gettransaction.json',
            'macKey' => 'D3D1D05AFE42AD50818167EAC73C109168A0F108F32645C8B59E897FA930DA44F9230910DAC9E20641823799A107A02068F7BC0F4CC41D2952E249552255710F',
            'itemId' => 101,
            'productId' => 6205,
        ],
        'payDirect' => [
            'requestUrl' => 'https://sandbox.interswitchng.com/collections/w/pay',
            'queryUrl' => 'https://sandbox.interswitchng.com/collections/api/v1/gettransaction.json',
            'macKey' => '',
            'itemId' => 101,
            'productId' => 1706,
        ],
    ],

];

[
  "id" => "11"
  "customer_id" => "1"
  "customer_name" => "Ogunsakin Damilola"
  "customer_email" => "[email protected]"
  "environment" => "TEST"
  "gateway" => "WEBPAY"
  "reference" => "5E5C880D78133"
  "amount" => "90000"
  "response_code" => "Z6"
  "response_description" => "Customer cancellation"
  "created_at" => "2020-03-02 04:14:08"
  "updated_at" => "2020-03-02 04:14:14"
]
 
url(interswitch-transactions-log);
OR
route('InterswitchTransactionsLog');
bash
php artisan vendor:publish