Android in-app Purchases


At some point, we need to earn revenue through our application. We can monetize our application for removing ads, selling physical goods, providing some enhanced functionality to users. We can follow different monetization strategies that depend upon our application.

Using Google Play Billing:

 According to android documentations-

You can use Google Play’s billing system to sell the following types of digital content:

  • One-time products: A one-time product is a content that users can purchase with a single, non-recurring charge to the user’s form of payment.
    One-time products can be either consumable or non-consumable.
  • Subscriptions: A subscription is a product that provides access to content on a recurring basis. Subscriptions renew automatically until they’re cancelled. Examples of subscriptions include access to online magazines and music streaming services.

Note: Here we will discuss One-time products.

 Using Google Play Billing in-app:

1-Add the Google Play Billing Library dependency to your app’s build.gradle file.

And add these permission in the manifest file

2- In order to test or implement InApp Purchase / Subscription, we need a developer account and our app needs to be published either in alpha/beta/production level.

3-Now create a product or a subscription.   

We need to create the products which will be available for purchases on Google Play Console. We need to add Product ID, Title, and Subscription. Product ID should be unique for every product to be purchased.

4- Create an Activity and its layout file.

i-    XML file–

ii- Activity file and steps


Leave a Reply