支付宝无密退款接口
Posted yuanlai
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了支付宝无密退款接口相关的知识,希望对你有一定的参考价值。
首先官方下载demo:
接口说明文档:查看文档
开放平台上传商户公钥,公私钥生成工具:支付宝密钥生成器
$aop = new AopClient ();
$aop->gatewayUrl = ‘https://openapi.alipay.com/gateway.do‘;
$aop->appId = ‘your app_id‘; $aop->rsaPrivateKey = ‘请填写开发者私钥去头去尾去回车,一行字符串‘;
$aop->alipayrsaPublicKey=‘请填写支付宝公钥,一行字符串‘;
$aop->apiVersion = ‘1.0‘;
$aop->signType = ‘RSA2‘;
$aop->postCharset=‘utf-8‘;
$aop->format=‘json‘;
$request = new AlipayTradeRefundRequest ();
$request->setBizContent("{" .
"\"out_trade_no\":\"{$order_info[‘order_sn‘]}\"," .
"\"refund_amount\":{$order_info[‘order_price‘]}," .
"\"refund_reason\":\"正常退款\"," .
"\"out_request_no\":\"{$out_refund_no}\"" .
"}");
$result = $aop->execute ( $request);
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
$resultCode = $result->$responseNode->code;
if(!empty($resultCode)&&$resultCode == 10000){
//处理逻辑 todo
echo "成功";
}
else {
echo "失败";
}
以上是关于支付宝无密退款接口的主要内容,如果未能解决你的问题,请参考以下文章