Table of Contents
Introduction
This example illustrates a basic way on integrating the Payment Gateway Service offered from Network Online.
Steps to Integrate the Network Online Payment Gateway
Step 1: Create a PHP file with the name “NetworkOnline.php” and add the following code.
<?php
$enc = MCRYPT_RIJNDAEL_128;
$key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";//enter secret key
$mode = MCRYPT_MODE_CBC;
$iv = "0123456789abcdef";
$rand = substr(hash('sha512',uniqid(rand(), true)), 0, 5);
$merchantId='xxxxxxxxxxxxxxx'; //enter your merchant id
$text = "order-".$rand."|AED|1100|http://example.com/paymentmerchant.php?result=ok|http://example.com/paymentmerchant.php?result=ok|01|INTERNET|||||||rohit|p|alquoz| |Dubai|Dubai|123456|AE|abc@ymail.com||||||||||||||||||||||||FALSE|||||| ";
$text1 =$text;
echo "Request Parameter in Plain Text: ".$text1;
echo '<br/>';
$size = mcrypt_get_block_size($enc, $mode);
$pad = $size - (strlen($text1) % $size);
$padtext = $text1 . str_repeat(chr($pad), $pad);
$crypt = mcrypt_encrypt($enc, base64_decode($key), $padtext, $mode, $iv);
echo 'After Encryption: '.$requestParameter=base64_encode($crypt);
echo '
<br/>';
$padtext = mcrypt_decrypt($enc, base64_decode($key), $crypt, $mode, $iv);
$pad = ord($padtext{strlen($padtext) - 1});
if ($pad > strlen($padtext)) return false;
if (strspn($padtext, $padtext{strlen($padtext) - 1}, strlen($padtext) - $pad) != $pad) {
$text = "Error";
}
$text = substr($padtext, 0, -1 * $pad);
echo '<br/>';
echo 'After Decryption: '.$text;
?>
<form action="https://uat.timesofmoney.com/direcpay/secure/PaymentTransactionServlet" method="post" id="networkonline_checkout" name="networkonline_checkout">
<input type="hidden" name="requestParameter" value="'.$merchantId.'|'.$requestParameter.'">
<input type="submit" value="Pay via networkonline" name="suba" id="sub">
</form>
Step 2: Create a PHP file with the name “paymentmerchant.php” and the following code.
This file will handle the response received from the payment gateway service provider.
<?php
Encrypted Response: '.$response = $_REQUEST['responseParameter'];
//$reponseParameters = explode("|",$_REQUEST['responseParameter']);
$EncText=base64_decode($response);
$padtext = mcrypt_decrypt($enc, base64_decode($key), $EncText, $mode, $iv);
$pad = ord($padtext{strlen($padtext) - 1});
if ($pad > strlen($padtext)) return false;
if (strspn($padtext, $padtext{strlen($padtext) - 1}, strlen($padtext) - $pad) != $pad) {
$text = "Error";
}
$text = substr($padtext, 0, -1 * $pad);
echo '
<br/>';
echo 'Decrypted Response: '.$text;
?>
For any other information or query please visit the following URL: http://www.network.ae/contact/
Related posts
How to remove multiple facebook domain verification meta tags from the head of a Shopify webpage?
Add toggle up and down arrows with CSS transform and transition in a Menu - WordPress Mobile menu to...
How to Enable cc Field in Gravity Form Email Notifications?
How to fetch and list collections and products from Shopify to your own store?