且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

自动续订订阅在测试模式下自动续订时是否会发送SKPaymentTransactionStatePurchased / Restored事务?

更新时间:2023-11-28 11:50:34

州: SKPaymentTransactionStateRestored 仅在您在用户设备上有收据并使用它进行交易时才会确定。如果您没有收据,则需要调用 restoreCompletedTransactions 来决定是否应用自动续订的订阅。

The state: SKPaymentTransactionStateRestored is only determined if you have the receipt on the user's device and you use it to make the transaction. If you do not have the receipt, then you will need to call restoreCompletedTransactions to decide whether to apply the auto-renewed subscription.

当您没有收据时,用户购买自动续订订阅,然后删除应用程序或在其他设备上安装应用程序。在其他情况下,您可以安全地将收据存储在设备上。

The situation when you won't have a receipt is when the user buys an auto-renewable subscription, then deletes the app or installs the app on a different device. In other cases, you can safely store the receipt on the device.

问题是在用户购买自动续订时检测到这种情况订阅并需要激活内容。没有收据,如果您触发交易,它将失败,状态为 SKPaymentTransactionStateFailed 。查看错误代码,您将看到 SKErrorPaymentCancelled 。据我所知,这是苹果公司的一个漏洞。您需要为应用程序做出***决策来处理它:/

The issue is detecting the case when the user has purchased an auto-renewing subscription and needs to have the content activated. Without a receipt, if you trigger the transaction, it will fail with the state SKPaymentTransactionStateFailed. Looking at the error code, you will see SKErrorPaymentCancelled. This, as far as I can tell, is a bug on Apple's part. You will need to make the best decision for your app to deal with it :/