且构网

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

自动续订订阅在自动续订时会发送 SKPaymentTransactionStatePurchased 交易吗?

更新时间:2023-11-28 11:42:40

经过一些研究,我可以回答我自己的问题并提出另一个相关问题.App Store 调用支付队列并发布交易.交易通过 transaction.transactionState==SKPaymentTransactionStateRestored 发布,不是 transaction.transactionState==SKPaymentTransactionStatePurchased.

After some research I can answer my own question and raise another related issue. The App Store calls the paymentQueue and posts a transaction. The transaction is posted with transaction.transactionState==SKPaymentTransactionStateRestored, not transaction.transactionState==SKPaymentTransactionStatePurchased.

问题是不幸的是,这只会发布到一台设备上.第二个设备没有得到该张贴.因此,要检测自动续订,或者更确切地说是检测缺少自动续订并拒绝设备继续订阅,您必须执行 restoreCompletedTransaction 或http 发布包含最后一笔交易的 64 位编码 JSON".如果是前者,用户需要提供自己的密码;那是侵入性的.如果是后者,则需要大量额外的编码.所以,我的问题是……为什么 StoreKit 没有命令:

The issue is that unfortunately this gets posted only to one device. A second device does not get the posting. Therefore, to detect the auto-renewal, or rather to detect the lack of an autorenewal and deny the device a continuing subscription, you have to do a restoreCompletedTransaction or "http post a 64-bit encoded JSON containing the last transaction". If the fomer, the user needs to give their password; that's intrusive. If the latter, lots of additional coding is required. So, my question is...why doesn't StoreKit have a command:

(不存在) - [[SKPaymentQueue defaultQueue] restoreAttachedTransactions:(NSArray *)transactions];

(does not exist) - [[SKPaymentQueue defaultQueue] restoreAttachedTransactions:(NSArray *)transactions];

这个命令的流程就像一个 restoreCompletedtTransactions 但它只会恢复附加的交易,最重要的是,它不需要用户登录.它具有与http 发布包含最后一笔交易的 64 位编码 JSON"相同的安全保护,并且允许整个应用内购买过程在 StoreKit 中完成,而不需要网络发布代码.

This command would flow just like a restoreCompletedtRansactions but it would only restore the attached transactions and, most importantly, it would not require log-in by the user. It has the same security protection as the "http post a 64-bit encoded JSON containing the last transaction" and it allows the entire In App Purchase process to be done in StoreKit rather than requiring web posting code.

如果这对您有意义,请建议如何将其发送给 Apple....谢谢.

If this makes sense to you, please suggest how to get this to Apple....thanks.