ios下使用苹果支付的时候,如果是首次,那么会让你选择支付方式,我选择的是微信快捷支付,一步步完成微信快捷支付签约后,苹果支付会提示我支付完成,但是uniapp中,则会进入fail中,这导致经常会有用户反馈支付问题,我买也不得已去appstore中查询订单,然后给用户再手动加一个订单,报错如截图。
特别注明:在沙盒账号状态下,是没有问题的,每次都可以成功
async payInIOS() {
uni.showLoading({
mask: true,
title: '支付中'
});
uni.requestPayment({
provider: 'appleiap',
orderInfo: {
productid: this.goodMap[this.selectedGoods[0]].productid
},
success: iapTransaction => {
uni.hideLoading();
this.$refs.popup.close();
uni.showToast({
title: '支付成功',
icon: 'none'
});
if (this.isIOS && !this.isLogin) {
iapTransaction.device_code = this.$store.state.uuid;
}
request({
url: `${API.order}/ios`,
method: 'POST',
data: iapTransaction
}) .then((res) => {
uni.hideLoading();
uni.redirectTo({ url: '/pages/vip/success' });
}) .catch(e => {
uni.showModal({
content: `err:${JSON.stringify(e)}`,
showCancel: false
})
uni.hideLoading();
});
},
fail: err => {
uni.hideLoading();
uni.showModal({
content: "支付完成: " + JSON.stringify(err),
showCancel: false
})
}
});
}
除了首次支付之外,后续的支付测试,也有几率会出现,支付成功,但是回调没进去,导致界面一直处于支付中的状态
道远石头 (作者)
1、首次绑卡,几乎是必现,步骤为:唤起苹果支付 - 确认后选择支付方式 - 选择微信快捷支付 - 完成微信快捷支付 - 苹果提示快捷支付签约成功 - 提示支付完成(这时没有自动返回到app)- 我手动切换到app - 出现失败的提示(实际是已经付款成功了)
2、已绑过卡,偶现,操作步骤:唤起苹果支付 - 确定购买并付款 - 一直处于等待中(此时已付款成功,但未走回调)- 我手动退出 - 再次购买 - 苹果直接提示购买成功并执行了回调(我并未付款,看起来像是上次的付款回调出发了,但用户肯定不会像我这么去再次购买)
2022-06-30 18:21
DCloud_uniAD_HDX
回复 2***@qq.com: 了解了,我们改进后这些问题都可以解决
2022-07-01 19:20
道远石头 (作者)
回复 DCloud_uniAD_HDX: 期望下个版本里可以解决
2022-07-05 17:46