Skip to content
Providers

Google Play

Invite a billing service account in Play Console, set up real-time developer notifications through an authenticated Pub/Sub push subscription, and connect both to AppCore.

On this page

AppCore verifies Android purchases and subscriptions with Google and turns them into entitlements:

  • The app buys through Play Billing and sends the purchase token to POST /v1/commerce/purchases/verify. AppCore reads the current state from the Google Play Developer API with a service account you invite into Play Console, grants the entitlement, and only then acknowledges (or consumes) the purchase.
  • Google sends lifecycle events as real-time developer notifications (RTDN) to a Pub/Sub topic. A Pub/Sub push subscription with OIDC authentication delivers them to AppCore. AppCore checks the token on every request and then re-reads the purchase from the Play API; the notification body alone never changes state.
  • A scheduled sweep reads voided purchases (refunds, chargebacks); no setup is needed.

Google is the merchant of record for Play sales. See Stores as merchant of record. Pub/Sub is a Google transport required by RTDN; it is the one non-Cloudflare piece of this integration. Console paths are as of 2026-11.

Note

Verification, acknowledgement, RTDN, refunds and reconciliation are implemented and tested in the Workers runtime against fake Play Developer and Pub/Sub APIs. They have not yet run against a real Play account (PROVIDER_TESTED is pending real credentials).

Warning

Not yet enabled:

  • Keyless (federated) credentials. credential_mode must be service_account_key.
  • Automatic product sync from Play Console. Map product IDs by hand in Store mappings.
  • Purchase prices in revenue reports. Store purchases are counted as unpriced until purchase events carry amounts.

Before you begin

  • Play Console Admin on the developer account, and the app created in Play Console with this environment's package name.
  • A Google Cloud project you will use for billing access and Pub/Sub, with Owner or Editor on it, and Service Account Key Admin to create keys.
  • Your environment's API host, https://<your-api-host>.

Steps

1. Billing access

  1. Enable the API. Google Cloud console → your project → APIs & Services → Library → Google Play Android Developer API → Enable.

  2. Create the billing service account. IAM & Admin → Service Accounts → Create service account, for example appcore-play-billing. It needs no project role for the Play API.

  3. Create its key. Open it → Keys → Add key → Create new key → JSON. The file downloads once.

  4. Invite it into Play Console. Play Console → Users and permissions → Invite new users. Enter the service account's email. On App permissions, add your app and grant:

    • View app information (read-only)
    • View financial data, orders, and cancellation survey responses
    • Manage orders and subscriptions

    Send the invitation. Service accounts do not need to accept it.

2. Real-time developer notifications

  1. Create the topic. Google Cloud console → Pub/Sub → Topics → Create topic, for example play-rtdn-<app>-staging. Its full name is projects/<project-id>/topics/<topic>.

  2. Let Play publish. On the topic → Permissions → Add principal: google-play-developer-notifications@system.gserviceaccount.com, role Pub/Sub Publisher.

  3. Create the push identity. A second service account, for example appcore-rtdn-push, used only to sign push requests. Keep it separate from the billing account. On it, grant the Pub/Sub service agent (service-<project-number>@gcp-sa-pubsub.iam.gserviceaccount.com) the role Service Account Token Creator.

  4. Create the connection in AppCore first, so you have its URL: Setup and connections → Connections → Google Play purchases, subscriptions and RTDN. Save the public fields you have, then copy the Callback URL:

    Code
    https://<your-api-host>/webhooks/google-play/<connection-id>
  5. Create the push subscription. Pub/Sub → Subscriptions → Create subscription:

    • Topic: your RTDN topic.
    • Delivery type: Push. Endpoint URL: the Callback URL.
    • Tick Enable authentication. Service account: the push identity from step 3. Audience: the same Callback URL, exactly.
    • Acknowledgement deadline: 60 seconds. Retry policy: exponential backoff. A dead-letter topic is optional.
  6. Let AppCore verify the setup. On the topic and on the subscription → Permissions → Add principal: the billing service account, role Pub/Sub Viewer. Without this the read-only check cannot confirm the push configuration and the connection cannot be activated.

  7. Turn on RTDN in Play. Play Console → your app → Monetize with Play → Monetization setup → Real-time developer notifications: paste the full topic name and save.

3. Finish the connection

  1. Fill in every field below and paste the billing service account's JSON key into service_account_key_json. Delete the local file.
  2. Run Check syntax, then Read-only check, then Activate.
  3. In Play Console, press Send test notification on the RTDN page. AppCore stores it with outcome test and grants nothing. Record the Pub/Sub message ID as evidence for play-rtdn-test.
  4. Products: Monetize with Play → Products → In-app products or Subscriptions (with base plans and offers). IDs must match what you map in Products and entitlements → Store mappings.
  5. Testers: Play Console (all apps) → Settings → License testing: add tester Google accounts, and distribute the build through an internal testing track.
  6. Buy in the app with the SDK (Getting started, step 7). IapStoreBridge sets Play's obfuscatedAccountId to the purchase intent's account binding. Record the order ID as evidence for play-sandbox-purchase, and attest play-negative after checking that a push without a valid token is rejected.

Paste into AppCore

AppCore fieldWhere to find itSecret?
package_namePlay Console → All apps → your app → package name under the titlePublic
developer_account_refThe number in the Play Console URL: play.google.com/console/u/0/developers/<this number>/…Public
cloud_project_idGoogle Cloud console → project picker → Project IDPublic
service_account_emailIAM & Admin → Service Accounts → billing account → EmailPublic
credential_modeservice_account_keyPublic
service_account_key_jsonThe billing account's JSON key file, whole contentsSecret (write-only)
rtdn_topicPub/Sub → Topics → full name projects/<project-id>/topics/<topic>Public
push_subscriptionPub/Sub → Subscriptions → subscription ID (or full projects/<project-id>/subscriptions/<id>)Public
push_service_account_emailThe push identity's email (step 2.3)Public
push_token_audienceThe Callback URL, exactly as entered as the subscription's AudiencePublic
refund_capability_enabledtrue only if operators may refund through the Play APIPublic
federation_configurationLeave empty (not used)Public
catalog_mapping_versionFilled by the platform from your published store mappingsPublic

Paste into Google Cloud: the connection's Callback URL as the push Endpoint URL and as the Audience.

Verify

The Read-only check sends nothing and changes nothing. It passes with PLAY_API_READABLE and PUBSUB_PUSH_CONFIG_OK when:

  • the billing account can read purchases/voidedpurchases for your package (this needs View financial data);
  • the subscription is attached to rtdn_topic, is a push subscription, delivers to exactly this connection's Callback URL, authenticates as push_service_account_email with audience push_token_audience;
  • the topic grants Play's publisher account Pub/Sub Publisher.

Then:

  • After Activate, google_play appears in purchase_providers of GET https://<your-api-host>/v1/config/public.
  • The Play test notification is processed with outcome test.
  • A licence-tester purchase appears in Purchases and finance → Purchases. Development and staging accept only test purchases; production rejects them, and test environments reject real ones.
  • With every sandbox check evidenced the connection becomes sandbox_ready.

Every RTDN push is checked: issuer https://accounts.google.com, audience = push_token_audience, email = push_service_account_email, email_verified true. Anything else gets 401.

Troubleshooting

SymptomLikely causeFix
PROVIDER_PERMISSION_MISSINGBilling account not invited, invited without View financial data, or API not enabledRedo step 1.4 with all three permissions; permissions can take a while to apply
PROVIDER_AUTH_REJECTEDKey deleted or account disabledCreate a new key and Rotate
PUBSUB_SUBSCRIPTION_UNREADABLEWrong subscription name, or billing account lacks Pub/Sub Viewer on itCheck the name; add the Viewer grant
PUBSUB_TOPIC_MISMATCHSubscription belongs to another topicUse the subscription on rtdn_topic
PUBSUB_NOT_PUSHDelivery type is PullEdit the subscription to Push
PUBSUB_ENDPOINT_MISMATCHEndpoint is not this connection's Callback URL (other environment or old connection)Paste the Callback URL from this connection
PUBSUB_PUSH_UNAUTHENTICATEDEnable authentication not tickedTick it and pick the push identity
PUBSUB_PUSH_IDENTITY_MISMATCH / PUBSUB_AUDIENCE_MISMATCHSubscription uses another account or audience than the connection fieldsMake both sides identical
PUBSUB_PUBLISHER_MISSINGPlay cannot publish to the topicGrant google-play-developer-notifications@system.gserviceaccount.com Pub/Sub Publisher
Warning PUBSUB_TOPIC_IAM_UNREADABLE, and Activate returns 409 EVIDENCE_REQUIREDBilling account lacks Pub/Sub Viewer on the topic, so play-topic is unverifiedAdd the Viewer grant on the topic and re-run the check
RTDN pushes get 401Token audience or identity differ, or authentication is offMatch push_token_audience and push_service_account_email; check the Token Creator grant
RTDN pushes get 404 / 503Connection ID not active for this environment / connection not active yetUse the active connection's URL; activate first
RTDN pushes get 422Notification is for another packageOne topic and subscription per app and environment
Purchase returns 404 PRODUCT_NOT_MAPPEDProduct ID not mapped in AppCoreMap it in Store mappings and publish
Purchase refunded automatically after 3 daysPurchase was never acknowledged (verification never reached AppCore)Make sure the app sends every purchase to AppCore; the SDK retries unfinished transactions