标签:objects 说明 生成器 demo todo https post IV pos
首先官方下载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 "失败";
}
标签:objects 说明 生成器 demo todo https post IV pos
原文地址:https://www.cnblogs.com/yuanlai/p/9223962.html