Question

How to do Apple monthly subscription grace period testing?

  • 2 June 2023
  • 3 replies
  • 75 views

Badge

Hi there,

I am testing a monthly renewing subscription and it’s going great with RevenueCat (thank you). 

I enabled the grace period on the subscription in the app store for sandbox only. I want to test it, to see what happens and what my app will do. I imagine, there will be one of these “Had a billing issue” events in the customer history and the subscription entitlement will remain active.

But my question is, do I have to just wait for the sandbox to throw one of these billing issues into the mix and continually refresh the page waiting for it? It’s tedious to refresh the page because the sandbox data checkbox unticks itself also. Is there anyway to force a billing issue in order to force the grace period being triggered to be able to test this case?

What I want to get out of the testing is:

  1. To see how long the grace period lasts in the sandbox environment. The one I set in the app store is for 16 days, but is the sandbox one also accelerated?
  2. To see with my own eyes, my app remaining in the subscribed state for the duration of the grace period (it *should* if the entitlement remains active for the grace period).
  3.  What the customerInfo from Purchases.shared.getCustomerInfo will look like and if there will be some extra fields I can check on like something to do with a gracePeriod. (I looked around in the iOS SDK but couldn’t find anything). It would be cool to show to the user that their subscription status is in a grace period and will expire on x date if they dont sort out their billing info.

Cheers

Sebastian


3 replies

Userlevel 5
Badge +9

Hey Sebastian,

There is no grace period in sandbox unfortunately.

In production, a grace period will show as an active subscription that will not renew. This is a good guide that talks more about how grace periods look in RevenueCat: https://www.revenuecat.com/docs/how-grace-periods-work 

Badge

Hi Sharif,

Does this mean that the entitlement will remain active until the end of the grace period? So if I had something like this in my code it would be accurate?

Purchases.shared.getCustomerInfo { (customerInfo, error) in
if let customerInfo = customerInfo {
if customerInfo.entitlements.all["entitlement_name"]?.isActive == true {
// grace period will reach this part of the code?
}
}
}

As there is no way to test this in the sandbox, and apple say you have to provide the service if you enable the grace period, it’s making me hesitant to enable it if I can’t test the behaviour actually.

 

Cheers

Sebastian

Userlevel 5
Badge +9

Does this mean that the entitlement will remain active until the end of the grace period?

Yes exactly, your code looks correct since all you have to do is check if the entitlement is active. Entitlements should be active until either the grace period ends due to no payment or a renewal occurs.

It’s unfortunate that this is the case but it is on Apple’s end to support grace periods in sandbox.

Reply