PHP code example of dizatech / rayanpay_ipg

1. Go to this page and download the library: Download dizatech/rayanpay_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 / rayanpay_ipg example snippets


$args = [
    'merchantId'    => '4e1598fc-09b8-29e6-2edc-bf5494616b4d'
]; //Replace arguments with your gateway actual values
$ipg = new RayanpayIpg($args);

$args = [
    'merchantId'    => '4e1598fc-09b8-29e6-2edc-bf5494616b4d'
]; //Replace arguments with your gateway actual values
$ipg = new RayanpayIpg($args);
$amount = 1000; //Replace with actual order amount in Rials
$redirect_address = 'http://my.com/verify'; //Replace with your desired callback page URL
$result = $ipg->getToken($amount, $redirect_address);
if( $result->status == 'success' ){
    header('Location: https://pms.rayanpay.com/pg/startpay/' . $result->token);
    die();
}
else{
    echo "Error: {$result->message}";
}

$args = [
    'merchantId'    => '4e1598fc-09b8-29e6-2edc-bf5494616b4d'
]; //Replace arguments with your gateway actual values
$ipg = new RayanpayIpg($args);
$amount = 1000; //Replace with actual order amount in Rials
$result = $ipg->verifyRequest($amount, $_GET['Authority']);