Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

苹果应用内支付IAP,消耗型商品,只能成功购买一次 #621

Closed
zhuzhengjing opened this issue Aug 4, 2019 · 9 comments
Closed
Assignees

Comments

@zhuzhengjing
Copy link

zhuzhengjing commented Aug 4, 2019

问题描述
iap消耗型购买有问题,支付成功一次后,后面支付就会提示“您已购买此App内购买项目。”此项目将免费恢复。

查了iap支付的方法,uni-app可能忘记在成功购买消耗型商品后调用

[[SKPaymentQueue defaultQueue] finishTransaction:transaction];

复现步骤

plus.payment.request(c,
    {productid: OrderItem.productid},
    function (result) {
        console.log('success:' + JSON.stringify(result))
    },
    function (e) {
        console.error(e)
        self.$showModal('支付失败')
    }
)
// 这个函数只在第一次支付成功后返回,以后再次支付提示“此项目将免费恢复。”回调函数也不调用了
function (result) {
    console.log('success:' + JSON.stringify(result))
},

image

@zhuzhengjing
Copy link
Author

补充测试结果:uni.requestPayment方法测试正常,但是这个success回调中没有返回收据信息,无法作校验。

// 用这个方法测试没有问题,但是没有iap收据信息
uni.requestPayment({
	provider: 'appleiap',
	orderInfo: {productid: IAPOrders[0]},
	success (iap) {
		console.log('--- IAP', iap)
	},
	fail (err) {
		console.error(err)
	}
})

@zhuzhengjing
Copy link
Author

再次补充:
uni.requestPayment这个函数回调也不正常了,哎,搞死了。

@a7e6j2
Copy link

a7e6j2 commented Oct 5, 2019

为何没人理?

@dcloudhdx
Copy link
Contributor

沙箱环境有此问题,正式发布后正常

@zhuzhengjing
Copy link
Author

经测试,确实是沙箱环境问题。线上的IAP支付很稳。

@dcloudhdx
Copy link
Contributor

dcloudhdx commented Nov 4, 2019

IAP支付回调问题下版修复,当前版本解决方案 plus.payment.request ,参考文档 http://www.html5plus.org/doc/zh_cn/payment.html#plus.payment.request

@Tearsillusion
Copy link

请问上边那个弹框:你已成功购买苹果内购项目,这个弹框真实环境会有嘛?因为用户不点这个不走回调。我想问问是不是真实环境下没有这个弹框

@hljit
Copy link

hljit commented Apr 21, 2022

有人吗,为什么 沙盒测试 plus.payment.request 也是没有回调呢? 界面都弹窗支付成功了也显示购买成功了

@dcloudhdx
Copy link
Contributor

相同的沙箱账号是不是已经购买过,换个沙箱账号试试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants