Step By Step Guide for iOS Subscription Testing

Anurag Pandey

AccuWeather Senior iOS Developer

June 4, 2021
When it comes to recovery management, mobilizing and anticipating resources is key. ServiceMaster Recovery Management (SRM) relies on AccuWeather's advanced weather metrics to do just that.
Key Highlights
AccuWeather provides SRM with weather coverage on a national scale.

SRM uses AccuWeather's realistic and accurate forecasts to make big impact decisions.

The role of AccuWeather has aided in Hurricane Matthew recovery efforts.

Many apps have paid subscriptions for users to access premium features. Testing a subscription can be as challenging as developing it. In this article, we will go over the complete process of subscription testing.

I am going to outline to you step by step how the Apple Sandbox environment is used to test subscriptions prior to the rollout of subscription code changes. I’ll also talk about how TestFlight and production Testing can also be used to test the in-app subscription. There are definitely some takeaways that you will be interested in.

Types of Subscription Testing

Subscription testing is categorized into three categories: Sandbox testing, TestFlight (production Sandbox) testing and production testing.

Sandbox Subscription Testing

The Sandbox environment lets you test in-app subscription transactions without creating actual transactions. It uses the Apple Store infrastructure to simulate all subscription transactions. Sandbox is able to return a transaction as if it had been processed.

Create A Sandbox Account

First of all, to do any type of subscription testing, you need to create a Sandbox tester account:

  1. 1. Login to your iTunes Connect Account-> Users and Access -> Sandbox ->Testers to create new testers.

  2. 2. On your device, go to Settings-> App Store -> LogIn to your Sandbox Account.

How to Test Subscriptions

Sandbox testing is categorized into developer and production. There are no feature differences between these two. The only difference is that if you are running the app through Xcode, then Sandbox testing will use the developer Sandbox, whereas if your app is distributed through TestFlight, then Sandbox testing will use the production Sandbox.

Reduce Subscription Testing Duration

Sandbox automatically decreases the duration of auto-renewable subscriptions to allow shortened testing times. You can see below that the actual subscription of one year, for example, was reduced to one hour for testing purposes. Why wait a whole year to test the subscription?

Testing Duration

Actual vs Sandbox Subscription Duration Mapping


Testing Duration

Actual vs Sandbox Subscription Duration Mapping


Sandbox also auto-renews the subscription five more times and then expires.

Subscription Test Cases

Sandbox allows developers to test transactions such as multiple purchases, renewals, and expirations. In Sandbox, untested code is isolated from the production environment for testing purposes. It literally is a Sandbox to play in! 

To begin testing, you must log in to your Sandbox account in iOS Settings > iTunes & App Store as shown below underlined in red.

Settings / Sandbox Account

Login to Sandbox Account


Settings / Sandbox Account

Login to Sandbox Account


Let’s dive into testing a subscription purchase, auto-renewal, restore and expiration.

Test Case 1: Test for Subscription Purchase, Auto-Renewal, and Expiration

You can test your app subscription to ensure it can be purchased, auto-renewed, and will expire after five subscription renewals by following these steps:

  1. 1. Subscribe to your app subscription.

  2. 2. Close the app and open it after one hour to make sure your app is still in an active subscription state. I chose one hour here because one year translates to one hour in a Sandbox environment.

  3. 3. Close the app and open it again after about six hours (allowing five auto-renewals), and your app should be reset to the unsubscribed state. Sandbox automatically renews subscriptions up to five times and then sets the subscription as inactive.

Test Case 2: Test Restore Purchase for an Active Subscription

Using Sandbox, your app can be tested to ensure that it has an active subscription and if deleted, then reinstalled on the device, the active subscription associated with the user will be restored. 

One major drawback in Sandbox testing is that a subscription receipt isn't generated until you make a purchase, whereas in the production environment, a subscription receipt file is sent to the device as soon as the app is installed and can be validated for a subscription purchase.

Restoring an active subscription using Sandbox can be tested by:

  1. 1. Subscribe to auto-renewable subscription on your app. 

  2. 2. Delete the app on your device.

  3. 3. Reinstall the app and press the Restore Purchase button.

  4. 4. If all these steps are done within the time of the subscription test duration, then an active subscription will be restored. Otherwise, the user can be notified using an error pop-up that no active subscription was found.

Test Case 3: Test Restore Purchase for an Active Subscription on Multiple Devices

Adding a single subscription purchase on multiple owned devices can be tested on Sandbox. For example, if the user had both an iPhone and iPad, they can use the same subscription on both devices.


Testing the AccuWeather app subscription for multiple devices can be tested as follows:


  1. 1. Launch the app on the iPad and press the Restore Purchase subscription button.
  3. 2. Log into Sandbox on both the iPhone and iPad using the same Sandbox account.

      1. 3. Subscribe to the subscription on the iPhone.


      1. 4. Install the AccuWeather app on your iPad. 


    1. 5. If all these steps are done within the time of the subscription test duration, then an active subscription will be loaded on the second device. Otherwise, the user can be notified using an error pop-up that no active subscription was found.

Sandbox Reliability

Developer Sandbox is famously unreliable. For some reason, Apple never addressed it or they may not understand the inconsistency. Either way, don’t get stressed if it doesn’t work all the time.

TestFlight Subscription Testing

An application distributed by TestFlight uses the production Sandbox environment by default, therefore all testing steps will stay the same as the development Sandbox environment.

Production Subscription Testing

For an app that has not been released on the App Store, using an early version of the approved app is a great way to test subscriptions. Below are the steps for testing:

  1. 1. For this, you need to submit the app’s beta version to Apple’s review in iTunesConnect. Don’t forget to set the version release to manual release. 

  2. 2. Generate promo codes for the app from iTunesConnect.

  3. 3. Using the promo code, download the app from the App Store.

  4. 4. Subscribe to your subscription. As the app is approved by Apple (but not released), it will still perform the same way as a live app.

Important Takeaways

Subscriptions are automatically renewed up to five times and expire after that. This behavior can’t be changed by the user. 


Sandbox environment has reduced subscription duration which is helpful in testing. 


There is no purchase subscription receipt available in the Sandbox environment until a purchase is made.


Testers will not be charged for the subscription purchases done in either the development or production Sandbox environment.



Test Subscription purchases

Testing Subscriptions with Xcode and Sandbox

Anurag Pandey

Anurag Pandey

AccuWeather Senior iOS Developer

An iOS enthusiast with a passion to dive deeply into architectures, design patterns, standard principles and explore new technologies.

AccuWeather Enterprise Solutions, the world's leading commercial weather source partnering with more than 240 of Fortune 500 companies and thousands of businesses and government agencies worldwide, provides the most accurate, actionable weather data, forecasts, and intelligence that saves lives, protects property, drives revenue, minimizes risk, increases productivity, and more for clients worldwide. AccuWeather Enterprise Solutions has focused on the business impacts of weather for over 50 years, serving clients in all 50 states in the United States and worldwide including all of North America, Europe, Africa, Australia, South America and Asia. Clients across all industries rely on AccuWeather Enterprise Solutions for the most accurate weather information and insights to drive quantifiable business results. Government and emergency management agencies also rely on AccuWeather for the best forecasts of severe weather events - floods, tornadoes, hurricanes, cyclones and others - available from any source. By forecasting and communicating the weather the most accurately and effectively worldwide, focusing on impacts - telling people how, why, and what they need to do in order to save lives and minimize losses - AccuWeather has saved tens of thousands of lives and tens of billions of dollars in property damage.

Related Posts

Press Release

AccuWeather Challenges X for Labeling Their Accurate Beryl Forecasts as Misinformation

AccuWeather's team of Expert Meteorologists and Hurricane Experts led the way by forecasting that Beryl would become a major hurricane before other known sources even considered it a tropical storm. State College, PA - July 12, 2024 - X (formerly Twitter) was criticized for labeling AccuWeather’s Hurricane Beryl map misinformation, sparking controversy in the weather...

Fri, 12 Jul 2024 18:40:00 GMT

Press Release

AccuWeather Signs Global Climate Science-Media Action Plan Pledge At The AMS Annual Meeting

AccuWeather, scientific associations, and high-profile media outlets sign pledge ensuring climate change communications are accurate, accessible, actionable

Wed, 31 Jan 2024 00:49:50 GMT

Press Release

AccuWeather Does Not Support Project 2025 Plan to Fully Commercializing NWS Operations; NOAA has Critical Role in American Weather Enterprise

AccuWeather Does Not Support Fully Commercializing NWS Operations; NOAA has Critical Role in American Weather Enterprise

Wed, 10 Jul 2024 13:33:34 GMT