Test cases and workflow for in-app purchase of android app
10 October 2017, by Helenzys Team
n this blog, I would like to share android in-app product types, workflow of in-app purchases, and the set up of the test releases by a developer. These 3 things are essential for a tester to start in-app purchase testing.
In-App Product Types
The android in-app billing supports the managed in-app products and subscriptions.
Managed product: Once you purchase a product, that item cannot be purchased again until you consume the item, by sending consumption to Google play.
Subscriptions: This product type offers sell features, content, and services to users from the app with recurring weekly or monthly or annual billing.
In-app purchase workflow and settings for releasing apps to test:
The Google Play Console provides several tools to test the in-app billing. There are three stages of app deployment in android in-app purchase:
Alpha and Beta Release (Sandbox account):
Publish app directly to Google Play’s alpha and beta release channels for testing purpose. The app will be available only to the tester who can download and install the app to the device from Play Store.
To release a test app, first, the developer should create and add test-user Gmail accounts to ‘Tester List’ group in Alpha/Beta release section.
Both the alpha/beta release is same; the only difference is adding the number of tester accounts.
- Alpha test – we can create a small group of testers.
- Beta test – we can create up to 50 lists per track and can add up to 2000 users in each track.
Testing in-app purchase (In-app billing – Subscription type)
To test in-app purchase, we need to publish the app to an Alpha or Beta channel in Google Play. You can choose any user to be a test account and any user of test account can make test purchases with any available payment methods, without any actual charges to their accounts.
First, the developer has to upload and publish in-app products in play console before publishing the APK itself. Then, add user account ID (Gmail ID) to License testing section in the developer console and we can add up to 400 test-user accounts to test in-app purchase products.
Steps to add: Login to developer console and Go to Settings –> Accounts details then add the addresses to License Testing field.
Note: The address should belong to Google account. It will not accept other accounts to add as license tester.
Once you add the users as license tester accounts and saved the changes, within 15 minutes those users can make a test purchase of your in-app products. After publishing the app, the tester needs to opt-in the alpha/beta release of the app using the provided opt-in URL before making test purchases. In this case, the developer will provide an opt-in link to the test users.
The opt-in URL will generate once the developer has created and added the license test users in the license section. Before that, the developer will send an invitation to users to become a part of tester group and then copy and send generated “opt-in URL” to all test-user accounts.
Once test-users get authorized test access, they can make a purchase without any actual charges. After all the processes have completed, the app will be available in tester’s Play Store who were all added as the Alpha/Beta tester.
Test purchase is auto-renewable on daily basis for any actual duration. The app will automatically renew every day until you cancel the purchase.
Important note: Licensed account must be on the user’s android device. If the device has more than one account, the purchase will be made with the account that downloaded the app. If none of the accounts have downloaded the app, the purchase is made with the first account. Users can confirm the account that is making a purchase by expanding the purchase dialog.
Steps to start an in-app purchase (Subscription) test:
- The user will receive an invitation to become an Alpha/Beta tester. Click on ‘Become a Tester’ button in the mail to be a part of the tester group.
- Later, the tester will get detailed mail along with opt-in URL link of test application from Google Play Console.
- Click on ‘opt-in URL.’ It will redirect to your Play Store app and shows test app with all the information.
- You can download and install the app to your phone from Play Store using licensed tester account.
- To add payment methods for purchasing the app, select Slider Menu in Google play store –> choose Account option –> Select Payment methods –> then add your valid international Credit/Debit Card or Net banking detail along with your name and address.
- Click on Save in the popup window.
- The Payment method will be successfully saved. If you did not add your Payment method, it will ask the card details while doing the purchase.
- Once the payment details are successfully added, an amount of ₹50.00 will be debited from your account for Debit/Credit card verification but after few minutes, the amount will be credit back to your account. It will be debited while adding the card detail only. It will not debit while subscribing to the app (If you are a licensed test-user).
- Next, you can start testing subscription function in your app
- The following message will be displayed on Google popup when you make a payment. “This is test subscription. It will recur daily. You will not be charged.”
- You will get a receipt for your purchase order from Google Play Store on successful purchase.
- The subscription will auto-renew and send email every day until you unsubscribe the purchase.
- Pricing info should be displayed based on region-specific currency and needs to verify whether the mentioned price has tax included or excluded.
- Span time of billing period and description about your subscription should be shown as per requirement.
- To verify, the app will deduct given price while purchasing the subscription.
- Services or Features should be accessible after successful purchase.
- Check whether the purchase auto-renews in the specified duration because it should be continuously renewing the purchase until you cancel the purchase.
- Check whether the subscription is expired once the specific subscription period is over. The subscription will expire only if the user canceled auto-renewal or subscription (Auto-renewable product).
- Check whether the app is expired on time and make sure that the users should not access purchasable content or features (Non-auto renewable product).
- Subscription features should be automatically restored while re-install/updating the app. If it is a Non-consumable product, the app should have restore button for restoring the purchases.
- Use the same purchase id to multiple devices and verify whether the app has subscribed state.
- Use different accounts (ID doesn’t have a subscription) to Google Play and install the app and verify that the app has Un-subscribed state.
- Subscription features should continue to users after canceling the auto-renewal or subscription and until it expires.
- Check the status of in-app purchase when users purchase while there is no network on the device. ‘No internet connection’ should be shown when the user tries to purchase a product and while accessing purchasable features.
- Once the network connection comes back, check the status of previously attempted purchase at that time of network failure.
- The app should validate the purchases on the update
- Check the subscribe function of product that was already purchased. It should not allow purchase again.
- Verify that the users get purchase receipt from Google play until they cancel the subscription.