How to Implement In-App Purchases for Android
By: Sophie Zoria
Tags: In App Purchase, Android App Development, Mobile Apps, Mobile App Development, Android App Developers

Monetization is an essential component of a successful strategy for a digital business. To ensure long-term growth, the chosen system has to be attractive to users, reliable, scalable, and easy to use. Understandably, implementing, or even selecting the right solution takes a lot of effort. Based on our expertise in the field, here is an in-app purchases Android tutorial that covers all essential aspects of the process.

Types of Monetization

Today, the market offers many ways to monetize the app, from relatively straightforward purchases to various forms of partnerships with other services. However, in a broad sense, most of them are creative spins on three basic ideas:

Pay-to-download Advertising In-app purchases

The first one is the most familiar and the closest to real-world transactions: the user is expected to pay in advance (sometimes after familiarizing with the demo) to get access to the app. The obvious downside of this model is the level of commitment it requires. Simply put, most people will not be happy to pay for something they have not tried yet. It is perhaps the main reason why paid apps comprise less than 4% of the Google Play Store content as of late 2020.

The second model allows using the app for free on the condition that advertisements will be occasionally shown to users. This method eliminates the paywall but requires a large userbase to be profitable. On top of that, over time, ads become a major nuisance, bringing the product’s value down.

A third option is an approach where the app itself is distributed for free but has content that needs to be purchased separately. In a sense, this is a combination of free and paid approaches, as users get access to some features before deciding the payment.

What is In-App Purchase

An in-app purchase, or IAP, is basically what it sounds like — a system for selling content to users from within the app rather than through an online store. It may be anything from access to premium content to advantage in a mobile game. In some cases, in-app purchases can be combined with other forms of monetization. For example, users can choose to upgrade to a premium version to stop seeing ads.

Google Play differentiates between two types of in-app purchases for Android. The first is subscription — access to paid content regularly. Once regular payments cease, users, lose access to paid features. This model is the most common in the distribution of enterprise apps as well as in services that publish content regularly, like online magazines.

The second is one-time purchases, where the payment is submitted once. After this, the product either stays in a user’s possession permanently or disappears after a certain number of uses (non-consumable and consumable, respectively). This model can be found in various e-commerce applications.

In-App Purchases: iPhone vs Android

Implementing in-app purchases on iOS are made through a purchase store embedded in the application. Once the app store verifies the transaction, the product is made available to the user. The process can be tested in a sandbox environment before it is made available to the general audience. To make them available on all user devices, the purchases are tied to Apple ID.

On Android, the transactions are handled by Google Play’s in-app billing library. To enable transactions, the Google Wallet merchant account is also required. One important difference is the inclusion of a free trial period that can be added in the Developer Console. Similarly to iOS, there is a possibility to test in-app purchase on Android through license testers. Importantly, unlike iOS, test purchases on Android may result in actual charges if the end-user is not a tester.

Implementing In-App Purchases: Android Tutorial

Google Play documentation has a detailed section on the integration of the billing library. To boil it down, here’s a step-by-step process:

Add the billing library to the app

Add the billing library dependency

Initialize the billing client instance

Connect to Google Play

List available purchases

Launch the purchase flow

Once this is done, you can proceed with testing different scenarios.

How Do I Check In-App Purchases on Android?

To make sure your app meets the quality standards, you need to run extensive testing for a variety of scenarios. In the case of purchases, this means testing for situations like:

A success scenario (the payment is approved by the billing library) A failure scenario (the e-wallet does not process the payment) A double-spending scenario (the same item is purchased multiple times)

All of these checks can be made in the test track environment via the test instrument. Android testing page even provides a list of recommended scenarios to assist the process.

Concluding Thoughts

In-app purchases are a viable monetization model for a broad range of use cases. Android development tools already have a range of ready-made solutions for implementing the functionality into the app and testing various billing scenarios. With our extensive expertise in the domain of enterprise solutions and a portfolio of successful products, we’ll be glad to help you release the product that aligns with your vision and marketing strategy.

Originally published at Swag Soft