支付宝小程序支付接入
小程序支付文档:https://opendocs.alipay.com/mini/introduce/pay
无需引入额外库:https://opendocs.alipay.com/mini/api/openapi-pay
需要引入Alipay JSSDK:https://myjsapi.alipay.com/alipayjsapi/util/pay/tradePay.html
JSAPI支付
支付宝原生
// .js
my.tradePay({
// 调用统一收单交易创建接口(alipay.trade.create),获得返回字段支付宝交易号trade_no
tradeNO: '201711152100110410533667792',
success: (res) => {
my.alert({
content: JSON.stringify(res),
});
},
fail: (res) => {
my.alert({
content: JSON.stringify(res),
});
}
});
uni-app
uni.requestPayment({
provider: 'alipay',
orderInfo: 'orderInfo', //支付宝订单交易号
success: function (res) {
console.log('success:' + JSON.stringify(res));
},
fail: function (err) {
console.log('fail:' + JSON.stringify(err));
}
});
WAP支付
支付宝原生
// .js
my.tradePay({
// 调用资金冻结接口(alipay.fund.auth.order.app.freeze),获取资金授权参数
orderStr: 'alipay_sdk=alipay-sdk-java-3.0.118.DEV&app_id=2018112803019836&biz_content=%7B%22amount%22%3A%220.02%22%2C%22extra_param%22%3A%22%7B%5C%22category%5C%22%3A%5C%22CHARGE_PILE_CAR%5C%22%7D%22%2C%22order_title%22%3A%22%D6%A7%B8%B6%B1%A6%D4%A4%CA%DA%C8%A8%22%2C%22out_order_no%22%3A%22ZMOutOrderNoAppFreeze2018052915543415090975%22%2C%22out_request_no%22%3A%22ZMOutReqNoAppFreeze20180529155434581875858%22%2C%22pay_timeout%22%3A%222d%22%2C%22payee_user_id%22%3A%222088202224929664%22%2C%22product_code%22%3A%22PRE_AUTH_ONLINE%22%7D&charset=GBK&format=json&method=alipay.fund.auth.order.app.freeze&sign=L4wk%2FNKcbJOo3n6Q5qbPzn0jUsvZlK4jr7iXnghudR0zeWJMmeNC71qIBSQfIz45n%2B5iTd0NQ5IK581xI2xCShTCiKAywnQcDmA%2Bjf%2BrRdKCDQCMLfCz%2BZ37C%2B6zxAX3e81%2F8Hr29lw4VPFfHkp9FmMwKw%2FGkNfV5ZlWoh7UtN8%3D&sign_type=RSA×tamp=2018-05-29+15%3A54%3A35&version=1.0',
success: (res) => {
my.alert({
content: JSON.stringify(res),
});
},
fail: (res) => {
my.alert({
content: JSON.stringify(res),
});
}
});
orderStr为payUrl去掉支付宝网关地址的支付串
uni-app
uni.requestPayment({
provider: 'alipay',
orderStr: 'orderStr', //支付宝订单数据
success: function (res) {
console.log('success:' + JSON.stringify(res));
},
fail: function (err) {
console.log('fail:' + JSON.stringify(err));
}
});
orderStr为payUrl去掉支付宝网关地址的支付串
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/03/25/alipay-applet-payment-access/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
打赏
海报
支付宝小程序支付接入
小程序支付文档:https://opendocs.alipay.com/mini/introduce/pay
无需引入额外库:https://opendocs.alipay.com/mini/api/openapi-pay
需要引入Alipay JSSDK……
文章目录
关闭
共有 0 条评论