PHP code example of navid045 / mellatbank

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

    

navid045 / mellatbank example snippets


use MellatBank\Gateway;

$config = [
    'terminalId' => '...',
    'userName' => '...',
    'userPassword' => '...',
    'callBackUrl' => 'https://example.com/payment/callback',
];

$gateway = new Gateway($config);

$refId = $gateway->requestPayment($amountInRial, 'Some optional description...');

$gateway->url()

use MellatBank\Gateway;

$gateway = new Gateway($config);

$refId = $gateway->checkPayment();

if($refId != false) {
    $bankResult = $gateway->verifyPayment();
}