自动续订订阅在测试模式下自动续订时是否会发送SKPaymentTransactionStatePurchased / Restored事务? [英] Do auto-renewable subscriptions send an SKPaymentTransactionStatePurchased/Restored transaction when they auto-renew in test mode?

查看:1062
本文介绍了自动续订订阅在测试模式下自动续订时是否会发送SKPaymentTransactionStatePurchased / Restored事务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待这个主题。

据说App Store调用paymentQueue并使用 transaction.transactionState == SKPaymentTransactionStateRestored 发布交易。

It's stated that the App Store calls the paymentQueue and posts a transaction with transaction.transactionState==SKPaymentTransactionStateRestored.

但我没有收到这些电话。我正在测试

But I'm not getting those calls. I'm testing


  1. sandbox 帐户/订阅,过期且是自动的 - 每3分钟更新一次;

  2. 没有验证收据。

  1. with sandbox accounts/subscriptions, that expire and are auto-renewed every 3 minutes;
  2. WITHOUT verifying receipts.

这样,我的updatedTransaction方法在第一次购买后永远不会被调用。

This way, my updatedTransaction method is never called after the first buy.

无论如何,如果我稍后恢复已完成的交易,我会收到所有的收据。

Anyway, if I later on restore completed transactions, I get all the receipts.

有关沙盒的任何经验吗?另外,需要点2)或(我认为)它是可选的吗?

Any experience with sandbox? Also, the point 2) is needed or (as I think) it's optional?

推荐答案

州: 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 :/

这篇关于自动续订订阅在测试模式下自动续订时是否会发送SKPaymentTransactionStatePurchased / Restored事务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆