Supporting iOS Billing Grace Period
Extend a subscriber’s access to your app while they are in a billing issue state.
iOS Billing Grace Period
In September 2019, Apple surprisingly announced they’d added support for grace periods to iOS and macOS in-app subscriptions. Grace Periods allow you to extend a subscriber’s access to your app while they are in a billing issue state. Billing issues happen, usually, when the users credit card on file with the App Store is declined for some reason (expired, etc.)
Grace periods extend the subscription of a user for the beginning part of the billing retry state.
If you enable Grace Periods in App Store Connect, a new field will appear in the pending renewal info section of the StoreKit receipt whenever a user enters the billing retry period.
Supporting grace periods on iOS requires two things from the developer:
- Enabling them in App Store Connect
- Adding support for them in your receipt verification server
Enabling Billing Grace Period
Grace periods are enabled on a per app basis and your app needs to have at least one subscription product to be eligible.
To turn on Billing Grace Period, navigate to your app in App Store Connect. In the toolbar, click Features, and in the left column, click In-App Purchases. You’ll see a new ‘Billing Grace Period’ section with a button to Turn On.
You’ll get a popup window to confirm, and agree that your purchase code has no bugs and you’ve read the entire developer agreement. 😊
Parsing the Pending Renewal Info
To provide the new grace period expiration date, Apple has added a new field to the pending renewal info section of the /verifyReceipt response. The pending renewal info on the receipt response is an array of dictionaries that contains per-subscription information, like renewal intents, original transaction versions, and billing issue states.
Example Receipt with Grace Period
The /verifyReceipt response will contain two interesting keys: the in_app array of transactions, and the pending_renewal_info.
Without grace periods, the normal mechanism for determining an expiration date would be to loop through the in_app array and find the latest expiration date. With grace periods, it becomes slightly more complicated: you also need to loop through the pending_renewal_infos and map any infos to their respective transactions and take the maximum between the grace period expiration and the transaction expiration.
It’s not a terribly complicated problem to solve, but it does add one more thing you need to think about when supporting in-app subscriptions.
A Better Way
This is an instance where the support for grace periods coming out of Mountain View is actually better implemented. Google’s implementation allows you to skip a step by just modifying the expires date of the affected transaction, essentially giving you grace period support “for free.”
Also, if you are user of RevenueCat, grace periods for Apple and Google are automatically detected and handled by our receipt server and SDK.