Measure Engine

Google Play Real-Time Developer Notifications

Setting up RTDN via Google Cloud Pub/Sub with Appflow

Overview

Google Play uses Cloud Pub/Sub to deliver real-time notifications about subscription and one-time purchase events. Unlike Apple's direct webhook approach, Google requires you to create a Pub/Sub topic in your Google Cloud project and configure a push subscription that forwards messages to Appflow.

Appflow subscribes to your Pub/Sub topic, processes each notification in real time, and updates subscription state, revenue metrics, and churn signals accordingly.

Endpoint
https://api-v2.appflow.ai/v1/webhooks/google
Transport
Cloud Pub/Sub (Push)
Ack Deadline
60 seconds

Setup Google Cloud Pub/Sub

Create a Pub/Sub topic and push subscription in your Google Cloud project. This topic will receive notifications from Google Play, and the push subscription will forward them to Appflow.

1

Go to the Google Cloud Console and navigate to Pub/Sub → Topics

2

Create a new topic. Use a descriptive name like appflow-play-notifications

gcloud CLI
gcloud pubsub topics create appflow-play-notifications \
  --project=your-project-id
3

Create a push subscription pointing to the Appflow webhook endpoint:

gcloud CLI
gcloud pubsub subscriptions create appflow-play-sub \
  --topic=appflow-play-notifications \
  --push-endpoint=https://api-v2.appflow.ai/v1/webhooks/google \
  --ack-deadline=60 \
  --project=your-project-id
4

Grant the pubsub.publisher role to Google Play's service account so it can publish notifications to your topic:

gcloud CLI
gcloud pubsub topics add-iam-policy-binding appflow-play-notifications \
  --member="serviceAccount:google-play-developer-notifications@system.gserviceaccount.com" \
  --role="roles/pubsub.publisher" \
  --project=your-project-id
The service account google-play-developer-notifications@system.gserviceaccount.com is managed by Google. Do not modify or delete this account. It must have publisher access to your topic for notifications to be delivered.

Configure in Google Play Console

Link your Pub/Sub topic to your app in the Google Play Console so that Google Play publishes notifications to it.

1

Go to the Google Play Console and select your app

2

Navigate to Monetization setup (under Monetize in the sidebar)

3

In the Real-time developer notifications section, set the topic name:

Topic Name
projects/your-project-id/topics/appflow-play-notifications
Click "Send test notification" in the Play Console to verify the connection. You should see the test event appear in your Appflow webhook logs within seconds.

Configure in Appflow

Provide Appflow with the credentials needed to validate Pub/Sub messages and query the Google Play Developer API for subscription details. You can configure this from Settings → Webhooks in the dashboard or via the API:

cURL
curl -X PUT https://api-v2.appflow.ai/v1/apps/app_xxx/webhooks/google \
  -H "Authorization: Bearer sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "package_name": "com.example.myapp",
    "service_account_json": "{...}",
    "topic_name": "projects/my-project/topics/appflow-play-notifications"
  }'

Field Reference

FieldDescription
package_nameYour Android app's package name (e.g., com.example.myapp). Used to route notifications and validate purchases.
service_account_jsonThe full JSON contents of a Google Cloud service account key file. This service account must have access to the Google Play Developer API (androidpublisher) for your app.
topic_nameThe full Pub/Sub topic path in the format projects/{project-id}/topics/{topic-name}. Must match the topic configured in Google Play Console.
To create a service account key: go to Google Cloud Console → IAM & Admin → Service Accounts. Create a new key for your service account and download the JSON file. The service account needs the androidpublisher API scope.
Store your service account JSON securely. Never commit it to version control or share it in plain text. The key grants full access to your Google Play Developer API for this app.

Supported Notification Types

Appflow processes all Real-Time Developer Notification types from Google Play. Each notification is mapped to the appropriate subscription state transition and triggers revenue and analytics updates.

TypeCodeWhat Appflow Does
SUBSCRIPTION_RECOVERED1Restores subscription from grace period, resumes MRR tracking
SUBSCRIPTION_RENEWED2Confirms successful renewal, updates MRR and expiry date
SUBSCRIPTION_CANCELED3User cancelled subscription, tracks churn intent signal
SUBSCRIPTION_PURCHASED4New subscription created, tracks conversion and begins MRR
SUBSCRIPTION_ON_HOLD5Billing failed and account is on hold, pauses MRR
SUBSCRIPTION_IN_GRACE_PERIOD6Grace period started after billing failure, triggers win-back
SUBSCRIPTION_RESTARTED7User resubscribed after cancellation, restores MRR
SUBSCRIPTION_PRICE_CHANGE_CONFIRMED8User accepted price change, updates subscription amount
SUBSCRIPTION_DEFERRED9Renewal deferred to a future date, updates next billing date
SUBSCRIPTION_PAUSED10Subscription paused by user, pauses MRR tracking
SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED11Pause schedule updated, adjusts expected resume date
SUBSCRIPTION_REVOKED12Purchase revoked (refund), adjusts lifetime revenue
SUBSCRIPTION_EXPIRED13Subscription expired, marks churned and removes from MRR
ONE_TIME_PRODUCT_PURCHASEDOne-time purchase tracked, added to revenue totals
ONE_TIME_PRODUCT_CANCELEDVoided purchase processed, adjusts revenue figures
For subscription notifications, Appflow also calls the Google Play Developer API to fetch the full subscription resource. This provides additional details like pricing, currency, and offer information that are not included in the Pub/Sub message.

Verification

Appflow verifies every incoming Pub/Sub message to ensure it originates from Google and has not been tampered with. The verification process includes multiple layers of validation:

Validates the Pub/Sub push token against your configured topic
Verifies the message signature using Google's public certificates
Confirms the package name matches your registered app
Validates the purchase or subscription with the Google Play Developer API
Deduplicates notifications to prevent double-processing

Testing

Use Google Play test tracks to generate test notifications and verify your integration is working correctly before going to production.

Using Test Tracks

Internal testing
Fastest setup. Add test accounts in Google Play Console and distribute via internal test track. Purchases use test payment methods.
Closed testing (Alpha)
Invite testers by email. Useful for QA teams. Supports real and test payments depending on license testing settings.
Open testing (Beta)
Publicly available test track. Best for larger beta programs. Generates the same RTDN notifications as production.
Test purchases through license testing accounts do not charge real money. Add test accounts in Google Play Console → Settings → License testing. Test subscriptions renew on an accelerated timeline (e.g., weekly subscriptions renew every 5 minutes).
Check your webhook delivery logs in Settings → Webhooks to verify notifications are being received and processed. Each delivery is logged with its status, processing time, and any errors encountered.

Next Steps