简体   繁体   English

支付门集成问题PHP

[英]Payment gate integration issue PHP

I am trying to integrate HDFC/Payu payment gateway but i am unable to add custom amount, name, email etc. to the code. 我正在尝试集成HDFC / Payu付款网关,但无法在代码中添加自定义金额,名称,电子邮件等。 My code is 我的代码是

// Merchant key here as provided by Payu //这里的商家密钥,由Payu提供

$key = "gtKFFx";
$salt = "eCwWELxi";

$command = "verify_payment";

$var1 = "NPMM87334121";


$hash_str = $key  . '|' . $command . '|' . $var1 . '|' . $salt ;
$hash = strtolower(hash('sha512', $hash_str));

$r = array('key' => $key , 'hash' =>$hash , 'var1' => $var1, 'command' => $command);
$qs= http_build_query($r);

`$wsUrl =` "https://test.payu.in/merchant/postservice.php?form=1";

//`$wsUrl =` "https://info.payu.in/merchant/postservice?form=1";

$c = curl_init();
curl_setopt($c, CURLOPT_URL, $wsUrl);
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, $qs);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, 0);
$o = curl_exec($c);
if (curl_errno($c)) {
  $sad = curl_error($c);
  throw new Exception($sad);
}
curl_close($c);

$valueSerialized = @unserialize($o);
if($o === 'b:0;' || $valueSerialized !== false) {
  print_r($valueSerialized);
}
print_r($o);

If you want to show custom amount you should send JSON string in $var1, below code is helps to you. 如果要显示自定义金额,则应在$ var1中发送JSON字符串,以下代码对您有帮助。

 $var1 = '{“amount”:”10″,”txnid”:”abc3332″,”productinfo”:”jnvjrenv”,”firstname”:”test”,”email”:”test@test.com”,”phone”:”1234567890″ ,”address1″:”testaddress”,”city”:”test”,”state”:”test”,”country”:”test”,”zipcode”:”122002″,”template_id”:”14″,”validation_period”:6,”send_email_now”:”1″}';

For more clarification follow this link https://documentation.payubiz.in/email-payment/ 有关更多说明,请访问此链接https://documentation.payubiz.in/email-payment/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM