How to test In-App Purchases on Android Devices
By Shreya Bose, Community Contributor - May 11, 2023
Given that monetization is a central feature of most apps, and one that is instrumental to their potential success, it is natural that app developers will want to test the in-app purchase function in Android apps.
This article will take readers through a quick and easy process of testing the in-app purchase feature on real Android devices.
Most Android apps offer one of two purchase models:
- In-app products: The app enables the purchase of one-time physical products and services. For example, a book or a cleaning service. Once the product has been consumed, the consumer has to manually make another purchase if they want to use it again.
- Subscriptions: The app offers paid services or products for a certain period of time, and once the period expires. At the end of the billing cycle, the paid services are renewed automatically by deducting the payment amount from the user’s account. If, for some reason, the subscription is not renewed, the paid product or service ceases to be available.
The process outlined in this article allows QAs to test both methods of in-app purchase (IAP).
Why test in-app purchases (IAP) on real Android devices?
Every app developer and tester on the planet is aware of the current state of device fragmentation. More than 4 billion people access the internet via 9000+ distinct devices. It isn’t uncommon for an app to malfunction in different devices, given the specifications of hardware and OS.
To ensure that the app, especially its in-app purchase function, is working flawlessly, it is essential for testers to run it on real Android devices. Given that this feature, in particular, involves real money, developers cannot afford to let it malfunction and misplace or incorrectly process a customer’s money.
Don’t depend on emulators and simulators to test in-app purchases. They simply cannot replicate real user conditions in a way real devices can. Compatibility and performance tests especially cannot give conclusive results on virtual Android devices.
The only way to get completely accurate results for every test is to run them on real Android devices. The app has to be compatible with all native device features as well as the operating system in question. This requires access to either an in-house digital lab populated by thousands of Android devices (which are constantly updated with new devices) or to a cloud-based repository of real devices, like the one provided by BrowserStack.
How to test in-app purchase on real Android devices
This section will cover how to test in-app purchases for both published and in-development apps. But, to test this feature, sign up for a free account on BrowserStack.
Note: You will need a valid online payment option to test this feature.
Once the prerequisites above have been completed, follow the steps below:
- Login to your free BrowserStack account.
- Navigate to App Live.
- After signing in, the App Live dashboard will appear, displaying the list of real Android devices available for app testing.
- Upload the .apk file if the app to be tested is not published on Play Store.
- If the app is already published, choose the Android device it should be tested on. In this example, we choose the Samsung Galaxy S21.
- You can also pick a sample app from the ones available in the Live dashboard.
- On selecting the device, the uploaded/selected app will automatically open in the device in question.
- Alternatively, you can sign in to Google Play Store, download and install a published app and test its in-app purchase feature. Just pick the Install via Google Play Store option.
- In this example, we are testing the Duolingo app.
- If the user is signing up for an account on the app for the first time, they will have to go through a short lesson before accessing the purchase option.
- Once the purchase option shows up, simply click through it as you would do on your handheld device. This step helps in testing the monetization of the app on real android devices securely.
- Simply enter your payment information (if it is not set up already) and check if the purchase goes through as it is meant to. Once it does, run the app to check if you have access to the premium features as promised.
Note: All data on BrowserStack devices remains completely secure. The minute you log out, all user data is permanently deleted from all devices used during the test. Read more on our security.
As the above demonstration makes amply clear, users can test in-app purchases on Android devices effortlessly on BrowserStack App Live. By signing up for a free account on BrowserStack, users can conduct in-app purchase testing on Android in a few clicks. No longer do they have to scramble around Googling “android test purchase “, “google play test in app purchase” or “android billing testing” or the like.
Note: You can also test your Google Play Billing Library integration with the official documentation.
What’s more, they can perform Android billing testing on hundreds of Android devices, both latest and older models. With a couple of clicks, QAs can ensure that the in-app purchase function is working exactly as required. BrowserStack’s real device cloud offers an exhaustive range of Android devices like Google Pixel, Galaxy, Xiaomi, etc. running on Snow Cone (12), 11, 10, Pie (9.0), Oreo (8.0), Nougat (7.1, 7.0), Marshmallow (6.0), Lollipop (5.0, 5.1), Kitkat (4.4, 4.3), etc.
Mobile app testing on Android devices is a cakewalk with App Live. Not only can testers check how an app or app function works on real devices, but they can also perform real-time debugging, test apps in dev environments, and leverage multiple features that make the testing process faster, easier, and more accurate in terms of results.