# Google Service Account Key

To enable server-side purchase verification, the [Google Service Account Key](https://cloud.google.com/iam/docs/keys-create-delete) is essential. Without it, Appflow\.ai cannot validate and process transactions. To obtain and upload the service account key to Appflow\.ai, follow the guide below.&#x20;

*Procedures:*

[*1. Create a new Appflow.ai project in the Google Cloud Console*](#1.-create-a-new-appflow.ai-project-in-the-google-cloud-console)

[*2. Create a Service Account in the Google Cloud Console*](#2.-create-a-service-account-in-the-google-cloud-console)

[*3. Enable APIs in the Google Cloud Console*](#3.-enable-apis-in-the-google-cloud-console)

[*4. Adding the Service Account as a user in the Google Play Console*](#4.-adding-the-service-account-as-a-user-in-the-google-play-console)

[*5. Upload Google Service Account Keys to Appflow.ai Dashboard*](#5.-upload-google-service-account-keys-to-appflow.ai-dashboard)

### 1. Create a new Appflow\.ai project in the Google Cloud Console

1.1  [Head to the Google Play Console](https://play.google.com/apps/publish/) and log in.&#x20;

1.2 First, click on "**Setup**" located on the left-hand side and then select "**API Access**". Once you have clicked on "**API Access**", you will be directed to the following page. From there, simply click on "**Learn more about Publishing API setup**" to navigate to a new page.

<figure><img src="/files/zb4NK73IOjCNWY8twLeZ" alt="This is the instruction screen that directs users to Google Play Console>Setup>API access"><figcaption><p>google-play-console-setup-api-access</p></figcaption></figure>

1.3 On the new pag&#x65;*(Google Play Developer API Guides)*, simply click on "**Google Cloud** **Console**" to initiate the creation of a new Google Cloud project. *(Please note that if you already have a Google Cloud Project that you wish to use, you can skip this step.)*

<figure><img src="/files/5uTqs33sz1hZ0EpVRx6B" alt="This is the screenshot of the Google Play Developer API interface"><figcaption><p>google-play-developer-api</p></figcaption></figure>

1.4 On the New Project screen, enter the Project Name. For example, you may use "**my-app-name-appflowai-access**". Let the location remain as it is and proceed to click "**Create**". Then a new project is created.

<figure><img src="/files/sWxZCW47Pfkfmdf3YZah" alt="Screenshot for creating a new Google Cloud project"><figcaption><p>google-console-create-new-project</p></figcaption></figure>

### 2. Create a Service Account in the Google Cloud Console

2.1 After the new project has been successfully created, you will be redirected to the page below. Please select "**Create Service Account**".

<figure><img src="/files/kVvcOstYetaNuW52qdCH" alt="Instruction screenshot for creating a new service account"><figcaption><p>google-cloud-create-service-account</p></figcaption></figure>

2.2 In the popup window, fill out the following information:

* Service Account Name
* Service Account ID
* Service Account Description

<figure><img src="/files/WWt8zqRTr7ZA59y9vzW3" alt="Instruction screenshot for filling out store account information"><figcaption><p>google-cloud-service-account-setting</p></figcaption></figure>

Make sure to **copy the email address** located below the Service Account ID for later use. Once you have filled out the necessary information, click on "**CREATE AND CONTINUE**" to proceed.

You will be directed to the "**Grant this service account access to project**" section:

<figure><img src="/files/St0CPNCYGKxtVFA3IeC5" alt="Instruction for granting the proper access for Google service account"><figcaption><p>google-cloud-service-account-select-role</p></figcaption></figure>

Click on "**Select a role**" and choose "**Project>Owner**".

<figure><img src="/files/HktyerXMTf6aLW5ppUPU" alt="Instruction for grant owner access for Google service account key"><figcaption><p>google-cloud-grant-service-account-access</p></figcaption></figure>

After selecting the appropriate role, click on "**Continue**".

<figure><img src="/files/82tnEXXyxVBUrtIMlTgy" alt="Instruction for finalizing the creation of the Google service account key"><figcaption><p>goole-cloud-service-accout-finalize-the setting</p></figcaption></figure>

Next, you will reach the "**Grant users access to this service account**" section. Leave this section blank *(no need to enter any information)* and click on the "**DONE**" button below to finalize the process.&#x20;

2.3 Upon completion, you will be presented with the page below, displaying the newly created service account. Click on **the account (hyperlinked)** to proceed.

<figure><img src="/files/k0DHla90CPERWcSVLG9A" alt="Screenshot that shows a new service account is created"><figcaption><p>newly-created-service-account</p></figcaption></figure>

2.4 Go to the "**KEYS**" panel and click on "**Add Key**". Then, select the option "**Create New Key**".

<figure><img src="/files/NgB0rXTDhM6GPdpz98EJ" alt="Instruction on how to reach the Google key downloading page"><figcaption><p>google-cloud-create-new-key</p></figcaption></figure>

2.5 Within the pop-up window, select "**JSON**" and proceed by clicking on "**CREATE**". This action will initiate the downloading of the JSON file to your computer. This downloaded file is the one to be [uploaded to Appflow.ai](#5.-upload-google-service-account-keys-to-appflow.ai-dashboard).

<figure><img src="/files/ZqtLXAsRViehQXBmaOZK" alt="Instruction on creating a service account Json key"><figcaption><p>google-cloud-create-json</p></figcaption></figure>

### 3. Enable APIs in the Google Cloud Console

3.1 Go to the [Google Play Android Developer API](https://console.cloud.google.com/apis/library/androidpublisher.googleapis.com) page and click "**Enable**".

<figure><img src="/files/jHpzQ8VOejfKAiPtHur3" alt="This is the page of Google Android developer API"><figcaption><p>enable-google-pay-android-developer-api</p></figcaption></figure>

When the Google Play Android Developer API is successfully enabled, it will appear as follows:

<figure><img src="/files/q4XAstHhK0kExMx6e2lO" alt="This is the page of Google Android developer API that shows &#x22;Enabled“"><figcaption><p>google-pay-android-developer-api-enabled</p></figcaption></figure>

3.2 Go to the [Google Play Developer Reporting API ](https://console.cloud.google.com/apis/library/playdeveloperreporting.googleapis.com)page and click “**Enable**”.

<figure><img src="/files/1LwZm8K2Q8um0Sqsbrbw" alt="This is the page of Google Play Developer Reporting API"><figcaption><p>enable-google-play-developer-reporting-api</p></figcaption></figure>

When the Google Play Developer Reporting API is successfully enabled, it will appear as follows:

<figure><img src="/files/jqeZPngITcwXnlEgLHvn" alt="This is the page of Google Play Developer Reporting API that shows &#x22;Enabled“"><figcaption><p>google-play-developer-reporting-api-enabled</p></figcaption></figure>

3.3 Go to the [Cloud Pub/Sub API page](https://console.cloud.google.com/apis/library/pubsub.googleapis.com) and click “**Enable**”.

<figure><img src="/files/JgeZ3i0xgw0bt0FOg4NI" alt="This is the page of Google Pub/Sub API"><figcaption><p>enable-cloud-pub-sub-api</p></figcaption></figure>

When the Cloud Pub/Sub API is successfully enabled, it will appear as follows:

<figure><img src="/files/mwTRFm10BOEebA40kRId" alt="This is the page of Google Pub/Sub API that shows &#x22;Enabled“"><figcaption><p>cloud-pub-sub-api-enabled</p></figcaption></figure>

### 4. Adding the Service Account as a user in the Google Play Console

4.1 Go to [Users and permissions](https://play.google.com/console/u/0/developers/users-and-permissions) in the Google Play Console and click on “**Invite new users**”

<figure><img src="/files/jzamkboUhAChCqmHMOJz" alt="This is the instruction screenshot on how to reach the User and permissions in the Google Play Console"><figcaption><p>google-play-console-users-and-permissions</p></figcaption></figure>

4.2 On the page that opens, paste the copied email addres&#x73;*(the one you just created in* [*step 2*](#2.-create-a-service-account-in-the-google-cloud-console) *of this guide)* into the "**Email address**" Section and leave "**Access expiry**" unchecked.

<figure><img src="/files/4Sru5XnLpOgnh9EzpqrK" alt="This is a guide on how to invite google service account as a user in the google search console"><figcaption><p>google-play-console-invite-users</p></figcaption></figure>

4.3 On the App permissions, add the app you want the user to have access to.

<figure><img src="/files/ck2E7gzoZF38y9MVGYP0" alt="This is the guide screenshot on how to grant service accounts access to specific apps"><figcaption><p>grant-app-permission</p></figcaption></figure>

4.4 Then choose "**Account permissions**", check "**Admin (all permissions)**" then "**Invite user**".

<figure><img src="/files/WbZ9uYLMS2sQESiAtnLF" alt="This is a guide on how to grant account permission for service account"><figcaption><p>grant-account-permission</p></figcaption></figure>

3.5 Click "**Send invite**" on the confirmation pop-up.

<figure><img src="/files/AusxRGn09FkdgAQ3VvnB" alt="The screenshot of sending invites to the service accounts"><figcaption><p>google-play-console-send-invite</p></figcaption></figure>

Then in the "**Users and permissions**" section, the service account email address should be there with an active status and "**Never expires**" underneath.

<figure><img src="/files/ZxFSXiubybgnCoINFEBd" alt="The status of the invited service account shows “Never expires“"><figcaption><p>user-account-status-never-expires</p></figcaption></figure>

### 5. Upload Google service account keys to Appflow\.ai Dashboard

5.1 Go to[ **Appflow.ai>Settings**](https://dash.appflow.ai/#/settings?project=6242d1eb31b4fca69faa829d), then on the right panel, find **Applications**, and click on “**Manage**” beneath it. You will then be directed to the app listing page.&#x20;

<figure><img src="/files/sXofaWLY5Rc9opkTq5yy" alt="The guide on how to reach applications listing page in Appflow.ai"><figcaption><p>appflow.ai-settings-applications</p></figcaption></figure>

5.2 Find the app you wan&#x74;*(you need to add an app if you haven’t done it)*, and click “**Edit**” to access the application editing page.

<figure><img src="/files/SqTCaKRM1U3XW7q7q1BH" alt="This is the instruction screenshot on how to edit an app in Appflow.ai"><figcaption><p>appflow.ai-edit-app</p></figcaption></figure>

5.3 On the application editing page, Find the “**Google Play Keys**“ section. Click "**Upload service** **account key file**", and upload the keys that you downloaded earlier.

<figure><img src="/files/E53M0qj2Y9RQOqwwR7H3" alt="The guide on how to upload Google service account key file to Appflow.ai"><figcaption><p>appflow.ai-upload-service-accout-key-file</p></figcaption></figure>

If you have completed the process correctly, the **RTDN topic** should be generated automatically below. **Copy it**, and set up the [Real-time Developer Notifications](/docs/sdk-set-up-instructions/android-sdk/google-play-store-credentials/google-real-time-developer-notifications-rtdn.md).

<figure><img src="/files/qWbe1K9QvXnxgcbovM07" alt="The RTDN topic is generated automatically after uploading the Google play key"><figcaption><p>appflow.ai-rtdn-topic-name</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.appflow.ai/docs/sdk-set-up-instructions/android-sdk/google-play-store-credentials/google-service-account-key.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
