支付宝开发文档网址:https://opendocs.alipay.com/apis
uniapp开发文档支付网址:https://uniapp.dcloud.net.cn/api/plugins/payment
支付宝支付测试错误排查工具网址:https://opensupport.alipay.com/support/tools/cloudparse
支付常见问题可参照网址:https://opensupport.alipay.com/support/helpcenter/89/201602479174?ant_source=opendoc_recommend
注:2018年1月5号 之后创建的应用只能上传rsa2签名方式的密钥(即RSA(SHA1)密钥入口下架),所以接口调用的签名类型必须要使用RSA2
PHP代码可借鉴网址:https://github.com/dcloudio/H5P.Server/tree/master/payment
配置密钥
将demo下载放在对应的路径下并引用。这里本人放的是extend文件夹下。
代码
require '../extend/alipay/aop/AopClient.php';
require '../extend/alipay/aop/request/AlipayTradeAppPayRequest.php';
$amount = $this->request->param('total');
$order_id = $this->request->param('order_id');
$aop = new \AopClient;
$aop->gatewayUrl = "https://openapi.alipay.com/gateway.do";
$appid=config('base.web_AliAppid');
$aop->appId =$appid;
$prkey=config('base.web_rsaPrivateKey');//私钥
$aop->rsaPrivateKey = $prkey;