Appearance
Android Google Play Pub/Sub Setup
how to configure Google Play Real-Time Developer Notifications (RTDN) for Android subscriptions using Google Cloud Pub/Sub
1. Google Cloud Project
Open the required project in Google Cloud Console.
Example project
text
Project name: GoBiz Demo
Project ID: gobiz-demoAll Pub/Sub resources used for this integration should be created inside the Google Cloud project configured for the Android application.
2. Create a Google Cloud Service Account
Open:
Google Cloud Console → IAM & Admin → Service Accounts
Click Create service account.
Service account configuration
| Field | Example |
|---|---|
| Service account name | play-api |
| Service account ID | play-api |
| Description | To receive Google Play subscription messages. |
| Role | Pub/Sub Admin |
The resulting service-account email will look similar to:
Click Create and continue and complete the service-account creation.
3. Create the Service Account JSON Key
After creating the service account:
- Open Google Cloud Console → IAM & Admin → Service Accounts.
- Locate the
play-apiservice account. - Open the Actions menu.
- Select Manage keys.
- Click Add key.
- Select Create new key.
- Select JSON.
- Click Create.
Google Cloud will download the JSON credentials file to your computer.
Rename the downloaded file to:
text
service-accounts.jsonThis file is required by the server-side application to authenticate with Google APIs.
4. Create the Pub/Sub Topic
Open:
Google Cloud Console → Pub/Sub → Topics
Click Create topic.
Topic configuration
Set the Topic ID to:
text
play-notificationsEnable:
text
Add a default subscriptionAfter creation, the topic resource will look similar to:
text
projects/gobiz-demo/topics/play-notificationsVerify that the topic appears under:
Pub/Sub → Topics
Configure the topic in Google Play Console
Copy the complete topic name:
text
projects/gobiz-demo/topics/play-notificationsThen open:
Google Play Console → Monetize with Play → Monetization setup
Paste the complete topic name into the Topic name field.
Save the configuration.
Important: Use the complete Pub/Sub resource name, not only
play-notifications.
5. Grant Pub/Sub Publisher Permission
Google Play needs permission to publish RTDN messages to the Pub/Sub topic.
Open:
Google Cloud Console → Pub/Sub → Topics
Select:
text
play-notificationsOpen the topic's Permissions / Access configuration and select Grant access.
Principal
Add:
Role
Assign:
text
Pub/Sub PublisherSave the permission.
Verify the permission
Open the topic's permissions panel and confirm that the following entry exists:
text
Role:
Pub/Sub Publisher
Principal:
[email protected]Google Cloud may indicate that the permission change can take a few minutes to become active.
Important: Do not use the
play-apiservice account as the publisher principal. Google Play publishes RTDN messages using[email protected].
6. Configure Google Play Console Permissions
Open:
Google Play Console → Users and permissions
Click Invite new users.
Enter the Google Cloud service-account email created in Step 2.
Example
Important: Use the
play-apiservice account here.
6.1 Grant App Permission
Under App permissions:
- Select your application.
- Click Apply.
- Grant:
text
- View app information (read-only)
- View financial data
- Manage orders and subscriptionsDo not grant Admin (all permissions) unless the application integration specifically requires it.
These permissions allow the server-side integration to access the Google Play purchase and subscription information required for subscription management.
Click Apply / Invite user to save the permissions.
Verify the service-account permissions
The play-api service account should have:
text
App permission:
View app information (read-only)
Financial permissions:
View financial data
Manage orders and subscriptions7. Configure Google Play Real-Time Developer Notifications
Open the Android application in Google Play Console.
Navigate to:
Monetize with Play → Monetization setup
Find:
Google Play Billing
Locate:
Real-time developer notifications
Enable:
text
Enable real-time notifications7.1 Enter the Pub/Sub Topic
In Topic name, enter the complete Pub/Sub topic resource:
text
projects/gobiz-demo/topics/play-notificationsThe complete resource name is required.
Google Play will publish subscription and purchase notification messages to this Pub/Sub topic.
7.2 Select Notification Content
Select:
text
Subscriptions and voided purchases onlySave the Google Play Billing configuration.
Verify the RTDN configuration
Before continuing, confirm:
text
RTDN:
Enabled
Topic:
projects/gobiz-demo/topics/play-notifications
Notification content:
Subscriptions and voided purchases only8. Create the Pub/Sub Subscription
Open:
Google Cloud Console → Pub/Sub → Subscriptions
If Add a default subscription was enabled while creating the topic, a subscription may already have been created automatically.
The expected subscription name in this setup is:
text
play-notifications-subIf it does not already exist, create a subscription for the topic.
Subscription configuration
text
Subscription ID:
play-notifications-subThe resulting subscription resource will look similar to:
text
projects/gobiz-demo/subscriptions/play-notifications-subThe subscription must be attached to:
text
projects/gobiz-demo/topics/play-notificationsVerify the subscription
Confirm that:
text
Subscription:
play-notifications-sub
Topic:
play-notificationsThe subscription is responsible for receiving messages published by Google Play to the Pub/Sub topic.
9. Configure the Subscription Delivery Type
Open:
Google Cloud Console → Pub/Sub → Subscriptions → play-notifications-sub
Click Edit.
Change the delivery type to:
text
PushThe push subscription sends Pub/Sub messages directly to the application's webhook endpoint.
9.1 Get the Android Webhook URL
Open the GoBiz Admin Panel.
Navigate to:
Plugins → Mobile App API
Locate:
Webhook URL (Android)
Copy the Android webhook URL.
9.2 Configure the Push Endpoint
Return to:
Google Cloud Console → Pub/Sub → Subscriptions → play-notifications-sub → Edit
Under Push configuration, set:
text
Delivery type:
Push
Endpoint URL:
<Android Webhook URL copied from GoBiz Admin Panel>9.3 Enable Authentication
select Enable.
For Service account, select the service account created in Step 2:
For Audience (Optional), enter the same webhook endpoint URL.
Push configuration should look similar to:
text
Delivery type:
Push
Endpoint URL:
<Android Webhook URL>
Authentication:
Enabled
Service account:
[email protected]
Audience:
<Android Webhook URL>Save the subscription configuration.
9.4 Test the Google Play Notification
After saving the Pub/Sub push configuration:
- Open Google Play Console.
- Navigate to Monetize with Play → Monetization setup.
- Open the Google Play Billing configuration.
- Locate the configured Topic name.
- Click Send test notification.
Google Play will send a test RTDN message to the configured Pub/Sub topic.
The Pub/Sub subscription should then deliver the message to the configured Android webhook endpoint.
If the test notification reaches the application successfully, the Pub/Sub RTDN connection is configured correctly.
10. Server Configuration — Upload service-accounts.json
The Google Cloud service-account JSON file created in Step 3 must be uploaded to the application server.
Open the server's File Manager.
Navigate to:
text
storage
└── app
└── googleIf the google directory already exists, open it.
Upload:
text
service-accounts.jsonThe final file path must be:
text
storage/app/google/service-accounts.json