You should be testing your integration throughout development. To test during the development phase, we recommend leveraging license testers to run through the scenarios described in this topic. To configure license testers, see Test in-app billing with application licensing. Show Using license testers provide the following benefits:
Here are some additional details about the test purchase process:
You can confirm the account that is making a purchase by expanding the purchase dialog. Note the following:
Before distributing your app, you can make use of Google Play test tracks to perform additional validation. For example, you can leverage test tracks to have your QA team qualify a new release. With test tracks, users can install your app from Google Play and test a version of your app that is not yet publicly available. Users can make real purchases using any of their payment methods in Google Play. To test your Google Play Billing Library integration using test tracks, do the following:
You can test your integration on any Android-powered hardware device running Android 1.6 or higher. The most current version of the Google Play application must be installed on the device. For general information about how to set up a device for use in developing Android applications, see Using Hardware Devices. Test one-time productsTest consumable productsWhen testing consumable products, we recommend testing a variety of situations, including the following:
You should also verify that purchases are properly acknowledged as described in . For purchases from license testers, a purchase will be refunded after 3 minutes if your app does not acknowledge the purchase and you will receive an email about the cancellation. You can also check the Orders tab in the Google Play Console to see if an order was refunded after 3 minutes. Test non-consumable productsNon-consumables should be tested the same as consumables, but you should verify an item cannot be purchased again within your app. Be sure to verify purchase acknowledgement for both non-consumables and consumables (when applicable) since the logic to process each the two types of purchases vary. Test pending purchasesYou should test a pending purchase where the item should be granted when the purchase state becomes
You can find more information at . Test subscription-specific featuresThe purchase flows for one-time products and subscriptions are similar, but subscriptions have additional scenarios, such as successful or declined subscription renewals. To test renewals, you can use the Test instrument, always approves and Test instrument, always declines payment methods that are available for license testers, as shown in figure 1. Use these payment instruments to test scenarios beyond the successful subscription scenario. Similar to one-time products, you should also verify that purchases are properly acknowledged as described in . For purchases from license testers, a purchase will be refunded after 3 minutes if your app does not acknowledge the purchase and you will receive an email about the cancellation. You can also check the Orders tab in Google Play Console to see if an order was refunded after 3 minutes. Renewal periodsTest subscriptions renew more quickly than actual subscriptions, and test subscriptions can renew a maximum of six times. The following table lists the testing renewal times for subscriptions of various durations. These times are approximate. You may see small variations in the precise time of an event. To compensate for variation, call the API to view the current status after every subscription expiration date. Production subscription period Test subscription renewal 1 week 5 minutes 1 month 5 minutes 3 months 10 minutes 6 months 15 minutes 1 year 30 minutes Time-based subscription features such as free-trials are also shortened for testing. The following table identifies the testing time periods associated with time-based subscription features: Feature Test period Purchase acknowledgement 5 minutes Free trial 3 minutes Introductory price period Same as subscription test period Grace period (both 3- and 7-day) 5 minutes Account hold 10 minutes Pause (1 month) 5 minutes Pause (2 months) 10 minutes Pause (3 months) 15 minutes Price changesYou can also use license testers to test price changes. Keep the following considerations in mind when planning test periods:
The following table shows test billing and notification periods for several actual billing periods: Actual base plan billing period Test billing period Test notification period (opt-in and opt-out regions with 30 day notice) Test notification period (opt-out regions with 60 day notice) 1 week 5 minutes 5 minutes 10 minutes 1 month 5 minutes 5 minutes 10 minutes 3 months 10 minutes 3 minutes 6 minutes 6 months 15 minutes 2 minutes 4 minutes 1 year 30 minutes 3 minutes 6 minutes Test casesExpand the following section by clicking Show/Hide to show testing scenarios you should use to verify your subscription integration. Monthly subscriptionTime User action System event Expected testing outcome 12:00 pm Sign up for an in-app subscription using your licensed test account and the payment method of "Test instrument, always approves" Subscription started 12:05Subscription renews 12:10Subscription renews 12:15Subscription renews 12:20Subscription renews 12:25Subscription renews 12:30Subscription renews 12:35 Subscription ends (after 6 renewals) User should lose access to in-app subscription content Monthly subscription with free trialTime User action System event Expected testing outcome 12:00 pm Sign up for an in-app subscription using your licensed test account and the payment method of "Test instrument, always approves" Subscription starts with free trial 12:03Subscription renews 12:08Subscription renews 12:13Subscription renews 12:18Subscription renews 12:23Subscription renews 12:28Subscription renews 12:33 Subscription ends (after 6 renewals) User should lose access to in-app subscription content Yearly subscription with intro priceTime User action System event Expected testing outcome 12:00 pm Sign up for an in-app subscription using your licensed test account and the payment method of "Test instrument, always approves" Subscription started at intro price 12:30 Subscription renews at regular price 1:00Subscription renews 1:30Subscription renews 2:00Subscription renews 2:30Subscription renews 3:00Subscription renews 3:30 Subscription ends (after 6 renewals) User should lose access to in-app subscription content Monthly subscription with grace period; user recoversTime User action System event 12:00 pm Sign up for an in-app subscription using your licensed test account and the payment method of "Test instrument always approves" Subscription started 12:01 Go to the Google Play app, Account > Subscriptions, click your test subscription, and change payment method to "Test instrument, always declines" 12:05 Subscription payment declines and user enters grace period 12:08 Go to the Account > Subscriptions section of the Google Play app, click your test subscription, and change payment method to "Test instrument, always approves" Subscription recovered and exit grace period 12:10Subscription renews 12:15Subscription renews 12:20Subscription renews 12:25Subscription renews 12:30Subscription renews 12:35Subscription renews 12:40 Subscription ends (after 6 renewals) Monthly subscription with grace period and account hold; user involuntarily churnsTime User action System event Expected testing outcome 12:00 pm Sign up for an in-app subscription using your licensed test account and the payment method of "Test instrument always approves" Subscription started 12:01 Go to the Account > Subscriptions section of the Google Play app, click your test subscription, and change payment method to "Test instrument, always declines" 12:05 Payment declined; enter grace period 12:10 Exit grace period; enter account hold User should lose access to in-app subscription content 12:20 Subscription is canceled due to involuntary churn Yearly subscription with grace period and account hold; user recovers during account holdTime User action System event Expected testing outcome 12:00 pm Sign up for an in-app subscription using your licensed test account and the payment method of "Test instrument always approves" Subscription started 12:01 Go to the Account > Subscriptions section of the Google Play app, click your test subscription, and change payment method to "Test instrument, always declines" 12:30 Payment declined; enter grace period 12:35 Exit grace period; enter account hold User should lose access to in-app subscription content 12:45 Go to the Account > Subscriptions section of the Google Play app, click your test subscription, and change payment method to "Test instrument, always approves" Subscription is recovered, renews, and exits account hold User should regain access to in-app subscription content 1:15Subscription renews 1:45Subscription renews 2:15Subscription renews 2:45Subscription renews 3:15Subscription renews 3:45Subscription ends (after 6 renewals) Yearly subscription with grace period and account hold; user involuntarily churnsTime User action System event Expected testing outcome 12:00 pm Sign up for an in-app subscription using your licensed test account and the payment method of "Test instrument always approves" Subscription started 12:01 Go to the Account > Subscriptions section of the Google Play app, click your test subscription, and change payment method to "Test instrument, always declines" 12:30 Payment declined; enter grace period 12:35 Exit grace period; enter account hold User should lose access to in-app subscription content 12:45 Subscription is canceled due to involuntary churn Monthly subscription with account hold and no grace period; user recoversTime User action System event Expected testing outcome 12:00 pm Sign up for an in-app subscription using your licensed test account and the payment method of "Test instrument always approves" Subscription started 12:01 Go to the Account > Subscriptions section of the Google Play app, click your test subscription, and change payment method to "Test instrument, always declines" 12:05 Payment declined; enter account hold User should lose access to in-app subscription content 12:15 Go to the Account > Subscriptions section of the Google Play app, click your test subscription, and change payment method to "Test instrument, always approves" Subscription is recovered, renews, and exits account hold User should regain access to in-app subscription content 12:20Subscription renews 12:25Subscription renews 12:30Subscription renews 12:35Subscription renews 12:40Subscription renews 12:45Subscription ends (after 6 renewals) Monthly subscription with account hold and no grace period; user involuntarily churnsTime User action System event Expected testing outcome 12:00 pm Sign up for an in-app subscription using your licensed test account and the payment method of "Test instrument always approves" Subscription started 12:01 Go to the Account > Subscriptions section of the Google Play app, click your test subscription, and change payment method to "Test instrument, always declines" 12:05 Payment declined; enter account hold User should lose access to in-app subscription content 12:15 Subscription is canceled due to involuntary churn You can use the Google Play Console to create codes for your own testing. Keep in mind that you may only create 500 promo codes per quarter across all managed products in an app. You should test the following promo code redemption scenarios:
Within these scenarios, you should test redeeming codes in as many ways as possible. We recommend perform the following tests at a minimum:
For each test, make sure that the item is correctly detected and that the user is notified. Test the purchase experience in different regionsLicense testers also allow you to test the purchase flow in any region without needing a real payment method for that country. Use the following steps to test:
You can clear Play Store data and cache and then repeat steps 3 and4 with any country you would like to test. After switching to a new country you will need to Clear Data for the Google Play Store to remove data related to the previous country.This method to test purchases allows you to test offer regional eligibility and the user experience in any region, regardless of where you are physically testing. |