Adding in-app purchases and subscriptions to your Android app on the Google Play store has a number of required steps to get up and running. Google uses its Google Play Billing System to provide In-App Purchases (IAPs) which you’ll need to get set up correctly. In this article we’ll walk through how to:
After setting your app up to support IAPs and subscriptions, if you need help with managing some of the more complex parts of the purchase process such as purchase token verification, creating paywalls, and managing the subscription lifecycle with Google’s Real-Time Developer Notifications, see how Nami can help by clicking the banner below.
If you do not have a Google Play Developer account, the first step you’ll need to do is register for an account and pay the fees. Please note that the Public developer name you enter will be visible on the Google Play Store for any app you release, so make sure you choose either your personal name or business entity that you would like to be displayed.
In order to earn money on the Google Play store, you must have a payments profile setup. To create this profile, simple navigate to Settings > Developer Account > Payment settings in the Google Play Console. Click Create payments profile to get started and follow the rest of the steps. For more details on this process, check out Google’s documentation.
Click All apps in the left navigation and then click on the Create app button. Enter the name of your app, remembering this is how it will appear to all users on the Play store, select a default language, select App or Game, and select Paid from the Free or paid section. Then check the boxes to agree to the Play Store agreements and click the Create app button at the bottom of the screen.
After completing this first screen, you should end up on your app’s Dashboard screen. If you are not there currently or previously had created your app in the Play Console, head to the All apps section and select your app from the list to get to the Dashboard screen. On the Dashboard screen you should see a list of tasks that need to be completed.
Click on each task and provide any required information. Once they are all completed you should see checkmarks next to each one.
Your app must have the Play Billing library as a dependency in your project in order to use in-app purchases. You’ll need to add this to the dependencies section of your build.gradle file. For java apps, that will look like this:
If your app is written in Kotlin there is a different version of the library you need to include:
First, you’ll need to generate a signed release for your app. There are a few steps involved in this which you can read in Google’s documentation. Once you’ve complete this, go to Release > Testing > Internal testing in the left navigation and click the Create new release button.
Upload the signed APK or Android app bundle you created following the instructions in the link to Google’s documentation above and then click Start rollout to internal testing.
It is very important in testing tracks to add and enable testers for your app. This will allow users to find and install the app while it is only available for testing on not available for general release on the Play Store.
This is a 2-step process. First, you’ll register a testing group and then add individual testers to the group. Go to Release > Testing > Internal testing on the left navigation and then select the Testers tab.
Click Create email list.
Example of the accept invitation page that each tester will receive.
There is one other very important testing permission to set. After you add users as app testers they need a separate permission to be able to test in-app purchases without incurring any charges to their account. You’ll find this under Settings > License testing in the left navigation.
Add the same email address that is linked to a Google account for each user you added above in this section and click the Save changes button.
Now that you’ve completed the setup of your app on the Play Console for in-app purchases and added the billing permissions to your app itself, the last step is to create an in-app purchase product. In this example, we’ll create a subscription. Go to Monetize > Products > Subscriptions in the left navigation.
Now click the Create subscription button on the right side of the screen. Fill in the information on the next screen including a Product ID (you’ll reference this in your app code), a Name and Description, Price, and Billing Period. Then click the Save button.
Note that once you create a Product ID it cannot be changed or reused, so choose a name carefully.
A common practice is to use a reverse url structure with your app name. You may also want to include the price point if you anticipate testing different price points for your app in the future. An example might be com.namiml.demoApp.monthlySub.299.
Finally, let’s start up your app with an integrated purchase process and try to buy a product to confirm that you are able to make purchases as a tester and not get charged. If you have set up your email address correctly as a tester, when the Google Play bottom dialog opens up to complete the purchase in your app, next to the GPay information it should say Test card, always approves.
If it does, then you will not be charged for the purchase. If you see details on another payment method at this point, try clicking on the payment method and see if the Test card, always approves option is available and select it.
If this option is not available, there are 2 things you should check:
As long as both of these are true, you should be all set.
Now you should be all set for testing and making in-app purchases in your Google Play store Android app.
Learn the difference between an iOS Unit Test and UI Test and when to use each. Discover how to move a Unit Test into a UI Test plus some helpful tips to deal how unit tests and UI Tests are run.
🍏 🤖 iOS or Android? 3 variables to consider when choosing whether to first develop your mobile app for iOS or Android platforms.