The Ultimate Guide to Subscription Testing on Android

Maria Bordunova avatar
Maria Bordunova

You’ve already implemented access management logic for your subscription app, so now it’s time for testing. Before submitting your app for Google Play Console review make sure it responds to changes in subscription status and grants users access to your premium content. Actions related to subscription lifecycle events should lead to user access updates. 

Today, we will follow detailed guidance from Google and explore the main subscription testing scenarios.

Prerequisites

Before we start, make sure that:

  • There are active subscriptions in the Google Play Console
  • The logic of purchasing subscriptions is implemented in your app

Sandbox environment setup

License testing

First, we need to configure the License testers list to access all the possibilities of testing subscriptions. After adding a tester’s Gmail address in the Google Play Console you have to log in to the device with the email. License test users can purchase subscriptions for free and use one of two payment methods:

  • Test card, always approves
  • Test card, always declines

Test devices

You can use both physical devices and emulators to test subscriptions. For emulators, make sure that it has the Play Store installed. You can check that by selecting Tools -> AVD Manager in Android Studio.

Test Subscription Periods

Subscriptions automatically renew until they are canceled. Test subscriptions renew up to six times and then will be cancelled automatically. Subscription Duration in the Sandbox environment differs from production and is shortened for testing purposes: 

Duration of subscription states such as Grace period are also reduced in the Sandbox environment: 

Test subscription-specific features

Purchase a subscription with successful payment 

1. Purchase a weekly subscription with the following payment method: Test card, always approves.

2. Check that you have received an email from Google Play that confirms the subscription is purchased. 

3. Make sure that your app unlocks the premium content after the purchase.

4. Wait for five minutes for the next renewal. Restart the app and check whether you still have access to the content. 

5. Wait for 25 minutes for another five renewals. When the last renewal period ends, Google Play cancels the subscription. Check that you have received an email from Google confirming the cancellation of the purchase.

6. Make sure that the premium content is no longer available for you.

Cancel an active subscription

1. Make sure that you have an active subscription in your app.

2. Open Google Play and click on the account icon at the top right of the screen. Choose Payments & Subscriptions -> Subscriptions.

3. Tap on the active subscription. 

4. The Manage Subscription tab will be opened. Click on the button Cancel Subscription and confirm the cancellation. The subscription will be active for the entire current billing period. But the next renewal will not be processed. 

5. Make sure your app is still granting access during the current billing period. 

6. After the end of the billing period, the subscription will be canceled. Make sure your app has ceased to provide access to the content. 

Try to purchase a subscription with the fail method 

1. In the purchase dialog, select the following payment method: Test card, always declines and click Subscribe.

2. Google Play will return an error.

3. Make sure that your app handles the error correctly and doesn’t provide access to the premium content.  

Access recovery

Users sometimes need to restore active purchases when they reinstall your app for any reason or when they use the app on several devices. If the user uses the same Google account, your app should provide the possibility of restoring subscriptions to maintain access to the purchased content. For more information, see the Handling the subscription lifecycle guide in the Google docs. The following test cases assume that you check active subscriptions at the start of your app.

Reinstall the app

  • Make sure that you have an active subscription and the app provides entitlements to the premium content. 
  • Reinstall and open the app on the same device.
  • Make sure that your app correctly grants access to the user.

Multiple devices

  • Run your app on device №1 and purchase a subscription.
  • Make sure that you have access to the premium content. 
  • Install and open the app on device №2. 
  • Make sure that your app correctly grants access to the user.

Free trials 

If you would like to give new subscribers the opportunity to use the subscription free of charge for a specified period of time, configure Free trial as Enabled and specify its duration in the subscription settings in the Google Play Console.

By default, users can only get one free trial or intro price for all subscriptions in the app. You can change that behavior. Go to Google Play Console -> All Apps -> Your App -> Monetize -> Products -> Subscriptions -> Manage subscription settings.

Purchase a subscription with a trial

1. Make sure that the subscription with a free trial hasn’t been purchased yet from the test Google account.

2. Start purchasing a subscription with a free trial (a weekly subscription in the example). 

3. Make sure that the purchase dialog notifies that you’ll be charged only after the trial ends:

4. Purchase a subscription with the approved test card.

5. Check that you’ve been notified by Google via email that the subscription includes a free trial period.

6. Make sure the app grants access to the premium content.

7. Make sure that you have been charged for the full subscription amount only after three minutes (you will receive an email from Google).

8. The app should grant access to the premium content until the subscription expires and the subsequent automatic cancellation.

Cancel an active trial

1. Repeat steps 1–4 from the previous case.

2. Cancel the subscription via Google Play without waiting three minutes. 

3. The subscription will remain active until the end of the trial. Make sure the app grants access to the premium content until the free trial period ends.

4. Make sure that you haven’t been charged when the free trial period ends.

Introductory price

If you would like to offer new subscribers a discounted price for a specified duration, you can configure an Introductory price in the subscription settings. In a test environment the Introductory price period lasts the same as the subscription test period. Google makes it possible to customize the intro price in different ways; choose the necessary one and test according to the corresponding scenario described below.

Single payment

New subscribers pay an introductory price only once for a specific period of time. After the end of the period, they pay the usual fixed subscription price. 

1. Make sure that the subscription with an intro price hasn’t been purchased from the test Google account yet.

2. Start the process of purchasing a subscription (example shows a weekly subscription).

3. Check that Google offers to purchase a subscription at the introductory price.

4. Purchase a subscription with the approved test card.

5. Wait for the end of the billing period. The subscription should renew at the regular price (you will receive an email from Google with the details). 

Recurring payment 

New subscribers pay an introductory price for a fixed number of billing periods. Then they pay the usual subscription price.

  1. Repeat steps 1–5 above.
  2. Wait for the end of the billing period. Make sure that the subscription renews at introductory price again (you will receive an email from Google with the details). 
  3. Make sure that the third step was repeated for the number of billing periods specified in the intro price settings.

Grace period

Users may experience payment issues at the end of the billing period. While Google is trying to re-charge the money, you can still grant access to the subscription. Configure Grace period in the subscription settings in the Google Play Console for that purpose.

Grace period with payment resolution 

  1. Purchase a monthly subscription with the approved test card.
  2. Open the Google Play app. Choose Account -> Subscriptions & Payments -> Subscriptions. Click your test subscription and change the payment method to “Test card, always declines.”
  3. After five minutes, payment should be declined. The subscription enters the grace period. 
  4. Make sure that during the grace period the user still has access to the subscription.
  5. Change the payment method in Google Play to an approved test card. 
  6. After another five minutes (duration of the grace period in the test environment), the subscription successfully renews, recovers, and exits grace period.
  7. The app should grant access to the premium content until the subscription expires and the subsequent automatic cancellation. 

Grace period without payment resolution 

  1. Please follow the Grace period and Account hold section below.

Grace period and account hold

The subscription goes into the Account hold state when the user is experiencing payment issues and grace period isn’t configured or has ended without payment resolution. The user no longer has access to the subscription while Google is retrying the payment method. Unlike the Grace period, Account hold does not need to be configured, and its support is mandatory for all developers.

With payment resolution 

Note: Before we start, make sure that the grace period is configured for the subscription. 

  1. Purchase a monthly subscription with the approved test card.
  2. Change the payment method in Google Play to a declined test card. 
  3. After five minutes, payment should be declined and the subscription should enter the Grace period. 
  4. After another five minutes, payment should be declined again and the subscription should enter account hold. The app should stop giving access to the subscription content. 
  5. Change the payment method in Google Play to an approved test card. 
  6. In the next 10 minutes the subscription renews and exits Account hold.  
  7. Make sure the app grants access to the premium content until the subscription expiration and the subsequent automatic cancellation. 

Without payment resolution 

  1. Repeat steps 1–4 from the previous case above.
  2. After 10 minutes, the subscription should be canceled. Make sure that the user has lost access to the subscription.

Account hold and no grace period 

Account hold with payment resolution 

Note: Before we start, make sure that the grace period isn’t available for the subscription. 

  1. Purchase a monthly subscription with the approved test card.
  2. Change the payment method in Google Play to a declined test card. 
  3. After five minutes, payment should be declined and subscription should enter Account hold. Make sure that the user has lost access to the subscription.
  4. Change the payment method in Google Play to an approved test card. 
  5. After 10 minutes (duration of the account hold state in the test environment), the subscription should recover, renew, and exit the Account hold.
  6. Make sure the app grants access to the premium content until the subscription expiration and the subsequent automatic cancellation. 

Account hold without payment resolution 

  1. Repeat steps 1–3 from the previous case above.
  2. After 10 minutes, the subscription will be canceled. Make sure that the user still doesn’t have access to the premium content.

Downgrade/Upgrade

You can provide your active users with the ability to upgrade and downgrade subscriptions. In these cases the previous subscription is invalidated, and the new subscription takes place. Let’s have a look how the ProrationMode value affects your subscribers while upgrading from a base to a premium subscription. The following test cases assume that the Upgrade button has already been added to your app.  

Immediate upgrade 

  1. Purchase a base subscription.
  2. Make sure your app grants access to the base content of your app.
  3. Click on the Upgrade button and purchase a premium subscription with the suitable value of the following ProrationMode values: IMMEDIATE_WITH_TIME_PRORATION, IMMEDIATE_AND_CHARGE_PRORATED_PRICE, IMMEDIATE_WITHOUT_PRORATION, IMMEDIATE_AND_CHARGE_FULL_PRICE.
  4. The subscription is upgraded immediately. Make sure your app unlocks the premium content of your app.

Upgrade after renew

  1. Purchase a base subscription.
  2. Make sure your app grants access to the base content of your app.
  3. Click on the Upgrade button and purchase a premium subscription with the DEFERRED ProrationMode value.
  4. The subscription is upgraded only when it renews. Your app should unlock premium content only after renewing the subscription.

Refunds

All of the previous scenarios were executed in a test environment. To test the refund, you need to buy a subscription for money in the production environment. 

  1. Please be familiar with Google’s Refund policy before making a purchase.
  2. Purchase a subscription.
  3. Request a refund on Google Play
  4. Wait until Google processes your request (usually one day).
  5. After the completed refund, your app should stop granting access to the user.

In Conclusion

In this article we’ve explored the main testing scenarios, but there are a few more, such as resignup or promo codes testing which are covered in the Google documentation.

We hope you successfully tested your subscriptions and didn’t find any bugs. But even if you did, it’s great news to find them before publishing your app. Implementation of subscriptions has never been easy and requires tremendous resources for developing access management logic — there are so many scenarios and use cases. Qonversion significantly simplifies this process by providing you with ready-to-go solutions so you can use purchase, restore and checkPermissions methods and manage your subscriptions without any issues. In any case, whether you use an in-house solution or Qonversion, please do your testing — it is a must. Remember: It is better to be safe than sorry; the trust of your users is everything.