简体   繁体   English

在应用程序购买,SKPaymentTransactionStatePurchased重试

[英]in app purchase, SKPaymentTransactionStatePurchased retries

I'm implementing In App Purchase and am validating receipts on my server. 我正在实施In App Purchase并在我的服务器上验证收据。

When I encounter SKPaymentTransactionStatePurchased during paymentQueue:updatedTransactions: I send the receipt to my server for validation. 当我在paymentQueue:updatedTransactions: SKPaymentTransactionStatePurchased期间遇到SKPaymentTransactionStatePurchasedpaymentQueue:updatedTransactions:我将收据发送到我的服务器进行验证。 When my server responds with an OK I call finishTransaction . 当我的服务器响应OK时,我调用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? 如果我的服务器处于脱机状态或者我无法验证收据,是什么触发应用程序调用paymentQueue:updatedTransactions:再次,有效地让我有机会重paymentQueue:updatedTransactions: 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? 是否有手动方式强制事务队列循环?

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 我认为TomSwift不想恢复购买的付款,但是他希望应用程序再次调用paymentQueue:updatedTransactions和SKPaymentTransactionStatePurchased标志非finishTransaction

and only way he know is re-launch the app 并且他知道的唯一方法是重新启动应用程序

I used to try [[SKPaymentQueue defaultQueue] removeTransactionObserver:mMyStoreObserver]; 我曾经尝试[[SKPaymentQueue defaultQueue] removeTransactionObserver:mMyStoreObserver]; [[SKPaymentQueue defaultQueue] addTransactionObserver: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. 非完成交易的问题是苹果会说已经购买但从未下载过,当尝试再次购买相同的产品ID时,它将进入SKPaymentTransactionStateFailed。

You can have the App call a 您可以让应用程序调用a

[[SKPaymentQueue defaultQueue] restoreCompletedTransactions]; [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];

This will send to 这将发送给

paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions paymentQueue:(SKPaymentQueue *)队列updatedTransactions:(NSArray *)事务

a set of all of the transactions with: 一组所有交易:

SKPaymentTransactionStateRestored SKPaymentTransactionStateRestored

rather than 而不是

SKPaymentTransactionStatePurchased SKPaymentTransactionStatePurchased

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM