Today we will learn how to get purchase notifications from a Google Play app.

Step 1 — Google Cloud Console
Go to console.cloud.google.com and make sure you are in the same project as your Play Store app.
If you don’t have a project yet, create one and note down the Project ID (you will need it later).
In the Google Cloud search bar, find and enable these two APIs:
First you create the topic:
Name: compras-play
Leaving everything default.
Now once created
We added permissions:

Main: [email protected]
Role: Pub/Sub Publisher
STEPS:
Enter into the topic compras-play
Permission Tab (or “Add Primary” button in the sidebar)
Add primary Pega: [email protected]
Role: search for Pub/Sub Editor
Save
And now we create subscription:
Inside the topic → Create subscription
Indicates a name.
Type: Delivery (PUSH)
URL: https://tudominio.com/webhook/google-play
You can enable authentication if needed.
And we click save leaving everything as it is.
Step 4 — register it in Play Console:

We select
Notification content:
Includes cancelled subscriptions and unique productsCancelled subscriptions, purchases, and all unique products
And now we can click on the send test message button.
