支付宝统一收单交易创建接口,在PHP中怎么传递notify_url,具体的代码,不知道的别乱回答,谢谢
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了支付宝统一收单交易创建接口,在PHP中怎么传递notify_url,具体的代码,不知道的别乱回答,谢谢相关的知识,希望对你有一定的参考价值。
支付宝统一收单交易创建接口,在php中怎么传递notify_url,具体的代码,不知道的别乱回答,谢谢
我应该把它放在哪一段,怎么写???
$request->setNotifyUrl($notify_url); 参考技术B 仿照第五行的getewayurl那个写,这些是参数。
alipay.trade.refund (统一收单交易退款接口)[支付宝退款]
首页官网退款的api:
https://doc.open.alipay.com/docs/api.htm?spm=a219a.7395905.0.0.UTBitT&docType=4&apiId=759
直接测试调用:
public function gis() { $aop = new AopClient(); //$plukey="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhvyIazymefqylZ3OXf43SXEzxsb2VPVa//gVVSx4RpNqgB2NWrW77DCvo5MLIUQ00HTtyqwzxya8bIG5YoPJlsJ5vV/DWVuBI99MZADxuw+sknWW29NFwGZgtveSQlN0znpI3nWiSxXYX4oNzx1LC3QraRXLjkHbd2C4shymuL07DNQGuxfgdD65GSwNMyp9WOsiVo8uwf4oH3dSKYTa71lVuCKWaw635ERcaxqO+sBiBcyd4bUZuUcZjDFWmWJVpA0G/sw4VFzW8TlJh544BHdBTAxoi4G65CfiojgMB7wWq5OmPjqmwuCIb4cHJUIOn+/TTFfiDPCVjsJ6kCaNRQIDAQAB"; //$prikey="MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCG/IhrPKZ5+rKVnc5d/jdJcTPGxvZU9Vr/+BVVLHhGk2qAHY1atbvsMK+jkwshRDTQdO3KrDPHJrxsgblig8mWwnm9X8NZW4Ej30xkAPG7D6ySdZbb00XAZmC295JCU3TOekjedaJLFdhfig3PHUsLdCtpFcuOQdt3YLiyHKa4vTsM1Aa7F+B0PrkZLA0zKn1Y6yJWjy7B/igfd1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bgAtmZiuexe GStPAkEAiK6ycdbORrWdgezSjlmbfFbzQzM4Te8ChMl/RBt72g2EV45/7LaIxUOF vtWcj+vFMbga3kCo0AUEDxQvWn2BiQJBAKdXrmA9k7EHwPEflU4JtYTdtlCxLHRY 7ibJHJH676gBk331a5S+zrrnHiprNHomgfUqz54H/hxnwNug0rnFiDUCQClr9eHT y+8QXQ1QfoqDSLxGxQ7Ta8bLryLmM0GwvOhgPHFSEffKO9gtRiQPTRlBohxNoqYn AYipjXcLCuOC1MY="; $aop->gatewayUrl = ‘https://openapi.alipay.com/gateway.do‘; $aop->appId = ‘123213213‘; $aop->rsaPrivateKey = $prikey; $aop->alipayrsaPublicKey=$plukey; $aop->apiVersion = ‘1.0‘; $aop->signType = ‘RSA‘; $aop->postCharset=‘UTF-8‘; $aop->format=‘json‘; $ordersn=array( ‘out_trade_no‘=>‘201704141010247170‘, //"partner"=>"2088622753761050", ‘refund_amount‘=>‘0.01‘,//金额 ‘refund_reason‘=>‘正常退款‘,//原因 //‘trade_no‘=>‘2017041121001004950264597465‘, ); $jsorder=json_encode($ordersn); $request = new AlipayTradeRefundRequest(); $request->setBizContent($jsorder); $result = $aop->execute($request); $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response"; $resultCode = $result->$responseNode->code; if(!empty($resultCode)&&$resultCode == 10000){ echo "成功"; } else { echo "失败"; } }
其中 new AopClient 去sdk中有
http://pan.baidu.com/s/1nvE1owD 里面放有php版本
官网的sdk:https://doc.open.alipay.com/docs/doc.htm?treeId=54&articleId=103419&docType=1
注意:
public function generateSign($params, $signType = "RSA") {
ksort($params);//注意添加排序,我就是忘记了排序,浪费的好多时间
return $this->sign($this->getSignContent($params), $signType);
}
以上是关于支付宝统一收单交易创建接口,在PHP中怎么传递notify_url,具体的代码,不知道的别乱回答,谢谢的主要内容,如果未能解决你的问题,请参考以下文章
Java对接支付宝(alipay)电脑网站生成二维码扫码支付 alipay.trade.page.pay统一收单下单并支付页面接口