How to add support for grace period (Billing Grace Period) in the iOS application?

image







In September, Apple added support for grace periods (or grace periods) for renewable subscriptions. It allows users who have subscribed to retain access to a paid service, even if it could not be renewed on time due to problems with payment. Subscription will resume when the user updates the payment method.







The duration of the grace period depends on the duration of the subscription. For a weekly subscription, it is 6 days, for all others - 16 days.







You can activate Grace in the App Store Connect where in-app purchases are configured. But grace period support in the application itself will also have to be implemented.







How do I know if a user is in a grace period?



This will require validation of the App Store check in order to receive JSON data. Of course, it is better to use your server to validate checks in order to avoid man-in-the-middle attacks, as Apple recommends.







Validations App Store checks we dedicated a separate article .

If a problem occurs with payment when the grace period is on, a new field will appear in pending_renewal_info



JSON: grace_period_expires_date



. This date is obtained by adding 6 or 16 days to the expiration date of the last transaction.







If the current date is between the expiration date of the last transaction and the expiration date of the grace period, then the user is in the grace period. expiration_intent



should also be 2



.







If the user updates the payment data, a new transaction will appear in the latest_receipt_info



array and the grace_period_expires_date



field will disappear from pending_renewal_info



.







And if the user does not fix the problem, then after grace the subscription should be considered expired and you must block the user from accessing premium features.







The difference between the grace period and is_in_billing_retry_period





In addition to the grace period field, is_in_billing_retry_period



remained in pending_renewal_info



. If the value is 1



, then the user has a problem with payment, and he is not in the grace period. Distinguish that here you decide whether to give paid functionality or not. It turns out that each developer up to this time chose what to do.







With the grace period turned on, Apple obliges all developers to give premium.







Notify the user about problems with payment in the application



In both cases, we recommend that you notify the user of problems directly in the application and offer him to update payment information.







You can display a banner or full-size screen to the user with a request to update the payment information and the transition button:







 // example of navigating user to account billing func handleOpenBilling(){ let urlString = "https://apps.apple.com/account/billing" if let url = URL(string: urlString), UIApplication.shared.canOpenURL(url){ UIApplication.shared.open(url) }
      
      





Apphud has already done this for you.



If there is a problem with payment, the user will receive a push notification asking them to update their payment information. And if notifications have been disabled, the screen will appear the next time the application is launched.







image

Billing Update Screen







Apphud also takes into account the grace period and returns the subscription status as active. If you don’t have time to implement this feature yourself, try our service here .







Keeping users as important as ever



Reducing the number of unsubscribes and retaining users has become more important than ever. With the release of iOS 13, Apple simplified the unsubscribe mechanism: the offer to cancel the subscription is displayed when the application is uninstalled, and the settings screen has become even more accessible:







image

Subscription Settings in iOS 13







This means that the conversion to paid subscriptions will decrease, because users are less likely to forget to cancel their subscription. And you will surely be looking for a solution to increase profits from current users.







Apphud Rules



The mechanics for solving payment problems are called the "Rule" . We examined only one of the rules. We have other rules that will help you increase profits and retain users. Read more in our blog .








All Articles