Question

I have a couple questions regarding the process of detecting that a subscription has been auto-renewed.

Currently I have my sandbox test environment all set up, I am able to purchase a 1 month subscription and all of that works nice and dandy.

My questions are as follows:

  1. Do I need to verify the initial receipt (or really any subsequent receipts) of the in app purchases? If so, for what reasons?

  2. Does my app get notified via a paymentQueue:updatedTransactions: call when the auto-renew has happened? Both in the sandbox environment and in the production environment.

So far, I have not seen the StoreKit notify me of a renewed subscription (in the sandbox environment) but I have also read that it is finicky and might not.

Any general tips with Auto-Renewable subscriptions that I should take into account?

Thanks for your help and time!

Was it helpful?

Solution

1. Regarding Receipt Validation

Receipt validation is your means of performing extra security checks before you unlock the users content. Think of a receipt as a lotto ticket. A client comes to you with the "Winning Ticket". Depending on how valuable you consider the reward to your Lottery you can either give said individual their winnings, or you can contact Apple and check whether the user actually purchased this ticket through them.

The client could have got this lotto ticket through some malicious means be it a jail broken device etc and so its really up to you to decide whether you want to verify the receipt or not.

2. Regarding Renewal Notification

The official documentation states the following:

After a subscription is successfully renewed, Store Kit adds a transaction for the renewal to the transaction queue. Your app checks the transaction queue on launch and handles the renewal the same way as any other transaction. Note that if your app is already running when the subscription renews, the transaction observer is not called; your app finds out about the renewal the next time it’s launched.

So you should definitely be getting receipt renewal notifications in your app. Don't forget that you should always add yourself as the observer of StoreKit's paymentQueue in order for this to work, something like this in your app delegates didFinishLaunching would work:

//where YourObserver is an object that is alive for the apps lifecycle
[[SKPaymentQueue defaultQueue] addTransactionObserver:YourObserver];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top