Implementation Scope
Once your product IDs and business model are set, connect BillingClient to the Android app, handle each purchase state, verify entitlements with a trusted backend, and test subscription changes and recovery.
Before you start
Check the Billing Library Release Before You Upgrade
Google's Android Developers release notes list Google Play Billing Library 9.1.0, released June 18, 2026. Before pinning a version, compare the current integration guidance and migration notes with the app's dependency graph; the newest acceptable version or migration deadline can change.
Version evidence
For an upgrade, compare the current and target APIs, check supported Android versions and dependencies, run purchase and subscription lifecycle tests, and keep a rollback path.
Read the current Billing Library release notes before pinning a version in the app.
Project Setup
This walkthrough assumes the product IDs and subscription base plans already exist. Add the checked Billing Library version to the Android app module:
implementation("com.android.billingclient:billing:9.1.0")
Create one app-scoped BillingClient and keep billing calls behind a repository or equivalent boundary. Connect with a PurchasesUpdatedListener and enable pending-purchase support for the product types the app sells. The current setup uses PendingPurchasesParams to enable one-time products; add prepaid plans only when the app offers them. Configure service reconnection and expose explicit loading, success, pending, and error states to the UI.
Keep the client thin
Product Handling
Use the selected product type to choose purchase-processing and entitlement rules; do not infer business-model fit from the API type alone.
One-Time Products
- Consumable — A repeatable product such as credits. Grant the verified quantity once, then consume the purchase so it can be bought again.
- Non-consumable — A durable unlock. Record ownership against the correct app user and make restoration/reconciliation explicit.
Subscriptions
- Map the subscription product, base plan, and selected offer to an entitlement rule.
- Keep renewal, prepaid expiry, grace period, account hold, pause, cancellation, and revocation as distinct lifecycle states.
- Do not grant access from a product ID alone; base the decision on the verified purchase state and the app's documented entitlement policy.
Implementing One-Time Purchases
1. Query current product details
Use queryProductDetailsAsync() for the selected product IDs. Render the returned localized price and offer details; do not hard-code a price or treat a cached catalog as the current Play response.
2. Start the purchase flow
Pass the chosen ProductDetails and, for subscriptions, the selected offer token to launchBillingFlow(). Handle its immediate response code separately from the later purchase update.
3. Process client purchase states
In PurchasesUpdatedListener, inspect the BillingResult response code first. For a successful response, process each returned Purchase and check its purchaseState: PENDING is not entitled, and only PURCHASED proceeds to verification and fulfillment. Cancellation and billing-service failures are reported through BillingResult, not as purchase states; show a recoverable result and do not grant access.
4. Verify, fulfill, then acknowledge or consume
Associate the purchase token with the signed-in app user, verify it with your trusted backend when in scope, and persist the entitlement idempotently. Acknowledge a verified non-consumable with acknowledgePurchase(); for a consumable, use consumeAsync() after recording the grant.
Use the applicable deadline
5. Reconcile existing purchases
On app start or resume, query purchases and reconcile them with the account's entitlement record. This covers reinstall, device change, a lost callback, and a purchase completed while the app was disconnected.
Implementing Subscriptions
Map subscription states to access
A subscription product can contain base plans and offers. Map the verified purchase and current expiry to the app user's entitlement; a cancellation stops renewal but does not necessarily end access immediately.
- Active or renewed — Grant access only after the current subscription state has been verified.
- Grace period — Apply the documented recovery rule and continue checking for payment recovery.
- Account hold — Treat it separately from a scheduled pause; use the current verified state to determine access.
- Expired, refunded, or revoked — Remove or adjust access according to the verified state and the app's recorded policy.
- Plan change — Test the selected replacement behavior and effective time rather than assuming all upgrades or downgrades take effect alike.
Acknowledge the right subscription purchase
For auto-renewing subscriptions, acknowledge the initial purchase; renewals do not need acknowledgment. Prepaid subscriptions require acknowledgment for the initial purchase and every top-up. Acknowledge prepaid plans lasting a week or more within three days; for a shorter plan, the deadline is half its duration. Google may refund a purchase and revoke entitlement if its applicable acknowledgment deadline is missed. Check the current subscription acknowledgment rules before implementation.
Use notifications as a refresh signal
Real-time Developer Notifications (RTDN) can report subscription lifecycle events. Treat an RTDN message as a reason to fetch the current purchase state, not as a complete entitlement record. Design for delayed, duplicated, or missed notifications and reconcile against the current API response.
Server-Side Verification
For entitlements that must survive reinstall, account changes, or a modified client, do not rely on client state alone. Send the purchase token to a trusted backend and verify it with the current Google Play Developer API method for that product type:
- Bind the token to the app user and retain enough context to investigate a mismatch.
- For one-time products, Google documents both
purchases.productsv2.and the legacygetproductpurchasev2 purchases.products.get; for subscriptions, retrieve current state withpurchases.subscriptionsv2..get - Validate the package and product context, then map fields from the selected endpoint's response schema to the entitlement. Subscription expiry belongs to the subscription response; do not infer it from a one-time product response.
- Persist the decision idempotently and reconcile it when the client or RTDN reports a later event.
Security boundary
Developer Test Matrix
Use license testers and the current test-environment documentation. For every case, record the app build, test account, starting purchase state, observed client result, backend response, and final access. Test only the layers that are actually available.
Minimum implementation cases
- Product query success, missing product, stale details, and billing-service disconnection.
- Successful purchase, cancellation, pending-to-purchased, and pending-to-cancelled transitions; pending must not unlock the feature.
- Duplicate callback or retry; fulfillment must not grant the same purchase twice.
- App restart or reinstall after purchase, including restoration on another device for the same app user.
- Subscription renewal, plan replacement, cancellation before expiry, grace period, account hold, expiry, refund, and revocation.
- Server verification failure, delayed or duplicate RTDN, network retry, and reconciliation after the client misses an update.
Test evidence
Practical record
Trace each billing event to the state it actually proves
A client callback, a product-purchase API response, a subscription response, and an RTDN message prove different things. Record which source produced each observation, the access decision, and any layer not tested. Read subscription expiry from the subscription response; do not assume a one-time product response contains it.
Use this sequence
- 1Write down the starting product, plan, entitlement, account, build, and test environment before triggering an event.
- 2Capture the event and the expected state separately from the observed client, server, and notification signals.
- 3Grant, keep, or remove access only according to the source of truth defined for the scope.
- 4Record delays, retries, duplicate events, and idempotency behavior instead of collapsing them into passed or failed.
- 5Mark RTDN, backend, refund, or offline behavior as not tested when those systems are outside the engagement.
Decision rules and common mistakes
- Do not grant a new entitlement for a pending purchase. Record completion or cancellation and verify the resulting purchase state.
- An RTDN event is a signal to fetch the current API state, not a complete entitlement record. Keep notification time and verification time separate.
- Cancellation of renewal and expiry are different events; refund and revoke are also not interchangeable. Define the tested action before deciding access.
- A scenario passed on an earlier build does not become a final-build pass. Mark unexecuted, blocked, and failed rows explicitly.
Copyable record
Markdown includes the scope notes. TSV contains the table for a spreadsheet. The text remains selectable without clipboard access or JavaScript.
Illustrative example — not a client record
The sample values explain how to fill the record. They are not reported project results or a platform decision.
Scroll the table horizontally to read all columns.
| Scenario | Entitlement decision | Evidence and boundary |
|---|---|---|
| One-time purchase is PENDING | Keep the feature locked until the purchase is completed and verified. | A client callback reports state; it does not by itself prove a durable entitlement. |
| One-time purchase is verified | Grant the mapped benefit once, then acknowledge or consume as appropriate. | Use the current product-purchase API response for the token and product; do not infer subscription expiry from it. |
| Subscription renewal or cancellation | Keep access aligned to the verified subscription state and expiry. | Read subscription lifecycle and expiry from purchases.subscriptionsv2.get for the tested token and request time. |
| RTDN or retry arrives | Fetch current purchase state and apply changes idempotently. | Notification delivery is a refresh signal, not the source of entitlement truth. |
| App restarts after a lost callback | Re-query and reconcile before asking the user to purchase again. | Record client, backend, and final-access observations separately. |
Scope and primary requirements
Accelerated license tests do not establish production timing or revenue. Record the API operation and response fields that apply to the product type, plus the app access decision. Subscription expiry is not a one-time product response field. A client-only check cannot certify backend, RTDN, offline-cache, or other lifecycle behavior.
- Android Developers: Billing Library release notes
- Android Developers: integrate and process purchases
- Android Developers: subscription lifecycle and entitlement
- Android Developers: billing test conditions
- Google Play Developer API: one-time product purchase v2
- Google Play Developer API: legacy one-time product purchase
- Google Play Developer API reference
Compare the checklist with the documented checks and limits in the subscription integration and testing case.
Release Checklist
- The app uses the selected, currently supported Billing Library version and records the tested build.
- Product IDs and subscription offer tokens are queried from current product details rather than hard-coded.
- Pending, cancelled, failed, and unspecified states do not grant access.
- Verified fulfillment is idempotent, and acknowledgement or consumption follows the deadline and rules for the purchase type.
- Subscription cancellation, expiry, grace, hold, refund, and revocation have separate tested access outcomes.
- RTDN triggers a current-state lookup; retry, duplication, and reconciliation behavior are recorded.
Choosing the billing model
Need implementation support?
Evidence standard
Primary references
These first-party sources support the changeable platform requirements in this guide. Your current Play Console notice remains authoritative for account-specific steps.
- Android Developers: integrate Google Play BillingSupported BillingClient setup including pending-purchase configuration, purchase processing, acknowledgement, and backend verification.
- Android Developers: Google Play Billing release notesCurrent Billing Library release and migration notes; verify the version against the app build before adoption.
- Google Play Developer API: one-time product purchase v2The ProductPurchaseV2 response for a one-time purchase token; use its response schema when implementing this endpoint.
- Google Play Developer API: legacy one-time product purchaseThe documented legacy ProductPurchase response keyed by package name, product ID, and purchase token.
- Android Developers: subscription lifecycleSubscription lifecycle states, acknowledgement windows for auto-renewing and prepaid plans, verified expiry, grace period, account hold, cancellation, and access boundaries.
Review your next Play Console step
Tell us what the account shows, where the release is blocked, and what has already been submitted. We will scope the work around the evidence in your case.
Discuss Your Release