关于易宝支付的回调和跨域请求

匿名 (未验证) 提交于 2019-12-03 00:21:02
此次开发是基于小京东商城的开发(ecshop)
1.在支付的SDK里面有个call_back文件,支付的文档里面有个notify参数,里面的地址就写成能访问到call_back.php文件就行,切记,一定要是能访问到此地址
2.易宝支付的服务器会发送一个response参数还有另外一个参数,忽略,response参数里面有所有的订单信息附上代码



define('IN_ECS', true);
include (dirname(__FILE__)."/includes/modules/payment/conf.php");
require_once (dirname(__FILE__)."/includes/modules/payment/yibao/YopClient.php");
require_once (dirname(__FILE__)."/includes/modules/payment/yibao/YopClient3.php");
require_once (dirname(__FILE__)."/includes/modules/payment/yibao/Util/YopSignUtils.php");
require (dirname(__FILE__) . '/includes/init.php');
//结果通知返回原文数据
function callback($source){









}
//$aa = '{"unionID":null,"bankTrxId":"18042210246307468","orderId":"2018041915771","openID":null,"paySuccessDate":"2018-04-22 10:15:52","platformType":"NCPAY","bankPaySuccessDate":"2018-04-22 10:15:52","customerFee":"0.00","uniqueOrderNo":"1001201804220000000102775930","fundProcessType":"REAL_TIME","payAmount":"0.01","orderAmount":"0.01","requestDate":"2018-04-22 10:13:59","parentMerchantNo":"10018335019","paymentProduct":"NCPAY","status":"SUCCESS","merchantNo":"10020290087"}';
//$a = json_decode($aa,true);
//$key='oiwersoiasfqwe762323';
//$sign = MD5($a['orderId'].$a['orderAmount'].$key);




//$url = "http://域名/api/notify/NotifyShopPay".'?orderId='.$a['orderId'].'&uniqueOrderNo='.$a['uniqueOrderNo'].'&status='.$a['status'].'&orderAmount='.$a['orderAmount'].'&payAmount='.$a['payAmount'].'&sign='.$sign;
//var_dump($url);exit;
//$code = "code={"unionID":null,"bankTrxId":"18042210246307468","orderId":"2018042286301","openID":null,"paySuccessDate":"2018-04-22 10:15:52","platformType":"NCPAY","bankPaySuccessDate":"2018-04-22 10:15:52","customerFee":"0.00","uniqueOrderNo":"1001201804220000000102775930","fundProcessType":"REAL_TIME","payAmount":"0.01","orderAmount":"0.01","requestDate":"2018-04-22 10:13:59","parentMerchantNo":"10018335019","paymentProduct":"NCPAY","status":"SUCCESS","merchantNo":"10020290087"}";
$data = $_REQUEST["response"];
$call_pay = callback($data);
$a = json_decode($call_pay,true);
$key='oiwersoiasfqwe762323';
$sign = MD5($a['orderId'].$a['orderAmount'].$key);
$url = "http://域名/api/notify/NotifyShopPay".'?orderId='.$a['orderId'].'&uniqueOrderNo='.$a['uniqueOrderNo'].'&status='.$a['status'].'&orderAmount='.$a['orderAmount'].'&payAmount='.$a['payAmount'].'&sign='.$sign;


//初始化
























file_put_contents("pay_log.txt",$url);



中间的curl操作是将其返回的地址和参数拼接成url对另外一个平台进行请求。(curl进行跨域的请求操作函数)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!