在应用程序购买中,SKPaymentTransactionStatePurchased 重试

发布于 2024-10-20 20:47:31 字数 395 浏览 0 评论 0原文

我正在实施应用内购买并在我的服务器上验证收据。

当我在 paymentQueue:updatedTransactions: 期间遇到 SKPaymentTransactionStatePurchased 时,我将收据发送到我的服务器进行验证。当我的服务器响应 OK 时,我调用 finishTransaction

如果我的服务器离线或者我无法验证收据,什么会触发应用再次调用 paymentQueue:updatedTransactions: ,从而有效地让我有机会重试验证?我注意到重新启动应用程序会执行此操作 - 还有其他吗?当应用程序保持运行时,它会以某个固定频率再次被调用吗?

是否有手动方法强制事务队列循环?

I'm implementing In App Purchase and am validating receipts on my server.

When I encounter SKPaymentTransactionStatePurchased during paymentQueue:updatedTransactions: I send the receipt to my server for validation. When my server responds with an OK I call finishTransaction.

If my server is offline or I'm otherwise unable to validate the receipt, what triggers the app to call paymentQueue:updatedTransactions: again, effectively giving me a chance to retry the validation? I've noted that restarting the app does this - is there anything else? Will it get called again on some fixed frequency while the app remains running?

Is there a manual way to force the transaction-queue to cycle?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

隐诗 2024-10-27 20:47:31

我认为 TomSwift 不想恢复购买的付款,
但他想要申请打电话
支付队列:更新交易
再次带有 SKPaymentTransactionStatePurchased 标志
未完成交易

,他知道的唯一方法是重新启动

我曾经尝试过的 应用程序
[[SKPaymentQueuedefaultQueue]removeTransactionObserver:mMyStoreObserver];
[[SKPaymentQueue defaultQueue] addTransactionObserver:mMyStoreObserver];
再次

但它不起作用..

非finishTransaction的问题是
苹果会说已购买但从未下载过
再次尝试购买相同的产品 ID 时,将进入 SKPaymentTransactionStateFailed。

I think TomSwift doesn't want to restore purchased payment,
but he want application to call
paymentQueue:updatedTransactions
with SKPaymentTransactionStatePurchased flag again
of non finishTransaction

and only way he know is re-launch the app

I used to try
[[SKPaymentQueue defaultQueue] removeTransactionObserver:mMyStoreObserver];
[[SKPaymentQueue defaultQueue] addTransactionObserver:mMyStoreObserver];
again

but it doesn't work..

the problem of non finishTransaction is
apple will said it have been purchased but never been downloaded
and it will enter SKPaymentTransactionStateFailed when try to purchased same product id again.

所谓喜欢 2024-10-27 20:47:31

您可以让应用程序调用

[[SKPaymentQueuedefaultQueue]restoreCompletedTransactions];

这将发送至

paymentQueue:(SKPaymentQueue *)队列更新交易:(NSArray
*)交易

所有交易的集合:

SKPaymentTransactionState已恢复

而不是

SKPaymentTransactionState已购买

You can have the App call a

[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];

This will send to

paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray
*)transactions

a set of all of the transactions with:

SKPaymentTransactionStateRestored

rather than

SKPaymentTransactionStatePurchased

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文