小程序
小游戏
企业微信
微信支付
扫描小程序码分享
基础库版本:3.4.1
app_id:wx7dd74e1fa2402b09
开通了微信支付,并关联了小程序,在拉起支付时开发工具报错:wx.requestPayment is not a function
2 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
这种报错是你代码写错了
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
http.post(charge_insert, {cid,ask,phone,email,wx,paytype,orderNumber,ordetTime,environment},token).then(resp => {
if(resp.code == 200){
•
const paymentData = resp.res;
// 拉起微信支付
wx.requestPayment({
timeStamp: paymentData.timeStamp,
nonceStr: paymentData.nonceStr,
package: paymentData.package,
signType: paymentData.signType,
paySign: paymentData.paySign,
success: function(res) {
Toast({
theme: 'success',
direction: 'row',
selector: '#t-toast',
message: '提交成功',
});
setTimeout(function () {
wx.redirectTo({
url: '/pages/myorderlist/myorderlist'
}, 500);
},
fail: function(res) {
console.error('Error fetching pay');
}
} else {
console.error('Error fetching insert data');
}).catch(err => {
console.error('Error fetching insert data:', err);
})
http调用接口返回的json是:{"code":200,"msg":"提交成功","res":"{\"appId\":\"wx7dd74e1fa2402b09\",\"timeStamp\":\"1713592063\",\"nonceStr\":\"5Dc16V2XSWAeibLDyMxHjYGj5zVABHqL\",\"package\":\"prepay_id=wx20134743301644d819da3362ead97b0000\",\"paySign\":\"XNV8Fxzb0MF\\\/8fT\\\/79USD7EKEYwxdDrxln5l+AyqPWNBYDzB+sQQL4c9hQ52ILEGrc1DnqQhi6r5M8coE2pEr6jgij+DAhTQWO+zxfjzNR9APMgjtGHAr2KX1u8j5RLX0SPc3TuVWTzOG8fBzOdVCcUp9YyohcyjPagV1I54\\\/HoOr\\\/HlTsGPcZ8YTZruzj7QF8tK3ZHI0CXveaJh6WcKOCRuU6Z3chJ9UeDNwdBD8fvS30dOH1asnIYlMwjDr0H7zj9Jjzc7YzhUgC4exHjpf6mXKu7U5E9jYLKO7b9ECapu2xh54h\\\/RT6Ay4fxKgs3rWp2YZEQloRM6TpIO4ffScg==\",\"signType\":\"RSA\"}"}
这个api跟开通不开通支付没关系,亮代码
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
这种报错是你代码写错了
http.post(charge_insert, {cid,ask,phone,email,wx,paytype,orderNumber,ordetTime,environment},token).then(resp => {
if(resp.code == 200){
•
const paymentData = resp.res;
// 拉起微信支付
wx.requestPayment({
timeStamp: paymentData.timeStamp,
nonceStr: paymentData.nonceStr,
package: paymentData.package,
signType: paymentData.signType,
paySign: paymentData.paySign,
success: function(res) {
Toast({
theme: 'success',
direction: 'row',
selector: '#t-toast',
message: '提交成功',
});
setTimeout(function () {
wx.redirectTo({
url: '/pages/myorderlist/myorderlist'
});
}, 500);
},
fail: function(res) {
console.error('Error fetching pay');
}
});
•
} else {
console.error('Error fetching insert data');
}
}).catch(err => {
console.error('Error fetching insert data:', err);
})
•
http调用接口返回的json是:{"code":200,"msg":"提交成功","res":"{\"appId\":\"wx7dd74e1fa2402b09\",\"timeStamp\":\"1713592063\",\"nonceStr\":\"5Dc16V2XSWAeibLDyMxHjYGj5zVABHqL\",\"package\":\"prepay_id=wx20134743301644d819da3362ead97b0000\",\"paySign\":\"XNV8Fxzb0MF\\\/8fT\\\/79USD7EKEYwxdDrxln5l+AyqPWNBYDzB+sQQL4c9hQ52ILEGrc1DnqQhi6r5M8coE2pEr6jgij+DAhTQWO+zxfjzNR9APMgjtGHAr2KX1u8j5RLX0SPc3TuVWTzOG8fBzOdVCcUp9YyohcyjPagV1I54\\\/HoOr\\\/HlTsGPcZ8YTZruzj7QF8tK3ZHI0CXveaJh6WcKOCRuU6Z3chJ9UeDNwdBD8fvS30dOH1asnIYlMwjDr0H7zj9Jjzc7YzhUgC4exHjpf6mXKu7U5E9jYLKO7b9ECapu2xh54h\\\/RT6Ay4fxKgs3rWp2YZEQloRM6TpIO4ffScg==\",\"signType\":\"RSA\"}"}
这个api跟开通不开通支付没关系,亮代码
http.post(charge_insert, {cid,ask,phone,email,wx,paytype,orderNumber,ordetTime,environment},token).then(resp => {
if(resp.code == 200){
const paymentData = resp.res;
// 拉起微信支付
wx.requestPayment({
timeStamp: paymentData.timeStamp,
nonceStr: paymentData.nonceStr,
package: paymentData.package,
signType: paymentData.signType,
paySign: paymentData.paySign,
success: function(res) {
Toast({
theme: 'success',
direction: 'row',
selector: '#t-toast',
message: '提交成功',
});
setTimeout(function () {
wx.redirectTo({
url: '/pages/myorderlist/myorderlist'
});
}, 500);
},
fail: function(res) {
console.error('Error fetching pay');
}
});
} else {
console.error('Error fetching insert data');
}
}).catch(err => {
console.error('Error fetching insert data:', err);
})
http调用接口返回的json是:{"code":200,"msg":"提交成功","res":"{\"appId\":\"wx7dd74e1fa2402b09\",\"timeStamp\":\"1713592063\",\"nonceStr\":\"5Dc16V2XSWAeibLDyMxHjYGj5zVABHqL\",\"package\":\"prepay_id=wx20134743301644d819da3362ead97b0000\",\"paySign\":\"XNV8Fxzb0MF\\\/8fT\\\/79USD7EKEYwxdDrxln5l+AyqPWNBYDzB+sQQL4c9hQ52ILEGrc1DnqQhi6r5M8coE2pEr6jgij+DAhTQWO+zxfjzNR9APMgjtGHAr2KX1u8j5RLX0SPc3TuVWTzOG8fBzOdVCcUp9YyohcyjPagV1I54\\\/HoOr\\\/HlTsGPcZ8YTZruzj7QF8tK3ZHI0CXveaJh6WcKOCRuU6Z3chJ9UeDNwdBD8fvS30dOH1asnIYlMwjDr0H7zj9Jjzc7YzhUgC4exHjpf6mXKu7U5E9jYLKO7b9ECapu2xh54h\\\/RT6Ay4fxKgs3rWp2YZEQloRM6TpIO4ffScg==\",\"signType\":\"RSA\"}"}