iOS auto-renewable subscriptions: receipt validation flows

Rui

I'm implementing an auto-renewable subscription scenario, where the receipt validation will be handled by my server-side code. Following Apple's documentation, I'll be obtaining the receipt data from NSBundle, and pass that data to my server, which will contact Apple to validate the receipt and inform the app about the result.

Now my questions are related to the necessary flows related to receipt validation:

  1. If the user purchases a subscription, my receipt will be automatically updated with the information from that purchase? If so, is it necessary to validate that receipt right after a purchase or should I "unlock" the app immediately?

  2. In what situations will my receipt be missing from NSBundle? If that happens, I suppose I should use SKReceiptRefreshRequest to refresh the receipt, and send it to the server for validation.

  3. If the user installs the app in a different device and restores his purchases restoreCompletedTransactions do I automatically get the receipt at the same time? I suppose I need to validate the receipt after a restore to make sure there's an active subscription, correct?

  4. When my server tries to validate a receipt, and that receipt is not valid, what should happen on the app side? Refresh the receipt (which will ask user for credentials) and pass it to the server again for new re-validation?

Marc Greenstock

If the user purchases a subscription, my receipt will be automatically updated with the information from that purchase?

Yes, the receipt is essentially a file stored on the device, after a purchase the receipt file is updated and appended with the latest transaction.

If so, is it necessary to validate that receipt right after a purchase or should I "unlock" the app immediately?

This depends on how concerned you are with fraud. There are many tools available to crack in-app purchases on jail broken devices, and not validating can allow users to access your content for free. If this is a problem, then validate your receipts before unlocking the content.

In what situations will my receipt be missing from NSBundle?

If in the middle of a purchase the user looses connectivity, the receipt data may not completely download, leaving you with an incomplete receipt. I suspect there are other scenarios, but I haven't come across any of them myself.

If that happens, I suppose I should use SKReceiptRefreshRequest to refresh the receipt, and send it to the server for validation.

Yes, though keep in mind this will just update the receipt file, you will then need to call appStoreReceiptURL again to retrieve the receipt from the file.

If the user installs the app in a different device and restores his purchases restoreCompletedTransactions do I automatically get the receipt at the same time?

The receipt file will be updated but you will need to call appStoreReceiptURL to get the receipt.

I suppose I need to validate the receipt after a restore to make sure there's an active subscription, correct?

Yup, good idea.

When my server tries to validate a receipt, and that receipt is not valid, what should happen on the app side? Refresh the receipt (which will ask user for credentials) and pass it to the server again for new re-validation?

I would tell the user that you don't believe the receipt is valid and provide an option to retry. Call SKReceiptRefreshRequest, send the receipt to your server again. Display the option again if it subsequently fails.

If the user has made a fraudulent purchase I doubt they will complain to you or Apple.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

iOS Auto Renewable Subscriptions and Receipt Validation Clarifications

Apple Auto Renewable Subscriptions - Validating User Against Receipt

ios auto-renewable-subscriptions - restore operation

iOS & Firebase Auto-renewable Subscriptions

ios auto-renewable-subscriptions - simulate cancel operation

ios auto-renewable-subscriptions - identifying who purchased

Any (early) experiences with auto-renewable subscriptions for iOS

Validate iOS auto-renewable subscriptions from multiple apps

Restoring auto-renewable subscriptions after

Enable server notifications for auto-renewable subscriptions

Is restore button necessary for Auto-renewable subscriptions?

Restoring expired auto-renewable subscriptions

Do I need the server side to support iOS Grace Period of auto-renewable subscriptions?

IAP receipt validation for iOS

App Store Connect - In App Purchase creation not allowing Auto Renewable Subscriptions

Unable to submit App with Auto-Renewable Subscriptions for a non Newsstand App

Understanding receipt validation and receipt refreshing in iOS

Re purchasing on auto renewable subscription Error in ios

facing issue in Consumable and Auto renewable IAP in iOS

iOS auto renewable subscription for unlocking premium content

iOS test App Receipt Validation

google renewable subscriptions abuse

iOS InApp Purchase Receipt Validation iOS 7

iOS App Receipt Validation - Receipt is missing in simulator and on device while debugging

App rejection with auto-renewable purchase - Guideline 3.1.2 - Business - Payments - Subscriptions

How to detect if user cancel auto-renewable subscriptions during the free trial period?

How Apple IAP Auto-renewable multiple subscriptions for same product works?

Should I check cancellation_date_ms in addition to expires_date_ms for a auto-renewable subscriptions?

I need to apply free trial period for my auto renewable subscriptions. Can anyone suggest the process for this?