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

你好,请教个内购问题 #12

Open
yuwind opened this issue Dec 20, 2019 · 4 comments
Open

你好,请教个内购问题 #12

yuwind opened this issue Dec 20, 2019 · 4 comments

Comments

@yuwind
Copy link

yuwind commented Dec 20, 2019

未绑定App Store支付方式的用户,在购买内购商品时,首先会弹出一个设置支付方式的弹框,用户点击了继续,updatedTransactions会回调一个是失败的交易,也就是SKPaymentTransactionStateFailed,此时APP 调用了finishTransaction,结束了当前交易,而用户跳转到App Store绑定支付方式之后,接着付款成功了。此时APP还会调用updatedTransactions函数回调成功的交易吗?

@LeoMobileDeveloper
Copy link
Owner

@yuwind 付款成功一定会有个回调

@yuwind
Copy link
Author

yuwind commented Dec 22, 2019

感谢大佬的回复,我们APP也没做这种情况的处理,线上测试的时候也是没问题的,不过还有待验证。只是上次一同事提醒说可能会有问题。我的理解是这样的,未绑定支付方式的用户支付时产生的两次交易本身不是一个交易,这样第一个交易finishTransaction应该不会漏单,而且这种问题只有通过App Store下载的包才能复现,所以就咨询下大佬有没有遇见过这种情况

@LeoMobileDeveloper
Copy link
Owner

@yuwind 以前遇到过类似情况,之前是Apple每年协议更新,这时候用户购买IAP需要先跳转到App Store同意协议,再付款。这时候StoreKit就会先给一个SKPaymentTransactionStateFailed的回调,再给一个Succeed的回调。

客户端收到购买成功的回调就发给服务端就行了,服务端要能处理这种情况

@yuwind
Copy link
Author

yuwind commented Dec 22, 2019

哦哦,能收到成功的回调那就是没问题的。我看苹果的文档说的是,苹果官方文档给的,服务端校验凭证时,消耗性的凭证不会保留在receipt.in_app,只会保留在最新的凭证中,如果此时没校验又有了新的购买就会出现漏单。如果会回调两次第一次即使[queue finishTransaction:transaction],第二次也会回调那就没问题。

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

2 participants