React Native In-App Purchases (Android) — Part 3
In-app purchases configuration in Android
In Part 1, we discussed in-app purchases, their types, and their benefits. In Part 2, we delved into the process of creating products for subscriptions and in-app purchases on iOS.
In this blog, we will explore the initial setup for the Play Store Console to enable the in-app purchase and subscription dashboard, followed by how to create products for subscriptions and in-app purchases.
Initial Setup on the Play Store Console
- Open your Google Play Console and choose your application.
- Navigate to the Monetize section in the left menu. Expand Products and select In-app products or Subscriptions to access the dashboard.
To add products, you need to update the following files:
- AndroidManifest.xml
// for AndroidManifest.xml
<uses-permission android:name="com.android.vending.BILLING"/>
- app-level build.gradle
// for build.gradle in app-level
implementation 'com.android.billingclient:billing:5.0.0'
Additionally, create an AAB and upload it to close testing. It may take a few hours or a day to enable the in-app purchases section in the Google Play Console.
Subscriptions
There are two types of subscriptions: auto-renewable and non-renewable.
- Auto-renewable: Automatically renews until the user cancels.
- Non-renewable: Expires without automatically renewing.
1. Create Subscription
To create a subscription, add the product ID and name. Note that a product ID cannot be reused after deletion.
Your dashboard will look like this after you create a subscription:
2. Set up the subscription
After creating a product, configure the subscription. For setup, you need to set benefits, a base plan, and offers and activate a base plan for users.
2.1 Add subscription benefits (recommended)
You can change the Name, the same as the one you added when creating the subscription.
After that, set Tax, compliance, and programs based on your app category.
2.2 Add a base plan
In a base plan, define a billing period, price, and renewal type.
In a subscription, there are two types: Auto-renewing and Prepaid.
Auto-renewing: Users make recurring payments. Set a billing period for a week, every four weeks, a month, two months, or a year. Optionally, set a grace period for payment issues.
In a Customer base plan and offer changes, choose when to charge current subscribers if they purchase a different base plan or offer for the same subscription. They will give you two options: immediately or at the next billing date.
If allowed to Resubscribe, users can repurchase an expired auto-renewing subscription in the Play Store.
Prepaid: Users purchase access for a specified period without automatic renewal. Allow extensions if desired.
In Tags, identify the base plan or the offer in the subscription. You can add up to 20 tags.
In Price and availability, you can set prices based on your requirements and also set the country to show your product’s availability.
After completing all the steps, you can get the dashboard below with your base plan.
2.3 Add Offer
To add an offer, first create a base plan with auto-renewal.
- Set an ID and country availability.
- Define eligibility criteria for new users or current subscribers.
- Set upgrade options, including billing periods and usage limits.
- Choose a phase type (e.g., free trial, single payment, discounted recurring payment).
2.4 Activate a base plan
Activate your base plan by pressing the Activate base plan button.
After completing all the steps, you will get the dashboard below with your subscription details.
You can create up to 250 total base plans and offers for each subscription, with a maximum of 50 active simultaneously. The remainder must be in draft or inactive states.
For a better understanding of the base plan and offers, please refer to Android Subscription.
In-App Purchases
Let’s start creating in-app products by pressing the Create Product button.
1. Product ID
The product ID should be unique and consistent across platforms. Here, there’s no need for platform-specific management on the React Native side. Once assigned, the product ID cannot be recreated, even if deleted.
2. Product details
Add a name and a description that explain its benefits and features.
3. Price
In the price section, select the Set Price button, and then you can set your price. Here, you need to set the price with your local price. Once you edit, you can get different prices based on the country’s rate. You can also edit prices based on country.
If the user wants to select one product multiple times, you can select the Multi-quantity option.
4. Tax, compliance, and programs
Click on Manage Settings and fill in the required information.
After completing all the steps, you will see the dashboard below with your in-app product details.
Conclusion
This guide covers the initial setup for the Play Store console, including necessary permissions and dependencies. It also details how to set up subscriptions and individual in-app purchases.
In Part 4, we will cover implementation on the React Native side, including initializing the library, purchasing products, and retrieving purchase history.
For more updates on the latest tools and technologies, follow the Simform Engineering blog.