Back to blog

A Complete Guide to Test iOS Subscription

Many applications need users to pay a membership fee in order to access premium features. It is critical to test App Store subscriptions, but it is also difficult to do it properly. Apple's subscription documentation is difficult to understand, and Apple has never been good at providing resources.
In this article, we will go over the entire subscription testing process.

Types of Subscription Testing 


There are three types of subscription testing.

  I. Sandbox testing
 II. TestFlight testing
III. Production testing

Set Up A Sandbox Account

To begin any form of subscription testing, you must first create a Sandbox tester account:

1. Sign in to your App Store Connect account and navigate to Users and Access ⇒ Sandbox ⇒Testers to add new testers.

2. Navigate to Settings⇒ App Store⇒ Login to your Sandbox Account on your device.

Do not sign in to the production environment with your test user account. If you do this, the sandbox account becomes invalid and cannot be used any longer.

I. Sandbox Testing:


The first line of security is the developer sandbox. To save time when moving on to production testing, make sure you understand the constraints throughout development.

The Sandbox environment allows you to test in-app subscription transactions without actually establishing them. It simulates all subscription purchases by utilizing the Apple Store architecture. Sandbox can return a transaction as though it were processed.

Sandbox testing is divided into two types:

  • Developer sandbox testing
  • Production sandbox testing

If you launch your app from Xcode, subscription testing takes place in the development sandbox. Subscription testing takes place on the production sandbox if your app was released using TestFlight.

Reference: Testing at all stages of development with Xcode and sandbox

Note: Subscription duration has been decreased to allow developers to test many purchases, renewals, and expirations.

To begin testing, go to iOS Settings > iTunes & App Store and sign in to your Sandbox account.

Let's have a look at how to test a subscription purchase, auto-renewal, restoration, and expiration.

1. Run Subscription Purchase, Auto-Renewal, and Expiration tests.

   Assume your subscription is a one-year auto-renewable one:
  • Enroll for your in-app subscription.
  • Close and reopen the app after 1 hour to ensure that your app is still in active subscription status.
  • After around 6 hours, close the app and reopen it; your app should be reset to the unsubscribed condition. This occurred as a result of the sandbox environment's automated renewal of subscriptions

2. For an active subscription, try restoring the purchase.

One significant disadvantage of the sandbox environment is that no receipt file is created on the device until a subscription is purchased, but in the production environment, a receipt file is created as soon as the app is loaded on the device.

  • Subscribe to your recurring subscription.
  • Remove the app from the device.
  • Reinstall the app and then select the Restore Purchase option.
  • If all of these procedures are completed during the subscription testing time, the active subscription should be reinstated; otherwise, the user should be notified that no active subscriptions were identified.

3. Test with restoring purchases across multiple devices:

  • On device A, sign up for a monthly subscription.
  • Before the subscription ends, install the app on device B.
  • Log into the same sandbox account that was used on device A
  • Start the app on device B.
  • Select the "Restore Purchases" option.

4. Test for upgrades and downgrades:

Since the sandbox environment lacks a subscription management UI, you'll need to provide buttons or other mechanisms within the app to test purchases that trigger upgrades, downgrades, and cross grades.

II. TestFlight Testing:


TestFlight operates similarly to the sandbox, but with production App Store accounts.

Since TestFlight applications use the production Sandbox environment by default, all testing stages will be the same as in the development Sandbox environment.

III. Production Testing:


There are a few ways for testing in production before a version hits the App Store, but you should also maintain testing live on the App Store whenever the app is updated.

Getting an early version of an app approved is a good way to test subscriptions for an app that has yet to be published on the App Store.

Production Testing Prior to Launch

  • You must first submit the app's beta version to Apple for review. Don't forget to change the version release mode to Manual.
  • Create a promo code for the app using App Store Connect.
  • Download the app from the App Store using the promo code.
  • Subscribe to your subscription. As the app has been authorized by Apple, it will function in the same way as a live app.

Testing Cancelations and Refunds

As cancelations cannot be tested in sandbox environments, they must be tested in production.

Testing cancelations:
  • Subscribe on a monthly subscription
  • Verify that the app enters the subscription state with all features unlocked.
  • To cancel the subscription, go to the App Store app.
  • Allow a minute or two for Apple to add the cancelation to the payment queue.
  • Relaunch the app.
  • Auto-renew should be turned off on the receipt at this point. The app should remain subscribed until the current subscription cycle finishes, then revert to the unsubscribed state.

Testing refunds:
  • Subscribe to a monthly subscription.
  • Ascertain that the app enters the subscription state with all features unlocked.
  • Please contact Apple and ask for a refund.
  • Allow one day for Apple to complete the refund and put it to the payment queue.
  • Relaunch the app.
  • The refund event should be read from the payment queue at this point, and the app should restore to the unsubscribed state.

Conclusion


Testing iOS applications could be a difficult undertaking. This article should have given you an overall good picture of iOS application testing.

However, choosing the proper strategy, the best possible testing methodology, techniques, and so on will ensure the success of the app.

Sign up for Subscription Management and Analytics

Back to blog