Set up Google Play real-time developer notifications
Deliver Google Play real-time developer notifications to Voidhash through an authenticated Pub/Sub push subscription.
Google Play sends real-time developer notifications (RTDN) when a purchase or subscription changes, for example on a renewal, cancellation, or refund. Google publishes them to a Pub/Sub topic in your Google Cloud project, and a push subscription on that topic delivers them to Voidhash. Voidhash then keeps subscriptions current even when the app is not running.
Before you start, upload your service account key to this provider and save it. The push subscription authenticates as that same service account. Creating the topic and subscription in the service account's Google Cloud project keeps the permissions simple.
Create a Pub/Sub topic
In Google Cloud Console, select your project and open
Pub/Sub → Topics. Choose Create topic, enter a topic ID such as google-play-rtdn, and
create it.
Copy the topic's full name, such as projects/example-project/topics/google-play-rtdn.
Allow Google Play to publish
Open the topic's permissions and add google-play-developer-notifications@system.gserviceaccount.com
as a principal with the Pub/Sub Publisher role. Save.
If your organization restricts sharing to its own domain, add an exception for this Google Play account first.
Enable notifications in Play Console
Open your app in Google Play Console and go to Monetize → Monetization setup. Under Real-time developer notifications, check Enable real-time notifications and paste the full topic name into Topic name.
Choose Get all notifications for subscriptions and one-time products so Voidhash also learns about one-time purchases, then click Save changes. Repeat this for each app.
Copy the topic name to Voidhash
In Voidhash, open the Google developer notifications tab of this payment provider. Paste the full topic name into Google Play RTDN topic name and save. This field is optional and kept for your reference; it does not change how notifications are delivered.
Copy your Voidhash push endpoint URL
On the same tab, copy the RTDN push endpoint URL using the copy button next to it. Each payment provider has its own URL.
Create a push subscription
In Google Cloud Console, open Pub/Sub → Subscriptions and choose Create subscription. Enter a subscription ID, select your RTDN topic, and set:
- Delivery type: Push.
- Endpoint URL: your Voidhash push endpoint URL.
- Enable authentication: checked.
- Service account: the service account whose JSON key you uploaded to Voidhash.
- Audience: leave it empty, so Pub/Sub uses the endpoint URL. If you enter a value, it must be exactly the endpoint URL.
- Enable payload unwrapping: leave it unchecked. Voidhash expects the standard Pub/Sub push message.
Create the subscription.
To create it, you need permission to act as the service account, for example the
Service Account User role on it. Pub/Sub also creates tokens for that account: its service
agent, service-PROJECT_NUMBER@gcp-sa-pubsub.iam.gserviceaccount.com for the subscription's
project, needs the Service Account Token Creator role on the service account or its project.
If the console reports that this role is missing, choose Grant.
Voidhash accepts a push only when it is authenticated as the service account in this provider's key file and addressed to this provider's endpoint URL. A push from any other account, or with a different audience, is rejected.
Send a test notification
Back in Play Console, under Real-time developer notifications, click Send Test Message. Play Console confirms whether it could publish to the topic.
To confirm that Voidhash received it, open the subscription in Google Cloud Console and select the Metrics tab. Voidhash acknowledges each notification it accepts, so the unacknowledged message count and the oldest unacknowledged message age stay near zero. A growing backlog means pushes are failing.
Troubleshooting
Pub/Sub keeps retrying a notification until Voidhash acknowledges it. When messages stay unacknowledged, check the response codes in the subscription's push request metrics.
401: the push is not authenticated the way this provider expects. Check that authentication is enabled, that it uses the service account whose key this provider has, and that the audience is empty or exactly the endpoint URL. Copy the endpoint URL from this provider again.503: Voidhash has no readable service account key for the provider in the URL. Upload the service account JSON key, save the provider, and send another test message. Also check that the URL belongs to an existing provider.500: Voidhash could not process the notification right now. Pub/Sub redelivers it, so no action is needed.
Voidhash acknowledges and ignores notifications for a package other than the provider's Google Play package name. If you share a topic between apps, give each app its own provider and push subscription.
See Google's RTDN setup guide and push authentication guide for the current Google Cloud steps.