From Zero to Android In-app Purchase Subscriptions: Configuration

The missing guide on how to add subscriptions to your Android app.

Configuring in-app subscriptions on Android is hard. At RevenueCat, we want to help you navigate this process as much as possible. The following is a guide to take you from a zero to subscriptions on Android.

In this post we’ll show you how to:

  1. Setup your products in Google Play Developer Console
  2. Set up your app in RevenueCat
  3. Configure entitlements in RevenueCat

Getting Started

The first step is defining what in-app products you are going to be offering to your users. In our case, we are going to create an app that charges a subscription to display random cat GIFs. Look out Y-Combinator, here we come.

The subscriptions model looks something like this:

  • $0.99/month - Unlimited cat GIFs
  • $2.99/year + trial - Unlimited cat GIFs with a 1 week trial period
  • $5.99 - Unlimited access as a one-time purchase

Configuring Google Play Billing

Google Play Billing is Google’s in-app purchase system. Have a look at their overview to get the basic concepts that we will be talking about in this guide.

In order to configure Google Play Billing you need access to your app’s Google Play Console.

Our guide won’t be using the Billing Client directly (we’ll be using RevenueCat’s Purchases), but the configuration following steps will be the same if you use RevenueCat or not.

First, you need to set up your payments profile in the Google Play Developer Console. You can do that in the Account details section in the Settings. Follow this guide from Google to get it set up.

Next, create an app in the Google Play Console (assuming you haven’t done so already), open that app in the Console, and access the in-app products section under the “Store presence” menu in the side bar.

Once your app is created, you need to configure your products Once your app is created, you need to configure your products

There are two tabs in this section: “Managed Products” and “Subscriptions”. “Managed Products” are one time purchases and “Subscriptions” are recurring. For our example, we have designed two subscription products (monthly and annual) and a single one-time product (unlimited lifetime access).

We are going configure the subscriptions. Press that “Create Subscription” button to start filling out the details of your first subscription product.

Creating Products

The product ID is used it uniquely identify this particular subscription product. Take into account that you can’t modify this and you can’t reuse a product ID inside the same app. Don’t worry about what you decide here since it’s not public facing. Use an ID that’s easy to identify by you, and contains details about the product. In our example we will be giving the following product ids to our two subscriptions:

Product ID Price
onemonth $0.99
annual $2.99

Give the products a title and a description. You can change this later, but this will be the title and the description your users will see when purchasing.

Make sure to mark your subscription as “Active”, just be careful, they cannot be deactivated afterwards.

They should label these “Don’t Work” and “Work” They should label these “Don’t Work” and “Work”

Now it comes to pricing. There are a lot of different ways of setting this up: you can set trials, introductory prices and grace periods. For simplicity, we are not going to use any introductory prices.

Press in “Add Price” and a modal will appear. You can set different prices depending on the country. Ignore this for now.

The rest of the pricing details for the monthly subscription will look like this:

Our annual subscription has a free trial of 7 days. Here’s the setup:

The grace period determines how long a user can continue to access content while they experience a billing issue. Set it to your preference.

Great! Now we’ve set up our subscriptions in Google Play successfully. Now we need to switch to the “Managed Products” tabe to create our one-time purchase. We will create a product with a product ID onetime.

The settings for a Managed Product are basically the same as for subscriptions (even simpler since they don’t offer trials or periods), with the difference that they can be made inactive at any time.

For more information on configuring in-app products, refer to Google’s guide for managed and subscription products.

If you’re not using RevenueCat, you can continue to integrating the Google Play Billing client. What follows is setting up RevenueCat for managing your in-app subscriptions and purchases.

Configuring RevenueCat

Creating service credentials

In order for RevenueCat’s servers to communicate with Google on your behalf we need a set of service credentials. The process for configuring these credentials is a bit complex, but improves security by only providing RevenueCat with the access we need.

Access the API access section under Developer Account in the Google Play Console and Create a new project.

If you already have a Project you can Link your account to your existing project by pressing the Link button.

And Create Service Account associated with that project.

Follow the link to the Google API Console

And Create a Service Account

Give it a name and a description and press Create

Give Owner permissions to the service account and press Continue

Give Owner permissions Select a Role and give Owner permissions

Then finally create a JSON Key and store it in a safe place. You can press Done in the Google API console and go back to the Google Play console.

Create a JSON Key Create a JSON Key

Create will actually download the JSON key Create will actually download the JSON key

Back in the Google Play console, press Done in the modal. The page will refresh and you will see a new service account. You can grant access now to that new Service Account. Select Finance in the Role dropdown and press Add user to give finance access to this service account.

Select Finance

Remember that JSON you saved a few steps back? RevenueCat needs it to be able to communicate with Google and track your data.

Let’s add it in the RevenueCat panel. If you don’t have an account at RevenueCat, create one, log in, and add an app to your account.

Name your app and jump into the “Android Configuration” section. Add the name of your Google Play Package (the package you configure in your AndroidManifest) and the contents of the JSON file you previously downloaded from Google (you can open this file with a text editor and copy the contents).

Give the App a name Give the App a name

Keep that JSON safe Keep that JSON safe

Press Add to create the app.

Creating entitlements

Entitlements are RevenueCat’s system for organizing in-app products. An “entitlement” is something a user is entitled to, usually based on a purchase. In our case we want to create an unlimited entitlement that will let users get unlimited cat GIFs.

Let’s add an entitlement Let’s add an entitlement

Offerings are the different ways of purchasing an entitlement. In our simple case, we have a monthly, an annual with trial and a one-time offering. Press Add Offering and add the offering details.

And create an offering And create an offering

After setting up the three offerings. Our entitlements will look like this:

Many products can be part of the same offering. These map between the offerings and the Play Store products we set up earlier. Let’s add our first product: the monthly product we set up recently in the Play Store with a product ID onemonth.

Press Add product in the monthly offering and create a product with the Product Identifier onemonth (this is the product ID we set up in the Play Store) and we select **Play Store as the Store.

After adding our three products our entitlements screen will look like this:

And thats it! In the next part we will show how to integrate the RevenueCat SDK and start making purchases in our app.

Want to get started with Android subscriptions? Contact us.