PHP——2019 支付宝App支付
SDK下载:https://docs.open.alipay.com/54/106370/;
联系客服:https://cschannel.alipay.com/newPortal.htm?scene=mysjbzzx (发送转技术客服 在线客服 应该可以找到技术支持);
参考地址:https://www.cnblogs.com/rohanCh/p/8286822.html;
1:官方配置
2:代码注意: json格式 千万不要有空格,换行;除了数字以外 其他都要加引号 !!!!!! 其他都很Easy了 不多说了
3:回调可以取看看官网的参数 (https://docs.open.alipay.com/204/105301/)
$aop = new AopClient;
$aop->gatewayUrl = "https://openapi.alipay.com/gateway.do";
$aop->appId = $config['partner_id'];
$aop->rsaPrivateKey = $config['private_key'];//'请填写开发者私钥去头去尾去回车,一行字符串';
$aop->format = "JSON";
$aop->charset = "UTF-8";
$aop->signType = "RSA2";
$aop->alipayrsaPublicKey = $config['public_key'];//'请填写支付宝公钥,一行字符串';
//实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay
$request = new AlipayTradeAppPayRequest();
//SDK已经封装掉了公共参数,这里只需要传入业务参数
$total_price = '支付金额';
// 注意 json格式 除了数字意外都要加引号 参数不要有空格
$bizcontent = "{\"body\":\"$shop_name\","
. "\"subject\":\"$shop_name\","
. "\"out_trade_no\":$order->order_sn,"
. "\"timeout_express\":\"30m\","
. "\"total_amount\":$total_price,"
. "\"product_code\":\"QUICK_MSECURITY_PAY\""
. "}";
$notify_url = '回调地址';
$request->setNotifyUrl($notify_url);
$request->setBizContent($bizcontent);
//这里和普通的接口调用不同,使用的是sdkExecute
$response = $aop->sdkExecute($request);
return self::formatBody(['order' => $order, 'alipay' => ['order_string' => $response]]);