Android in-app purchases look simple from inside the app: show a product, launch the purchase screen, receive a result. The hard part comes after, because a result on the device is not proof of payment, and a purchase nobody acknowledges is refunded.
Startup founders and engineering leaders selling digital content, features or subscriptions in an Android app will find how Google Play Billing purchases should be verified on a server, how access is granted exactly once and where acknowledgement fits.
How do Android in-app purchases work with Google Play Billing?
Android in-app purchases work by having the app launch Google Play's purchase flow through the Play Billing Library and send the resulting purchase token to the developer's server. The server verifies the token with Google Play, grants access, then acknowledges or consumes the purchase. Agnotic Technologies builds both the app side and that server side.
Adding paid features to an Android app?
We build the purchase flow, server verification and entitlement records.
Google's Play Billing integration guide says a purchase must be acknowledged within three days, or Google Play automatically refunds it and revokes the entitlement. Consuming a consumable purchase also meets the acknowledgement requirement and makes the product available to buy again.
Why verify purchases on a server?
Verify purchases on a server because the device is not a trusted place to decide who has paid. A modified app or a replayed token can make a purchase look real on the device when it is not.
Google's billing security guidance says to send each purchaseToken to your backend, check that it does not match any earlier token, verify it with the Google Play Developer API and grant entitlement only when the purchase state is PURCHASED. The token is globally unique and can serve as a primary key; orderId should not, because not every purchase generates one.
- The app sends the purchase token and product id to your backend, nothing more.
- The backend fetches the purchase from the Google Play Developer API and checks its state, product and account.
- Only the backend writes the entitlement record that gives access to content.
- The app reads entitlements from your backend, not from its own copy of purchase results.
How does a purchase move from the app to an entitlement?
A purchase leaves the Play purchase screen as a token, becomes an entitlement only after your backend verifies it, and is closed by an acknowledgement or a consume call.
- Step 1, the app launches the purchase flow with an obfuscated account id that ties the purchase to your user.
- Step 2, Google Play returns the purchase to the app, which posts the token to the backend.
- Step 3, the backend checks the token has not been seen before and fetches the purchase from the Play Developer API.
- Step 4, the backend records the entitlement against the token, so the same token can never grant twice.
- Step 5, the backend acknowledges a non-consumable or subscription, or consumes a consumable so it can be bought again.
- Step 6, the app refreshes entitlements and shows the content.
What should happen with pending purchases?
A pending purchase should be shown as waiting, not granted. Some payment methods complete later, after the user has left the purchase screen or closed the app.
- Store the pending purchase with its token so it can be matched when it completes.
- Tell the user the purchase is waiting for payment to finish.
- Grant only when the state becomes purchased, whether the app or a server notification reports it first.
Which product types need which closing step?
Each product type is closed differently, and calling the wrong step causes bugs users notice. The product type should be fixed in Play Console before any app code is written.
| Product type | Example | Closing step | Bought again? |
|---|---|---|---|
| Consumable | Credits or a one-off report | Consume | Yes, after it is consumed |
| Non-consumable | A permanent premium feature | Acknowledge | No |
| Subscription | Ongoing access to premium content | Acknowledge the first purchase | Renews until cancelled |
Acknowledging a consumable without consuming it leaves the user owning it, so they cannot buy it again. Consuming a permanent feature does the reverse and removes the ownership Play would otherwise report.
How do you keep entitlements in sync after the purchase?
Keep entitlements in sync by listening to Google Play's server notifications and by checking purchases when the app starts, because refunds, renewals and cancellations happen outside your app.
The Play Billing integration guide says Real-time Developer Notifications report new purchases, completed pending purchases and subscription lifecycle changes even when the user is not using the app, which keeps the backend's state in sync.
- Handle each notification by fetching the latest purchase state from the Play Developer API, not by trusting the message alone.
- Revoke access on refunds and voided purchases.
- Update subscription expiry on renewal, grace period, account hold and cancellation.
- On app start, query existing purchases and send any unprocessed ones to the backend.
What should the entitlement record hold?
The entitlement record should hold enough to answer, for any user, what they can access, why, and which purchase proved it. Support staff, refunds and audits all start from this record.
| Field | What it holds | Why it matters |
|---|---|---|
| Purchase token | The token from Google Play, unique key | Stops one purchase granting twice |
| User account | Your user id, matched to the obfuscated id | Shows whose purchase it is |
| Product id and type | The Play product and its kind | Decides the closing step and expiry |
| State | Pending, active, expired or revoked | Drives what the app shows |
| Closed at | When it was acknowledged or consumed | Proves the three-day step happened |
How are subscriptions different from one-time products?
Subscriptions differ because the entitlement changes over time without the user opening the app. The backend has to track renewals, payment problems and cancellations, and the app has to read the current state each time it starts.
- Active and cancelled: a cancelled subscription keeps access until the end of the paid period.
- Grace period and on hold: Google retries payment; access continues during grace and stops while on hold.
- Paused and expired: access stops, and the app shows how to resume or subscribe again.
- Upgrades and downgrades: a new purchase can replace an old one, so revoke the access tied to the replaced token.
How should the app behave when the backend cannot be reached?
When the backend cannot be reached, the app should keep the purchase token, tell the user the purchase is being confirmed, and retry. It should neither grant access on the device nor drop the token.
- Store unsent tokens locally and send them on the next connection or app start.
- Show a clear confirming state, not an error that invites the user to pay a second time.
- Retry with backoff, and alert the team when verifications fail for many users at once.
- Let server notifications complete the purchase too, so a user who never reopens the app is not refunded because of a network problem.
What should support staff be able to do?
Support staff should be able to answer a paying user's complaint without engineering help, which means a support view built on the entitlement records.
- Look up a user's purchases by account, email or purchase token.
- See each purchase's state, product and when it was closed.
- Re-run verification for a purchase stuck in a pending or failed state.
- Revoke access for a refunded purchase the notification handler missed, with the action logged.
What are the common mistakes with Android in-app purchases?
The common mistakes with Android in-app purchases trust the device or get the order of steps wrong, and both show up as support tickets about missing or free content.
- Granting content on the device as soon as the purchase screen closes.
- Acknowledging before the entitlement is saved, so a crash in between leaves the user charged with no access.
- Not storing purchase tokens, so one token can grant access on several accounts.
- Using orderId as the key, even though some purchases have none.
- Testing only the success path, never pending, declined or refunded purchases.
How do you test purchases before release?
Test with licence testers on a test track and cover every state the backend must handle, not only a successful payment.
- A successful purchase of each product type, followed by the grant and the closing step.
- A pending purchase that completes while the app is closed.
- A declined payment and a cancelled purchase screen.
- A refund issued from Play Console, followed by revocation.
- A reinstall and a second device on the same account, checking that entitlements restore from the backend.
A worked example: a premium reports feature
An app sells a one-time premium feature that opens detailed reports. The user buys it, the app posts the token, and the backend confirms the purchase is in the purchased state for that product and that the token is new.
The backend writes the entitlement and then acknowledges. Later the user is refunded through Google Play. The notification arrives, the backend fetches the purchase, sees it has been voided, removes the entitlement, and the reports lock on the next sync.
What do Android in-app purchases mean for your build plan?
In-app purchases add a backend component even to apps that had none, so plan the server, the product catalogue and the support process together.
- Decide product types and ids in Play Console before app code is written.
- Build the verification endpoint, the entitlement store and the notification handler as one service.
- Plan support tools that look up a user's purchases and entitlements by account or token.
- Review Google Play's payments policy for your product category before launch.
How does Agnotic build Android in-app purchases?
Agnotic builds the Play Billing integration in the app, the verification and entitlement service on your backend, the notification handler and the support views. We test each purchase state with licence testers before the first release.
Paid access that the server decides
We build Play Billing, token checks and entitlements as one flow.
Related reading on Agnotic
Payments, Android builds and engineering practice.


