Android App & Monetization Setup
A step-by-step guide to creating your app listing on Google Play, adding in-app products, and testing purchases with B4X Purchase Manager. This covers the minimum needed to get a working test environment.
Prerequisites
• A Google Play Developer account ($25 one-time fee)
• A B4A project with a unique package name (e.g. com.yourcompany.yourapp)
• A signed release APK or AAB from B4A
• A B4X Purchase Manager account with an app and API key created
Create your app in Google Play Console
Click Create app on the All apps page. Fill in the required fields:
• App name— your app's display name on the Play Store
• Default language — usually English
• App or Game — select the appropriate type
• Free or Paid — select Free (you can still have in-app purchases)
• Accept the declarations and click Create app
Upload your first build to Internal Testing
You need to upload at least one signed build before you can create in-app products. Internal testing is the fastest way to do this.
• Go to Testing → Internal testing in the left sidebar
• Click Create new release
• Upload your signed AAB (or APK) from B4A
• Add release notes (can be simple, e.g. "Initial test build")
• Click Review release then Start rollout to Internal testing
Why Internal Testing?
Internal testing lets you install and test your app (including real purchases) without going through full review. Testers are added by email and can install via a link — no need to publish to the Play Store.
Add internal testers
Still in Testing → Internal testing, go to the Testers tab:
• Create an email list (e.g. "Internal Testers")
• Add the Gmail addresses of your testers (including yourself)
• Save changes
Each tester will receive an opt-in link. They must accept the invitation before they can install the app from the Play Store.
Internal testing track testers automatically get a test card payment option when making in-app purchases — no real money is charged and transactions auto-refund.
Important
Testers must use the same Google account on their device as the email you added to the internal testing list. If someone isn't on the internal testing track, they won't see the test card and could be charged real money.
Create in-app products
Now you can add the products your app will sell. Go to Monetize in the left sidebar:
For subscriptions:
• Go to Monetize → Subscriptions
• Click Create subscription
• Enter a Product ID (e.g. premium_monthly) — this must match your b4xlib code exactly
• Set a name, description, and at least one base plan with pricing
• Activate the subscription
For one-time products (in-app purchases / consumables):
• Go to Monetize → In-app products
• Click Create product
• Enter a Product ID (e.g. lifetime_unlock)
• Set a name, description, and price
• Set the product status to Active
Product ID tip
The Product ID is permanent and cannot be changed or reused after deletion. Use a clear naming convention like premium_monthly or coins_100. This ID must match exactly what you use in your b4xlib code.
Get your Billing Key
The billing key (also called the Base64-encoded RSA public key) is needed for your b4xlib initialization on Android.
• Go to Monetize → Monetization setup
• Under Licensing, copy the Base64-encoded RSA public key
This is the BILLING_KEY parameter in your b4xlib initialization:
PurchaseManager.Initialize(Root, BILLING_KEY, APP_ID, API_KEY)BILLING_KEY = your Base64 RSA public key from Play Console
APP_ID = your App ID from B4X Purchase Manager dashboard
API_KEY = your API key from B4X Purchase Manager dashboard
Test your purchase flow
Once everything is set up:
1. Install the app on your test device via the internal testing opt-in link
2. Make sure you're signed in with a license tester Google account
3. Trigger a purchase in your app — you'll see a "Test card" payment option
4. Complete the purchase — B4X Purchase Manager will validate it with Google's API
Test subscriptions
Test subscriptions renew much faster than real ones. A weekly subscription renews every 5 minutes, a monthly every 5 minutes, and a yearly every 30 minutes. They auto-cancel after a few renewals.
Common Issues
"This version of the app is not configured for billing"
You need to upload at least one signed build that includes the billing permission before in-app products will work. Make sure your uploaded build has the billing library included.
"Item not found" or product not showing
The product ID in your code doesn't match the one in Play Console, or the product isn't set to Active. It can also take a few hours for new products to propagate after creation.
Purchase works but validation fails
Make sure you've completed the Google Play Setup Guide to grant our service account access to your app's financial data.
Being charged real money during testing
Your Google account isn't on the internal testing track. Make sure you've accepted the opt-in link and are signed in with the same Google account on your device.