接口--php对接农行网上支付平台-b2b

  对接农行网上支付平台

从银行那边获取到对应的接口包

接口--php对接农行网上支付平台-b2b

将文件保存在网站的路径中

我是destoon网站系统对接,就放在了api/pay/新建一个文件夹abc/下

完成之后填写接口的配置文件

路径:ebusclient/TrustMerchant.ini

接口--php对接农行网上支付平台-b2b

接口--php对接农行网上支付平台-b2b

标出的内容  都是需要填写的   对应的证书,联系银行要

配置完成之后  访问测试文件确定是否安装正确

接口--php对接农行网上支付平台-b2b

 

 

在接下来就是交易流程

首先仿照对应demo从自己的网站中获取接口需要的所有信息  例我在desoon中只需要对接支付充值 因为本身dt的第三方支付就是充值,所以我只需要按照农行接口需要的信息提供就可以了  如代码

<?php defined('IN_DESTOON') or exit('Access Denied'); require DT_ROOT.'/api/pay/'.$bank.'/ebusclient/PaymentRequest.php'; $tRequest = new PaymentRequest(); $tRequest->order["PayTypeID"] = "ImmediatePay"; //设定交易类型 $tRequest->order["OrderNo"] = "$orderid"; //设定订单编号 $tRequest->order["ExpiredDate"] = ""; //设定订单保存时间 $tRequest->order["OrderAmount"] = "$charge"; //设定交易金额 $tRequest->order["Fee"] = "$fee"; //设定手续费金额 $tRequest->order["CurrencyCode"] = "156"; //设定交易币种 $tRequest->order["ReceiverAddress"] = ""; //收货地址 $tRequest->order["InstallmentMark"] = "0"; //分期标识 $tRequest->order["CommodityType"] = "0201"; //设置商品种类 $tRequest->order["BuyIP"] = ""; //IP $tRequest->order["orderTimeoutDate"] = ""; //设定订单有效期 $tRequest->order["OrderDesc"] = "网站充值"; //设定订单说明 $tRequest->order["OrderURL"] = ""; //设定订单地址 $time1 = str_replace('-', '/', timetodate($DT_TIME,3)); $time = explode(' ', timetodate($DT_TIME,6)); $time2 = $time[1]; $tRequest->order["OrderDate"] = $time1; //设定订单日期 (必要信息 - YYYY/MM/DD) $tRequest->order["OrderTime"] = $time2 ; //设定订单时间 (必要信息 - HH:MM:SS) //2、订单明细 $orderitem = array (); $orderitem["ProductName"] = "网站充值"; //商品名称 $tRequest->orderitems[0] = $orderitem; //3、生成支付请求对象 $tRequest->request["PaymentType"] = "A"; //设定支付类型 if($DT_PC){ $tRequest->request["PaymentLinkType"] = "1"; //设定支付接入方式 }else { $tRequest->request["PaymentLinkType"] = "2"; //设定支付接入方式 } /* if (isset($_POST['PaymentType']) && isset($_POST['PaymentLinkType']) && $_POST['PaymentType'] === "6" && $_POST['PaymentLinkType'] === "2") { $tRequest->request["UnionPayLinkType"] = ($_POST['UnionPayLinkType']); //当支付类型为6,支付接入方式为2的条件满足时,需要设置银联跨行移动支付接入方式 } */ $tRequest->request["ReceiveAccount"] = ""; //设定收款方账号 $tRequest->request["ReceiveAccName"] = ""; //设定收款方户名 $tRequest->request["NotifyType"] = "1"; //设定通知方式 $tRequest->request["ResultNotifyURL"] = ''; //设定通知URL地址 $tRequest->request["MerchantRemarks"] = ""; //设定附言 $tRequest->request["IsBreakAccount"] = "0"; //设定交易是否分账 $tRequest->request["SplitAccTemplate"] = ""; //分账模版编号 $tResponse = $tRequest->postRequest(); /*print_r($tResponse); exit('test11'); var_dump($tResponse);exit;*/ if ($tResponse->isSuccess()) { // print ("<br>Success!!!" . "</br>"); // print ("ReturnCode = [" . $tResponse->getReturnCode() . "]</br>"); // print ("ReturnMsg = [" . $tResponse->getErrorMessage() . "]</br>"); $PaymentURL = $tResponse->GetValue("PaymentURL"); // var_dump($PaymentURL);exit; // print ("<br>PaymentURL=$PaymentURL" . "</br>"); echo "<script language='javascript'>"; echo "window.location.href='$PaymentURL'"; echo "</script>"; } else { print ("<br>Failed!!!" . "</br>"); print ("ReturnCode = [" . $tResponse->getReturnCode() . "]</br>"); print ("ReturnMsg = [" . $tResponse->getErrorMessage() . "]</br>"); } ?>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zyszxp.html