PHP code example of smodav / ipay

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

    

smodav / ipay example snippets


use SmoDav\iPay\Cashier;

;

$response = $cashier
    ->usingVendorId('your vendor id', 'your vendor secret')
    ->withCallback('http://yourcallback.com')
    ->withCustomer('0722000000', '[email protected]', false)
    ->transact(10, 'your order id', 'your order secret');

use SmoDav\iPay\Cashier;

;

$transactChannels = [
    Cashier::CHANNEL_MPESA,
    Cashier::CHANNEL_AIRTEL,
];

$response = $cashier
    ->usingChannels($transactChannels)
    ->usingVendorId('your vendor id', 'your vendor secret')
    ->withCallback('http://yourcallback.com')
    ->withCustomer('0722000000', '[email protected]', false)
    ->transact(10, 'your order id', 'your order secret');