Configure a Google Cloud Pub/Sub topic and grant the Google Play service account Pub/Sub Publisher permission; enter the topic name in the Google Play Console under Monetization Setup > Real-time developer notifications
Subscribe to the Pub/Sub topic with a push subscription pointing to your server endpoint; Google Play will publish Base64-encoded DeveloperNotification JSON messages to the topic on purchase and subscription events
Decode the incoming Pub/Sub message data from Base64 and parse the DeveloperNotification to extract the packageName, eventTimeMillis, and either the subscriptionNotification or oneTimeProductNotification object
For subscription events, read the purchaseToken and notificationType from subscriptionNotification, then call the Google Play Developer API purchases.subscriptions.get endpoint with the packageName, subscriptionId, and purchaseToken to retrieve authoritative subscription state
Check the paymentState, expiryTimeMillis, and cancelReason fields from the subscription resource to determine whether to grant or revoke access
Acknowledge the Pub/Sub message only after successfully processing and persisting the state change; unacknowledged messages are redelivered, providing at-least-once delivery guarantees
Known gotchas
RTDN messages are notifications only — they do not contain authoritative state; always call the Play Developer API to retrieve the current subscription resource before making entitlement decisions
Pub/Sub messages must be acknowledged after processing; if your handler throws before acknowledging, the message will be redelivered and your handler must be idempotent with respect to the purchaseToken
The Google Play service account that publishes to Pub/Sub is a specific system account address listed in the Play Console; granting Pub/Sub Publisher to any other account will not enable notifications
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