Search code examples
iosin-app-purchasestorekit

Is SKReceiptRefreshRequest limited to the testing environment, or can I call it in the final version of the app?


I am developing a iOS app that uses In App Purchase, and I am not sure I have a good understanding of SKReceiptRefreshRequest. Is it for use only in the testing environment, or can I use it in the final app version on the store? Many features in IAP rely on having an updated receipt, but one problem is that, in the testing environment, firing a SKReceiptRefreshRequest causes the app to present a request for Apple ID credentials. If SKReceiptRefreshRequest is for use on the final app version too, will it trigger a credentials request also on the user devices?


Solution

  • You shouldn't be calling SKReceiptRefreshRequest to keep the receipt up to date. As you've seen, any time you access the receipt it could trigger a credentials request. This is because receipts are linked to the iTunes Account on the device.

    If you need information from the receipt frequently, what you should be doing is storing it on a server and keeping it up-to-date there. You can use Apple's /verifyReceipt endpoint to update the receipt on your server so there's no need to get the user credentials from the device.