Restore In app Purchase

I took an Autorenewable monthly subscription from one Apple Id and now for some reason, I changed my device and install the application from where I took the subscription. It is asking me for Restore Purchase Now If I try to Restore with a different AppleId from which I had not done purchase then what error throws by Apple? and How I can detect that this is not the same Apple Id from which I made payment?

Answered by in 693219022

There is an aspect to the above solution - using the verifyReceipt endpoint to validate the appStoreReceipt as means to restoring In-App Purchases made by the user - which has an un-anticipated effect that affects some apps during App Review.

In the sandbox environment, when the app is first installed via Xcode or by TestFlight, the appStoreReceiptURL is always nil. The solution then appears to be to make use of the SKReceiptRefreshRequest which will cause the sandbox App Store Server to return a temporary appStoreReceipt. There are 2 potential issues - 1. using SKReceiptRefreshRequest will cause the Authentication dialog to be raised as this request must be authenticated. 2. This call may be cancelled and the app should handle this case and not force the requirement that the appStoreReceipt be refreshed.

For case 1. if the app checks for the presence of the appStoreReceipt at app launch and finds that it's nil, then uses SKReceiptRefreshRequest it's possible for an app to be rejected for trying to fish for private user information. Why is the authentication dialog raised at start-up when the user is just launching the app? If you are going to use this method, first present an alert to indicate that there appears to be an issue with the appStoreReceipt, then if the user OK's the request to proceed, call SKReceiptRefreshRequest. Otherwise assume that the user has not purchased any In-App Purchases, is not eligible for promotional offers and must make a standard In-App Purchase to access premium content.

For case 2. if the SKReceiptRefreshRequest is made, allow for the authentication dialog to be cancelled or for the request to fail - here again make the assumption that the user has not purchased anything, is not eligible for promotional offers and must make a standard In-App Purchase to access premium content.

The fact that the appStoreReceipt is nil only happens in the sandbox. Once the app is approved and is released to the App Store, it will always be installed with an appStoreReceipt by the App Store.

rich kubota developer technical support CoreOS/Hardware/MFI

Restore purchases is really a refreshed app receipt, it is successful whether there are 0 in-app purchases in it or 100. It is too to your API to review the transactions, if any, and entitle accordingly.

Note: if you use VerifyReceipt or Subscription Status with the App Store Server API - then you can effectively do a “Restore” automatically by leveraging the latest_receipt _info and restore access (or see they are a new or expired subscriber) without any customer action.

Accepted Answer

There is an aspect to the above solution - using the verifyReceipt endpoint to validate the appStoreReceipt as means to restoring In-App Purchases made by the user - which has an un-anticipated effect that affects some apps during App Review.

In the sandbox environment, when the app is first installed via Xcode or by TestFlight, the appStoreReceiptURL is always nil. The solution then appears to be to make use of the SKReceiptRefreshRequest which will cause the sandbox App Store Server to return a temporary appStoreReceipt. There are 2 potential issues - 1. using SKReceiptRefreshRequest will cause the Authentication dialog to be raised as this request must be authenticated. 2. This call may be cancelled and the app should handle this case and not force the requirement that the appStoreReceipt be refreshed.

For case 1. if the app checks for the presence of the appStoreReceipt at app launch and finds that it's nil, then uses SKReceiptRefreshRequest it's possible for an app to be rejected for trying to fish for private user information. Why is the authentication dialog raised at start-up when the user is just launching the app? If you are going to use this method, first present an alert to indicate that there appears to be an issue with the appStoreReceipt, then if the user OK's the request to proceed, call SKReceiptRefreshRequest. Otherwise assume that the user has not purchased any In-App Purchases, is not eligible for promotional offers and must make a standard In-App Purchase to access premium content.

For case 2. if the SKReceiptRefreshRequest is made, allow for the authentication dialog to be cancelled or for the request to fail - here again make the assumption that the user has not purchased anything, is not eligible for promotional offers and must make a standard In-App Purchase to access premium content.

The fact that the appStoreReceipt is nil only happens in the sandbox. Once the app is approved and is released to the App Store, it will always be installed with an appStoreReceipt by the App Store.

rich kubota developer technical support CoreOS/Hardware/MFI

Hey Rich,

If the app is approved and relesased on App Store and always installed with appStoreReceipt by the App Store then is that Receipt is that one only from which AppleId User made a purchase? and is that receipt will contains all payment information?

Restore In app Purchase
 
 
Q