码迷,mamicode.com
首页 > 其他好文 > 详细

支付宝无密退款接口

时间:2018-06-25 15:00:12      阅读:305      评论:0      收藏:0      [点我收藏+]

标签:objects   说明   生成器   demo   todo   https   post   IV   pos   

 

首先官方下载demo:

接口说明文档:查看文档

开放平台上传商户公钥,公私钥生成工具:支付宝密钥生成器

技术分享图片

 

一定要采用RSA2签名!!!

$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 "失败";
}


支付宝无密退款接口

标签:objects   说明   生成器   demo   todo   https   post   IV   pos   

原文地址:https://www.cnblogs.com/yuanlai/p/9223962.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!