1. 调用开发者服务器接口获取微信支付所需参数
payment({
id: this.data.id,
price: this.data.price,
openid: this.data.openid
}).then((res) => {
wx.requestPayment({
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
success(res) {
console.log(res);
wx.redirectTo({
url: '../index/index',
})
},
fail(res) {
console.log(res);
}
})
})
调用微信支付接口wx.requestPayment(Object object)
wx.requestPayment({
timeStamp: '',
nonceStr: '',
package: '',
signType: 'MD5',
paySign: '',
success (res) { },
fail (res) { }
})
先调用开发者服务器接口,再调用微信支付接口,调取付款弹窗,付款完成,返回列表