2***@qq.com
let iapChannel = null,
productId = 'course1',
productIds = ['course1'];
//获取苹果支付渠道
plus.payment.getChannels((channels) => {
for (var i in channels) {
var channel = channels[i];
//苹果支付
if (channel.id === 'appleiap') {
iapChannel = channel;
console.log(1)
this.requestOrder(); //关键
}
}
if (!iapChannel) {
that.errorMsg()
}
}, (error) => {
that.errorMsg()
});
requestOrder() {
console.log(2)
iapChannel.requestOrder(productIds,
(orderList) => { //必须调用此方法才能进行 iap 支付
uni.hideLoading();
console.log(3)
console.log(orderList)
}, (e) => {
console.log(e)
console.log(4)
uni.hideLoading();
this.errorMsg()
});
},
if (that.payType === 'iospay') {
console.log(333)
productId = that.orderDetail.order_sn;
that.applePay();
}
applePay() {
let that = this;
this.loading = true;
console.log(122)
plus.payment.request(iapChannel, {
productid: productId,
username: "初级教程",
optimize: true // 支付时设置 optimize: true
}, function(result) {
console.log(155)
console.log(result)
// 支付成功,result 为 IAP商品交易信息对象 IAPTransaction 需将返回的支付凭证传给后端进行二次认证
}, function(e) {
console.log(166)
console.log(e)
// 支付失败,需要调用一下 restoreComplateRequest 方法
that.restoreComplateRequest()
});
}
我都能获取到iapChannel.requestOrder返回的订单信息,但调用支付plus.payment.request始终没有反应啊,完全不知道成功还是失败,这个该怎么解决啊
2021-10-18 15:47
161 个评论
要回复文章请先登录或注册
3***@qq.com
心悦导航
2***@qq.com
2***@qq.com
1***@qq.com
2***@qq.com
2***@qq.com
9***@qq.com
badboybuibui
lomin