SBIePay is an online payment aggregation service provided by State Bank of India, India's most recognized & trusted brand in banking, and the only Bank in India to have its own Payment Aggregation platform.
1. Create Config page name as config.php
config.php
<?php
$merchantID="YOUR-MERCHINT-ID";
$merchantKey="YOUR-MERCHINT-KYE";
$paymentURL="https://www.sbiepay.com/secure/AggregatorHostedListener";
$returnURL="example.com/success_fail.php";
?>
2. order.php
<?php
include_once('config.php');
/* Get User Data From Database */
$aid='1002'; /* User ID */
$applicant_name=trim('Dipankar Biswas');
$applicant_ph=trim('973312121');
$applicant_details_blank="NR";
$order_id='52456' /* Order ID */
$app_fees=100; /* INR */
$txn_no="odr_dwdwdwhhx_001"; /* You can generate manualy but Unique */
if($app_fees>0)
{
/* Send Others Data by $txID='TXNNO-ORDERID-NAME-EMAIL-PHONE-ETC' */
$txID=$txn_no."-".$order_id."-".$applicant_name."-".$applicant_ph;
$str="$merchantID|DOM|IN|INR|$app_fees|Other|$returnURL|$returnURL|SBIEPAY|$txID|$aid|NB|ONLINE|ONLINE";
$aes = new CryptAES();
$aes->set_key(base64_decode($merchantKey));
$aes->require_pkcs5();
$EncryptTrans = $aes->encrypt($str);
?>
<html>
<body>
<h2 style="font-family:Arial; font-size:18px; font-weight:bold; color:#1799be;">Please click the button for transfer to SBI ePay Gateway.</h2>
<form name="ecom" method="post" action="<?=$paymentURL;?>">
<input type="hidden" name="EncryptTrans" value="<?php echo $EncryptTrans; ?>">
<input type="hidden" name="merchIdVal" value ="<?=$merchantID;?>"/>
<input type="Submit" value="Go To SBI ePay" />
</form>
</body>
</html>
<?
exit();
}
else
{
$error_msg="There was an error with your application. Please try again.";
}
?>
3. success_fail.php
<?php
include_once('config.php');
//echo "<pre>"; print_r($_REQUEST); echo "</pre>";
$aes = new CryptAES();
$aes->set_key(base64_decode($merchantKey));
$aes->require_pkcs5();
if($_REQUEST['encData'] && $_REQUEST['encData']!=""){$msg_ret=$_REQUEST['encData'];}
if($_REQUEST['pushRespData'] && $_REQUEST['pushRespData']!=""){$msg_ret=$_REQUEST['pushRespData'];
$msg=explode("|",$aes->decrypt($msg_ret));
if(count($msg)>10)
{
$txID_full=$msg[0];
$txID_array=explode("-",$txID_full);
$order_id=intval($txID_array[3]);
$transaction_num=$msg[1];
$amount=floatval($msg[3]);
$auth_code=$msg[2];
if($auth_code=="SUCCESS")
{
/* Update database by order id */
}else{
echo 'Payment Fail try again';
}
}
?>
Get the latest news and updates by signing up to our daily newsletter.We won't sell your email or spam you !