Play Store - configuring Server to Server notifications
This page describes how to configure manually Server to Server notifications (known as Pub/Sub) with Google Cloud Console and Google Play Console
Connecting the Purchasely Cloud Platform with Google Play
Use this procedure in these cases:
- Connect to Google in the Purchasely Console shows an error or does not show.
- You do not want to give the "Pub/Sub Admin" role to the Purchasely service account.
With this procedure, the Purchasely service account needs no Google Cloud role. You do the steps yourself in Google Cloud and in Google Play Console. Your Google Cloud user must have the right to create topics and to change their permissions. For example, the "Owner" or "Pub/Sub Admin" role on the project gives these rights.
Getting the endpoint URL from the Purchasely Console
- Connect to the Purchasely Console
- Open the settings of the application you want to connect
- In the Google Play section, copy the value of the field
Server to server endpoint
Purchasely > Mobile Applications > [YOUR APPLICATION] > Application settings

Creating a new Pub/Sub topic
- Connect to the Google Cloud console and select the project of your service account
- Click
+ Create topic
Google Cloud > Pub/Sub > Topics >+ Create topic - Set the Topic ID, for example
Play-Store-Notifications - Clear
Add a default subscription - Keep the encryption set to
Google-managed encryption key - Click
Create
Several applicationsIf you have several applications in the same Google Cloud project, create one topic and one subscription for each application. Give each topic and each subscription a different ID, for example with the application name. Use your IDs in the next steps.
Creating a subscription on the topic
- Open your topic
- Click
+ Create subscription - Set the Subscription ID, for example
Purchasely - Set
Delivery typetoPush - In
Endpoint URL, paste theServer to server endpointthat you copied from the Purchasely Console - Set
Expiration periodtoNever expire - Set
Acknowledgement deadlineto60seconds - Set
Message retention durationto7days - Click
Create
Several endpointsTo also send the notifications to another endpoint, create another subscription on the same topic.
Allowing Google Play to publish to the topic
Google Play sends the notifications to the topic with its own service account. Give this account the right to publish to the topic.
- In the topic list, select the checkbox of your topic
Google Cloud > Pub/Sub > Topics - In the info panel, open
Permissionsand clickAdd principal. If you do not see the info panel, clickShow info panel. - In
New principals, paste[email protected] - Set the role to
Pub/Sub Publisher - Click
Save
Domain restricted sharingGoogle Cloud can show this error:
"One or more users named in the policy do not belong to a permitted customer"
Then your organization uses the Domain restricted sharing policy (
iam.allowedPolicyMemberDomains). Ask your Google Cloud administrator to add an exception for[email protected].
Google Play Console configuration
- Connect to the Google Play Console and open this section
Google Play Console > [YOUR APPLICATION] > Monetize > Monetization setup - In
Real-time developer notifications, selectEnable real-time notifications - In
Topic name, type the full name of your topic:projects/[YOUR PROJECT ID]/topics/[YOUR TOPIC ID] - Click
Send Test Message - Select
Get all notifications for subscriptions and one-time products. With the other choice, Purchasely gets no notification for one-time product purchases. - Click
Save changes - Make sure that the test message is in the subscription metrics
Google Cloud > Pub/Sub > Subscriptions > [YOUR SUBSCRIPTION ID] > Metrics
Updated 11 days ago

