iOS iap restore process on multiple devices - SKReceiptRefreshRequest or restoreCompletedTransactions etc

Viewed 406

I know there is a lot of info but I sill can't decide what is the proper way of restoring IAP subscriptions between devices. Obviously, after digging the net, there is no really good documentation about this and people have to deal with it mainly by trials and errors.

I'm on the point to finalyze my first app with IAP subscriptions and have some doubts before I'm ready to upload it for approval. It seems like the behaviour during testing is quite different than the production one and I just don't have the production experience yet to be sure what is going on exactly.

The way I have implemented the process is the following:

  1. The user purchase the item for first time so he/she makes a payment and the transaction is added to the queue.
  2. When the app receives the response it calls finishTransaction and validates the receipt (it can be local or remote but it's a different question)
  3. When the renewal comes the queue notifies the app and the app again calls finishTransaction and makes a new validation.

This works fine on one device and there are no problems.
However when I want to restore those purchases on another device the renewal notification might not be sent as the first device that receives the notification calls finishTransaction and all other devices just miss it.

Then I have two options - either to refresh the receipt by using SKReceiptRefreshRequest or restoring the purchases by using restoreCompletedTransactions. I make one of these at a certain time based on the previous purchase expiration date just to check if the user didn't stop the subscription. (Subscription cancelation is another topic - similar but for now I don't mind it)

The refresh process looks like the one I prefer but, at least in Sandbox, it always asks the user to log in (twice and I don't know if it's normal, plus that in sandbox I couldn't find a way to implement the Touch ID). Then the app receives a new refreshed receipt and goes through the validation process which is great.

The second method requests silently a new receipt (which is a plus over the previous) but as far as I can understand it always doubles the amount of transactions in the new receipt as it make a new transaction for every completed one:

The payment queue will deliver a new transaction for each previously completed transaction that can be restored. Each transaction includes a copy of the original transaction.

So... my questions are:

  1. Is the production behaviour the same like the sandbox for the SKReceiptRefreshRequest - should the user sign in every time the app wants to refresh the receipt and does integrating Touch ID requires some other implementation?
    If I have, let's say Week Subscriptions, it would be quite annoying to the user.
  2. If I use restoreCompletedTransactions will the receipt at some point becomes full of useless transactions?
    If the user had, again let's say one year of Week Subscriptions and restores them on a few other devices, they all will fill up the final receipt quite a lot.
  3. Overall which method is preferable and what are the Pros and Cons for each of them.

Thanks a lot!

0 Answers
Related