Android Setup
Configure Google Play Billing v6
Prerequisites
- Google Play Developer account ($25 one-time fee)
- Android Studio or VS Code with React Native setup
- minSdkVersion 24 or higher
- React Native 0.70+
Step 1: Create Your App in Google Play Console
- Go to Google Play Console
Visit play.google.com/console and sign in
- Create a new app
Click "Create app" and fill in the required details
- Set up your app
Complete the app content questionnaire and store listing
Step 2: Create In-App Products
Important
You must upload at least one APK/AAB to create in-app products. You can use internal testing track.
For Subscriptions:
- Navigate to Subscriptions
Go to "Monetize" → "Products" → "Subscriptions"
- Create a subscription
Click "Create subscription" and enter a Product ID
- Add base plans
Configure pricing, billing period, and grace period for each plan
- Add offers (optional)
Create free trials, introductory pricing, or upgrade/downgrade offers
For One-Time Products:
- Navigate to In-app products
Go to "Monetize" → "Products" → "In-app products"
- Create the product
Enter Product ID, name, description, and price
Product ID Naming Convention
Google recommends lowercase with underscores:
premium_monthlyUnlike iOS, Google Play product IDs cannot contain dots.
Step 3: Set Up Real-time Developer Notifications (RTDN)
Google Play sends real-time notifications about subscription events via Cloud Pub/Sub.
Create a Pub/Sub Topic
- Go to Google Cloud Console
Visit console.cloud.google.com
- Enable Pub/Sub API
Search for "Pub/Sub" and enable the API
- Create a topic
Name it something like "play-billing-notifications"
- Create a push subscription
Endpoint URL:
https://api.croissantlabs.com/api/webhooks/google
Configure in Play Console
- Go to Monetization setup
In Play Console, navigate to "Monetization setup"
- Enter your topic name
Format: projects/YOUR_PROJECT_ID/topics/YOUR_TOPIC_NAME
- Grant publisher permission
Add google-play-developer-notifications@system.gserviceaccount.com as a publisher to your topic
Step 4: Create a Service Account
A service account allows CroissantPay to verify purchases with Google Play.
- Go to Google Cloud Console
Navigate to IAM & Admin → Service Accounts
- Create a service account
Name it something like "croissantpay-billing"
- Create and download a key
Select JSON format and save the file securely
- Link to Play Console
In Play Console, go to "Users & permissions" → "Invite new users"
- Grant permissions
Add the service account email with "View financial data" and "Manage orders" permissions
Keep your service account key secure
Never commit this file to version control. Store it securely and only use it in your server configuration.
Step 5: Configure Your Android Project
Add Billing Permission
In your AndroidManifest.xml, add the billing permission:
<manifest ...>
<uses-permission android:name="com.android.vending.BILLING" />
...
</manifest>Verify Gradle Configuration
Ensure your build.gradle has the correct minSdkVersion:
android {
defaultConfig {
minSdkVersion 24 // Required for Billing Library v6
...
}
}Testing In-App Purchases
License Testing
- Add license testers
In Play Console, go to "Setup" → "License testing"
- Add test account emails
These accounts can make test purchases without being charged
- Set license response
Choose "RESPOND_NORMALLY" for realistic testing
Internal Testing Track
- Upload an AAB to internal testing
Go to "Testing" → "Internal testing" → "Create new release"
- Add testers
Create an email list and add your test accounts
- Share the opt-in link
Testers must opt-in before they can download the test version
Test Subscription Periods
Unlike iOS, Google Play uses shortened renewal periods for testing:
| Production Duration | Test Duration |
|---|---|
| 1 week | 5 minutes |
| 1 month | 5 minutes |
| 3 months | 10 minutes |
| 6 months | 15 minutes |
| 1 year | 30 minutes |
Common Issues
"Item not available for purchase"
- • Ensure your app is uploaded to at least internal testing track
- • Check that the product is active in Play Console
- • Verify the package name matches exactly
- • Wait 24-48 hours after creating products
"This version of the app is not configured for billing"
- • The signed version must be uploaded to Play Console
- • Test on a release build, not debug
- • Ensure the user is signed in with a Google account