在使用uni.requestPayment 调起支付时出现:fail errors。
后端返回数据基本和官方的实例一样,后端签名也是按照官方步骤来的
怎么解决,一直没有头绪。求大神指点指点!
在使用uni.requestPayment 调起支付时出现:fail errors。
后端返回数据基本和官方的实例一样,后端签名也是按照官方步骤来的
怎么解决,一直没有头绪。求大神指点指点!
in use uni.requestPayment When the payment is started: fail errors. The data returned from the back end is basically the same as the official instance. The back-end signature is also done according to the official steps. There is no clue how to solve the problem. Ask God for advice!
回答:
manifest.json 里边配置对了么 如果对了那就是后端参数有问题
wx.requestPayment({
timeStamp:res.data.req.minreq.timestamp,
nonceStr: res.data.req.minreq.noncestr,
package: res.data.req.minreq.package,
signType:res.data.req.minreq.signtype,
paySign: str,
success: function (res) {
uni.showToast({
title:"充值成功",
icon:"none"
})
},
fail: function (err) {
uni.showToast({
title:"充值失败请重试",
icon:"none"
})
}
});
你这个data是后端发起支付接口返回的data吗?
这数据不对啊,大小写不对,另外,格式也看起来怪怪的。
const data = res.dataconst OrderInfo = { timeStamp: data.timeStamp, nonceStr: data.nonceStr, package: `prepay_id=${data.prepayId}`, signType: 'MD5', paySign: data.paySign, appId: data.appId}注意请求参数区分大小写参考:https://uniapp.dcloud.io/api/plugins/payment?id=orderinfo
1,签名错误、未注册APPID、项目设置APPID不正确、注册的APPID与设置的不匹配、其他异常等。麻烦按照以上几点进行排查。
2,打印后台传过来的参数,和生成订单的参数进行对比。尤其注意APPID等关键参数。