The 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);
}
})
}
});