habs93
habs93

Reputation: 105

iOS In-App purchase sandbox server requires log in credentials for SKReceiptRefreshRequest

We currently developing an iOS app which uses auto-renewbale subscriptions purchased via IAP. We would like to be able to get either a receipt OR a list of previous transactions from the user w/o requiring that they enter their iTunes password.

The documentation says the following:

Users restore transactions to maintain access to content they’ve already purchased. For example, when they upgrade to a new phone, they don’t lose all of the items they purchased on the old phone. Include some mechanism in your app to let the user restore their purchases, such as a Restore Purchases button. Restoring purchases prompts for the user’s App Store credentials, which interrupts the flow of your app: because of this, don’t automatically restore purchases, especially not every time your app is launched. In most cases, all your app needs to do is refresh its receipt and deliver the products in its receipt. The refreshed receipt contains a record of the user’s purchases in this app, on this device or any other device.

We have interpreted this to mean that the restoreCompletedTransactions API will require iTunes credentials be entered and the SKReceptRefreshRequest will not.

Unfortunately, in the sandbox, the exact opposite seems to be the case. My Sandbox users are NOT required to enter credentials when they are restoring transactions, but they are required when they are requesting a fresh receipt.

Does anyone have any idea if its the documentation that is incorrect, or if the IAP sandbox has different behaviors than the production environment?

Upvotes: 2

Views: 854

Answers (2)

mickeymoon
mickeymoon

Reputation: 4977

As from this, we assume the behaviour is that if the receipt is already present on the device (stale receipt), refresh doesn't ask for credentials, but if the receipt is absent it does. (1)

I have verified the above behaviour myself in the sandbox environment.

Also, as per this Apple doc, receipt is always present in production. (2)

Both (1) and (2), combined should mean refreshReceipt should not ask for iTunes login in production.

But as per this, (1) may be applicable only for Sandbox and in production it might always require login.

Also, the behaviour may change from time to time and between OS versions and devices. You should basically not depend on the behaviour for critical features of your application.

Upvotes: 0

Andrea
Andrea

Reputation: 26385

Both refresh receipt mechanism and restore purchases require user authentication, in production and sandbox environment.

Upvotes: 2

Related Questions