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 [https://cloud.google.com/pubsub/pricing](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 value below your app name
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 Play Console > Setup > API access
- If there is no linked Google Cloud project yet, create and link a new Google Play Console Developer project
- Click on
Create new service account
- In the popup that is displayed, click on the
Google Cloud Platform
link - In Google Cloud and within the
IAM and admin
section, click onCREATE SERVICE ACCOUNT
- Enter the required fields and click on
CREATE AND CONTINUE
- Grant
Owner
permission to the service account and clickDONE
- 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 theAccount Name
field, without quotation marks
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 > Setup > API access
- If you cannot see your newly created service account, click on
Refresh service accounts
- Click on
Grant access
- Select the following three permissions. All other permissions can be disabled
- Click on
Invite user
- Confirm by clicking
Send invitation
- Click on the service account that should now show up as
Active
- Grant permission to your app
- Click on
Apply
(and again for confirmation)
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 theSecret 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!