Need help with handling expired receipts from App Store

Hello All,

Our app implements in app purchase as follows,

The App is free to download and sign up, some features are available if monthly subscription is valid.

We have implemented server side validation (app side validation is not present) so app will perform the in app purchase and forward the receipt, received from App Store, to the server.

This functionality worked so far but recently we noticed that the App Store is sending invalid/expired receipt to the app, which in turn gets forwarded to the server.

Upon checking the receipt data, server finds out the receipt is already expired and so server disables the paid features.

We are trying to figure out process to enable user to resubscribe to the paid feature through app.

Not sure if we missed something but the document we found so far, mentions to block the features or provide grace period to the users but we were not able to locate any document which explains process to enable users to resubscribes.

Any pointer will be helpful.

Validating Receipts:

https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/validating_receipts_with_the_app_store

Please let me know if you need any additional help. Thanks in advance.

Replies

Hello, a place where you could start with for grace period is here: https://developer.apple.com/documentation/appstorereceipts/responsebody/pending_renewal_info

You could also take a look at the expiration_intent field over here: https://developer.apple.com/documentation/appstorereceipts/expiration_intent

In the case that you want your application to provide an option to re-subscribe, you could look at the expiration fields in the receipt and show different dialogs based on why the subscription expired, as per the expiration_intent field.

I hope this helps, please ask with any follow-ups you may have.

  • Thanks a lot for your response and sharing those useful links geryon.

    Based on the information it looks like we have two options, 

    Option 1: The app should analyze “expiration_intent” and/or “grace period” fields from the receipt, returned by the app store, and based on that it should show applicable pop-up to the user.

    Option 2: The server should analyze “expiration_intent” and/or “grace period” fields from the receipt, returned by the app store to app (and forwarded by the app to server) and inform the app which pop-up needs to be shown.

    Please let me know if my understanding of the shared material is correct. Thanks again.

  • This sounds like a reasonable approach to me, if you haven't already set up V2 notifications for your app, you could use that to trigger pop ups depending on different types of notifications, and the payloads.

    There are some caveats, like we will send DID_FAIL_TO_RENEW while we are retrying billing, and we will send a DID_RENEW later, with a subtype of BILLING_RECOVERY -- so getting a notification of DID_FAIL_TO_RENEW doesn't always mean that the user is trying to cancel. I'd read the documentation linked above, especially the types and responseBody sections.

  • Thanks a lot for your response and confirmation on our options for approaches. Currently we are utilizing V1 notifiations so we will look into V2 notifications.

I wonder if you are currently working in the sandbox. In the sandbox environment, auto-renewing subscriptions renew at an accelerated pace. I could easily understand that for a 1 mo subscription where it renews every 5 minutes for 5 times, that if you relaunch the app after a 30 minute delay, the transactionObserver would detect the renewals, but validation of the appStoreReceipt would show all expired subscriptions. In the production environment, auto-renewing subscription continuously renew, not like in the sandbox. The customer can stop renewals in their iTunes Account "Manage Subscription" panel.

In response to your concerns, take a look at the Apple Developer Article Handling Subscriptions Billing.

rich kubota developer technical support CoreOS/Hardware/MFI

  • Thanks a lot for your response Rich.

    We are actually running on production but you are right.. we use our Sandbox account on production so that the developers can validate the subscription without getting charged for subscription. You are also absolutely right that our subscription is expiring every 5 minutes and for 5 times.

    But challenge we are facing currently is that App store is sending us expired receipts and we are struggling to ignore those receipts and request users to re-subscribe to the paid features. We will review the Apple Developer Article "Handling Subscriptions Billing". Thanks a lot for sharing this useful information. We really appreciate it.

Add a Comment