My mini program front-end failed to directly activate the payment function: return to me. Please open the connection on the WeChat client. Isn’t it possible to use the mini program developer tools? Open this connection?
replyThe front-end request is written like this, but there is a problem. I don’t know what is wrong.
wx.request({
url: 'http://localhost/index.php',
method: "POST",
data: {
total_fee: total_fee,
code: code,
},
header: {
'content-type': 'application/x-www-form-urlencoded' //Default value
},
success: function (res) { //Data returned by the backend
var data = res.data;
console.log(data);
console.log(data["timeStamp"]);
wx.requestPayment({
timeStamp: data['timeStamp'],
nonceStr: data['nonceStr'],
package: data['package'],
signType: data['signType'],
paySign: data['paySign'],
success: function (res) {
wx.showModal({
title: 'Payment successful',
content: '',
})
},
fail: function (res) {
console.log(res);
}
})
}
});
Just use WeChat on your mobile phone to test.
Could it be that I made a mistake in setting up the payment? ? ?