后端签名拼接:
appId={小程序appId,在此屏蔽}nonceStr=1963315987&package=prepay_id=wx20200105205129596033signType=MD5timeStamp=1578228692&key=f1945e80663c896141429e4552af69f6
key是通过后端调用getsignkey API获得
prepay_id是通过后端调用unifiedorder 获得
小程序端调用支付API,却一直显示“JSAPI缺少参数total_fee“
wx.requestPayment(
{
'timeStamp': '1578228692',
'nonceStr': '1963315987',
'package': 'prepay_id=wx20200105205129596033',
'signType': 'MD5',
'paySign': '4A523CC4A6EA958D166F2120E66A4FF7',
'success': function (res) {
console.log("payment success ", res)
},
'fail': function (res) {
console.log("payment failed ", res)
},
'complete': function (res) {
console.log("payment complete ", res)
}
})
用正式环境调用试一下。看看是否还会报这个错误。