How to test out Auto-Renewable Subscriptions on iOS

Tram Ho

General Notes

The subscription time has been significantly shortened for testing purposes. This allows users to quickly extend testing multiple times and expire via TestFlight or sandbox environment

Time subscription actual -> Test test time

1 week -> 3 minutes

1 month -> 5 minutes

2 months -> 10 minutes

3 months -> 15 minutes

6 months -> 30 minutes

1 year -> 1 hour

Subscription will automatically renew 6 times per account, then subscription will automatically expire at the end of each subscription period. This renewal will be done automatically whether we have the app open or not, it’s like the renewal on the App store. But unlike on the App store, there’s no way to cancel subscription so there’s no way to directly test cancel subscription. There is also no way to test subscription management while using TestFlight or a sandbox environment.

Each automatic renewal will send each transaction to the application. Depending on how long it takes for these transactions to be processed the next time the application is reopened. To authenticate these transactions, a password is required each time. When the application is running in the real environment (App store), this password prompt should not be triggered.

TestFlight Testing

First, subscriptions on TestFlight prompt users 3 times to enter their Apple ID password and prevent them from using Touch ID to complete the transaction. But sometimes, after starting a new subscription multiple times on the same device (after the first 6 auto-renew), only 2 password prompts are shown. It might be annoying to see multiple password requests during testing, but rest assured, once the app has been released to the App store, the purchase flow will work as expected (usable Touch ID on iOS 11)

Test expires and expires:

  1. Subscribe a subscription package with duration for 1 month
  2. Close the app and set the timer for 5 minutes
  3. Restart the application
  4. If prompted, enter the password

At this point, the application will continue to operate in the registered state. Reattach steps 2-4 a few more times (or just close the app and wait) until the 35 minutes have passed (6 renews every 5 minutes plus the initial 5-minute subscription). Now, the application will revert to the unregistered state and allow the user to re-subscribe.

Test to restore after it expires

  1. Subscribe a subscription package with duration for 1 month
  2. Close the app and wait 35 minutes
  3. Restart the application
  4. If the prompt is displayed, enter the password Now the application is back in the unregistered state
  5. Tap and button “Restore Purchases” => Result: App is still in subscription mode

Test to restore while subscription

  1. Subscribe a subscription package with duration for 1 month
  2. Remove the app and reinstall within 5 minutes
  3. Restart the application
  4. If prompt is displayed, enter password => Result: App is currently registered subscription

Test restore on multiple devices

  1. Subscribe a subscription package with duration for 1 month
  2. Install the app on another device before the subscription expires
  3. Restart the application
  4. If prompt is displayed, enter password => Result: App is currently registered subscription

Sandbox Testing

It is also possible to test auto-renew subscription via your text sandbox account, but this topic will be covered in another post.

Production Testing

For an unreleased app on the App Store, using the first approved version of the app is the best way to test out subscriptions:

  1. Submit a beta of the App to the App review. Make sure to set “Version Release” to “Manually release this version” so that the app won’t be released on the App Store.
  2. Generate promo code for the app. This can be done for free apps that are approved but not available on the App Store.
  3. Download apps from the App Store using a promo code.
  4. Subscribe

Since this app has been approved, the subscriptions will work exactly as they were when the app was available on the App Store, including charging testers, subscribers, and subscription management on the App store. Commercial tokens can be given to the testers to test the app for free. Subscriptions are paid out through a promotional code and work exactly like a paid subscription, except with automatic renewal.

Reference source: https://www.revenuecat.com/blog/the-ultimate-guide-to-subscription-testing-on-ios

Share the news now

Source : Viblo