Mukesh Shakya
Mukesh Shakya

Reputation: 445

Testing grace period in auto renewal subscription in iOS

I implemented auto renewing subscription in my app with grace period. I did code all the logics required to provide subscription service while the grace period but I could not find any way to test the grace period in Sandbox environment. Can someone help me with testing grace period feature in Sandbox environment.

Upvotes: 1

Views: 1412

Answers (3)

Vitaly T
Vitaly T

Reputation: 1

Configure the sandbox environment to simulate billing issues

Follow these steps on a test device running iOS 16 or iPadOS 16, or later:

  1. Sign in to the App Store using a Sandbox Apple ID.
  2. Choose Settings > App Store > Sandbox Account > Manage > Account Settings. Disable the Allow Purchases & Renewals setting.
  3. Disabling this setting causes in-app purchases to fail, and auto-renewable subscriptions to not renew in the sandbox environment.

Note

This setting applies to all devices that the Sandbox Apple ID signs in to, and to all active auto-renewable subscriptions belonging to that account. This setting stays in a disabled state until you reenable it. Reenable it to simulate a customer resolving a billing issue.

Upvotes: 0

Paul Schröder
Paul Schröder

Reputation: 1540

Enabling the billing grace period in App Store Connect doesn't change the expiration date corresponding to the grace period. But, it avoids revenue loss if Apple can recover the subscription within the grace period. See this graphic (explaining the renewal behavior without grace period) and this (explaining it with grace period). The difference is, that when Apple can renew the subscription within the grace period, the billing date doesn't change and therefore you do not lose revenue. Source

Since the grace period doesn't change the expiration date, it is your responsibility to ensure that users can access the paid content after their subscription expired (when you have the grace period option enabled):

you’ll need to update your entitlement logic to ensure you are providing service to customers within the grace period

Source

Keeping that in mind, it is possible to test the grace period => grant access to your content after the subscription expired. Unfortunately, without a server, you can't access a field telling you when the grace period ends. Therefore, you have to "calculate" it yourself corresponding to the subscription duration your user has. See this table showing the length of the grace period for each subscription duration.

Upvotes: 0

romainsalles
romainsalles

Reputation: 2143

I'm afraid it's impossible on iOS: you'll have to test it directly in production!

If you start implementing In-App Subscriptions on Google Play Store, it will be possible to test the grace period since you'll be able to change your payment method to the "Test card, always declines".

Upvotes: 2

Related Questions