PHP code example of dizatech / behpardakht_ipg

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

    

dizatech / behpardakht_ipg example snippets


$args = [
    'terminalId'    => '123',
    'userName'      => '456',
    'userPassword'  => '789'
]; //Replace arguments with your gateway actual values
$ipg = new BehpardakhtIpg($args);

$args = [
    'terminalId'    => '123',
    'userName'      => '456',
    'userPassword'  => '789'
]; //Replace arguments with your gateway actual values
$ipg = new BehpardakhtIpg($args);
$amount = 1000; //Replace with actual order amount in Rials
$order_id = 1; //Replace it with unique order id
$redirect_address = 'http://my.com/verify'; //Replace with your desired callback page URL
$result = $ipg->getToken($amount, $order_id, $redirect_address);
if( $result->status == 'success' ){
    

$args = [
    'terminalId'    => '123',
    'userName'      => '456',
    'userPassword'  => '789'
]; //Replace arguments with your gateway actual values
$ipg = new BehpardakhtIpg($args);
$result = $ipg->verifyRequest($_POST['SaleOrderId'], $_POST['SaleOrderId'], $_POST['SaleReferenceId']);

$args = [
    'terminalId'    => '123',
    'userName'      => '456',
    'userPassword'  => '789'
]; //Replace arguments with your gateway actual values
$ipg = new BehpardakhtIpg($args);
$result = $ipg->settleRequest($_POST['SaleOrderId'], $_POST['SaleOrderId'], $_POST['SaleReferenceId']);

$args = [
    'terminalId'    => '123',
    'userName'      => '456',
    'userPassword'  => '789'
]; //Replace arguments with your gateway actual values
$ipg = new BehpardakhtIpg($args);
$result = $ipg->refundRequest($_POST['SaleOrderId'], $_POST['SaleOrderId'], $_POST['SaleReferenceId']);