How to restore auto-renewing subscription

I'm working on my app which utilizes auto-renewing subscriptions. I'm trying to understand how everything works, and I'm finding it confusing. To start, the way I'm restoring purchases is running this:


let request = SKReceiptRefreshRequest()
request.delegate = self
request.start()
SKPaymentQueue.default().add(self)
SKPaymentQueue.default().restoreCompletedTransactions()


Maybe I'm not looking in the proper places, but I've seen that this is how others do what I'm trying. However, shouldn't it be just check the latest receipt info? Why restoreCompletedTransactions? Isn't that only for consumables?

Accepted Reply

restoreCompletedTransactions will not work with a consumable IAP - but that's not your question.


You have 2 choices. You can refresh the receipt and then examine the refreshed receipt or you can restoreCompletedTransactions. The advantage of the restore is that when a device does a restore (or a purchase) it is registered with the App Store and subsequently that device receives a new transaction each time there is an auto-renew transaction (and the device adds a transaction observer).

Replies

Pretty sure it's recommended you check for the latest receipt when the app opens, but Restore is a way to manually make that happen.


The same thing is true with Non-consumables of course where you can silently check for a previous purchase. And again Restore is like the peace-of-mind button for the consumer to be able to restore at will if your initial check failed for some reason.

restoreCompletedTransactions will not work with a consumable IAP - but that's not your question.


You have 2 choices. You can refresh the receipt and then examine the refreshed receipt or you can restoreCompletedTransactions. The advantage of the restore is that when a device does a restore (or a purchase) it is registered with the App Store and subsequently that device receives a new transaction each time there is an auto-renew transaction (and the device adds a transaction observer).