PHP code example of apanicker / omnipay-municipay

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

    

apanicker / omnipay-municipay example snippets


use Omnipay\Omnipay;

$gateway = Omnipay::create('Municipay');

$gateway->initialize([
    'siteId' => 'xxxxxxxxxx',
    'urlKey' => 'xxxxxxxxxxxxxxxxxxxxxxxxx'
]);

$response = $gateway->purchase([
    'transactionId' => 1234,
    'redirectUrl' => 'https://example.com/callback/1234',
    'listItems' => [
        [
            "prodId" => "xxxxxxxxxxxxxxxxxxxxxxxxxx",
            "amount" => "100",
            "refNum" => "XXXXXXX"
        ],
        [
            "prodId" => "xxxxxxxxxxxxxxxxxxxxxxxxxx",
            "amount" => "80.00",
            "refNum" => "XXXXXXX"
        ]
    ]
])->send();

if ($response->isRedirect()) {
    $response->redirect();
}