Create a Google Cloud service account, grant it 'View financial data' permission in the Play Console, and download the JSON key
In your backend, use the service account key to obtain an OAuth 2 access token with scope https://www.googleapis.com/auth/androidpublisher
When the client completes a purchase, receive the purchaseToken and productId from the Google Play Billing Library and send them to your server
GET https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/products/{productId}/tokens/{token} and inspect the purchaseState (0 = purchased) and consumptionState fields
If the product is a consumable, acknowledge the purchase by calling purchases.products.acknowledge within the required acknowledgment window to prevent refund
Known gotchas
Purchases not acknowledged within the acknowledgment window are automatically refunded by Google; always acknowledge server-side, not only on the client
Never validate on the client; the purchaseToken received by the app can be replayed or forged; server-side validation is required
The purchases.products resource is for one-time products; for subscriptions use purchases.subscriptionsv2.get which returns a SubscriptionPurchaseV2 with richer line-item data
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp