Google Play
Setup Instructions
Google Play Store integration requires data from your application in Google Play Console. Also, a project on Google Cloud is necessary for authenticating and accessing your Google Play app backend, in order to send receipt validation requests. If you are offering subscriptions, enabling Real-time developer notifications, delivering updates about subscription states and expirations to the Receipt Validation backend in realtime, is required as well.
Note that the initial setup and configuration of your project in Google Cloud could take up to 24 hours for it to successfully establish a connection to the Google Play API. In the meantime receipt validation requests will still fail.
Note that Google Real-time developer notifications using the Pub/Sub service are not completely free, however there is a free contingent of 10 TiB per month, which should be sufficient to process millions of messages every month. It is unlikely that your app receives that many messages, except if you have hundreds of thousands in-app purchases as well.
In the following screenshot, you can see the required fields we are going to fill out. Open your App Setup to get started.
Bundle ID
The Bundle ID is displayed when editing your application in Google Play Console.
- Navigate to
All apps > Your App > Dashboard
- Copy-paste the identifier below your app name into the Receipt Validator Dashboard
Account ID
For the Receipt Validator service to work, a service account needs to be created that can access your account with financial permissions for receipt validation.
- Navigate to Google Cloud
- Make sure you are signed in with your Google Play Developer Account
- Create a new Google Play Console Developer project
- Go back and select the newly created project
- Navigate to
IAM & Admin > Service Accounts
- Click on
CREATE SERVICE ACCOUNT
- Enter the required fields and click on
CREATE AND CONTINUE
- Skip assigning any permission to the service account and click
DONE
- On your newly created service account, navigate to
Actions > Manage Keys
- Add a new key for this service account
- Keep
JSON
selected and clickCREATE
- By pressing the button, a *.json key file will be downloaded in your browser
- Open the downloaded *.json key file
- Copy-paste the value for
client_email
into the Receipt Validator Dashboard'sAccount Name
field, without quotation marks
- Go back and navigate to
APIs & Services
- Click on
ENABLE APIS AND SERVICES
- Search for and enable the Google Play Android Developer API
You have finished all necessary steps in the Google Cloud Console for this step. However, your service account can still not access your Google Play financial data due to missing permissions. Let's assign the Google Play permissions next.
- Navigate to
Google Play Console > Users and permissions
- Click on
Invite new users
- Enter the email of your newly created Service Account
- Under
App permissions
, select the desired application - Add the following three permissions. All other permissions can stay disabled
- Click on
Apply
andInvite user
- Confirm by clicking
Send invitation
License Key
In the last step, we have created and downloaded a new key for the service account in Google Cloud. Note that the key can only be downloaded once, so make sure to save it on a secure location.
- Open the downloaded *.json key file
- Copy-paste the value for
private_key
into the Receipt Validator Dashboard'sSecret Key
field, without quotation marks
To repeat, the full key should go into that field, including the -----BEGIN...
-----END...
parts and all line breaks inbetween.
Server Notifications
Required when offering subscriptions. The Server URL is the same for Production and Sandbox.
- Enable Google Pub/Sub for your Google Cloud project by searching in the navigation menu or using this link
- Open the
Pub/Sub
submenu or use this link - Create a new topic with a default subscription
- Open the
Subscriptions
category - Edit the subscription
- Make sure the
Delivery type
is set toPush
andExpiry period
isNever expire
- In the
Endpoint URL
input field, enter the following URL and save by clicking onUpdate
https://flobuk.com/validator/v1/webhook/{YourAppID}/google
Replace {YourAppID}
with the app ID value found on your Receipt Validator app page.
- Go back to the Subscriptions list
- Click on
Actions > View permissions
, a panel to the right is displayed - Click on
ADD PRINCIPAL
- As principal, add the
Account ID
value from a previous step of this guide - For the role, select
Pub/Sub Editor
- Click on
SAVE
- Go back to the Topics list
- Copy the
Topic name
value for your working topic
Finally, we have to tell your app in Google Play that it should use the recent topic.
- Navigate to
Google Play Console > All apps > Your App > Monetisation setup
- In the input field for
Topic name
, paste the value you've copied in the last step - Click on
Save changes
Done!