Connect With Me

Contact Me If You Getting Any Problem on fb and twitter
facebook twitter

Thursday, 5 January 2017

php code to integrate atom payment system

<?php
//config
  $url = 'https://paynetzuat.atomtech.in/paynetz/epi/fts';
  $port = 443;
  $atom_prod_id = "NSE";
       $userid='atom_user_id';
       $password='atom_password';
       $custacc='1234567890';
  $udf4='Website Name';
  $ru='www.responseredirectpage.com';
  //config
 
  //userdetail
  $amount='50.00';
  $clientcode='007';
  $txnid='abcde1726';
  $transactionDateTime='05/01/2017 03:48:40';
  $udf1='Anoop';
  $udf2='anoopnee@gmail.com';
  $udf3='7840853170';
  //userdetail
 

     $param ="&login=$userid&pass=$password&ttype=NBFundTransfer&prodid=NSE&amt=$amount&txncurr=INR&txnscamt=0&clientcode=$clientcode&txnid=$txnid&date=$transactionDateTime&custacc=$custacc&udf1=$udf1&udf2=$udf2&udf3=7840853170&udf4=$udf4&ru=$ru";


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_PORT , $port);
curl_setopt($ch, CURLOPT_SSLVERSION,3);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
$returnData = curl_exec($ch);

// Check if any error occured
if(curl_errno($ch))
{
echo 'Curl error: ' . curl_error($ch);
}
curl_close($ch);

$xmlObj = new SimpleXMLElement($returnData);
$final_url = $xmlObj->MERCHANT->RESPONSE->url;
// eof code to generate token
// code to generate form action
$param = "";
$param .= "&ttype=NBFundTransfer";
$param .= "&tempTxnId=".$xmlObj->MERCHANT->RESPONSE->param[1];
$param .= "&token=".$xmlObj->MERCHANT->RESPONSE->param[2];
$param .= "&txnStage=1";
$url = $url.'?'.$param;
?>


<form action='<?php echo $url?>' method='post'>
<input type='submit' value='Pay Now' name='btn_pay' />
</form>

No comments:

Post a Comment