支付宝退款
总共有三个配置支付宝公钥 应用公钥 应用私钥
Vendor('alipaysdk.AopSdk');
$aop = new AopClient;
$aop->gatewayUrl = C('ALI_GATE_WAY_URL');
$aop->appId = C('ALI_APPID');
$aop->rsaPrivateKey = C('ALI_RSAPRIVATEKEY');
$aop->alipayrsaPublicKey = C('ALI_NOTIFY_RSAPRIVATEKEY');
$aop->apiVersion = '1.0';
$aop->signType = "RSA2";
$aop->charset = "utf-8";
$aop->format = "json";
$request = new AlipayTradeRefundRequest();
$bizcontent = "{\"out_trade_no\":\"" . $wxpay_info['out_trade_no'] . "\","
. "\"refund_amount\": \"" . $wxpay_info['money'] . "\","
. "\"refund_reason\":\"预约订单退款\""
. "}";
$request->setBizContent($bizcontent);
$result = $aop->execute($request);
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
$resultCode = $result->$responseNode->code;
$refund_fee = $result->$responseNode->refund_fee;
支付宝app支付
Vendor('alipaysdk.AopSdk');
$aop = new AopClient;
$aop->gatewayUrl = C('ALI_GATE_WAY_URL');
$aop->appId = C('ALI_APPID');
$aop->rsaPrivateKey = C('ALI_RSAPRIVATEKEY');
$aop->format = "json";
$aop->charset = "UTF-8";
$aop->signType = "RSA2";
$aop->alipayrsaPublicKey = C('ALI_RSAPRUBLICKEY');
$request = new AlipayTradeAppPayRequest();
$bizcontent = "{\"body\":\"" . $body . "\","
. "\"subject\": \"" . $subject . "\","
. "\"out_trade_no\": \"" . $out_trade_no . "\","
. "\"timeout_express\": \"30m\","
. "\"total_amount\": \"" . $money . "\","
. "\"product_code\":\"QUICK_MSECURITY_PAY\""
. "}";
$request->setNotifyUrl($notify_url);
$request->setBizContent($bizcontent);
$response = $aop->sdkExecute($request);