Do auto-renewable subscriptions send an SKPaymentTransactionStatePurchased/Restored transaction when they auto-renew in test mode?

蹲街弑〆低调 提交于 2019-12-04 06:46:48

问题


I was looking to this thread.

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. with sandbox accounts/subscriptions, that expire and are auto-renewed every 3 minutes;
  2. WITHOUT verifying receipts.

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.

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


回答1:


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.

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



来源:https://stackoverflow.com/questions/6149764/do-auto-renewable-subscriptions-send-an-skpaymenttransactionstatepurchased-resto

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!