# Google Play

{% stepper %}
{% step %}

#### [Settings in Google Cloud Platform Console](#settings-in-google-cloud-platform-console-1)

[Enable Google Play Android Developer API](#google-play-android-developer-api)&#x20;

[Set up Service account](#service-account) &#x20;

[Set up Pub/Sub service](#pub-sub-service)&#x20;
{% endstep %}

{% step %}

#### [Settings on devtodev side](#step-2.-settings-on-devtodev-side)

{% endstep %}

{% step %}

#### [Settings in Google Play Console](#step-3.-google-paly-console)

[Add service account and grant permissions](#service-account-and-user-permissions)&#x20;

[Set up Real-time developer notifications](#monetisation-setup)&#x20;
{% endstep %}
{% endstepper %}

## Settings in Google Cloud Platform Console

{% hint style="info" %}
If you have already activated the [Google Play Android Developer API](#google-play-android-developer-api) and set up a [service account](#service-account) to work with devtodev, you can skip this section and proceed to [Pub/Sub service setup](#pub-sub-service)**.**
{% endhint %}

### Google Play Android Developer API <a href="#google-play-android-developer-api" id="google-play-android-developer-api"></a>

1. Go to [Google Cloud Console](<https://console.cloud.google.com/ >) under your Google account.\
   Select the project (1) for which you want to configure **Google Play Developer API**. Then go to the **APIs and services** section (2).

<figure><img src="/files/xiyRovoRMiE0JMQ3LJ2n" alt=""><figcaption></figcaption></figure>

2. Go to the **Library** section.

<figure><img src="/files/t7DhYEOXoLRxTvj7zzh2" alt=""><figcaption></figcaption></figure>

3. Find the **Google Play Developer API** section.

<figure><img src="/files/2NcZxJsjz4MrzD9S2b4P" alt=""><figcaption></figcaption></figure>

4. Press `ENABLE` to enable the **Google Play Androd Developer API**.

<figure><img src="/files/a1wy97hjEQ699IKVXkOB" alt=""><figcaption></figcaption></figure>

### **Service account** <a href="#service-account" id="service-account"></a>

Go to the [**Service accounts**](https://console.cloud.google.com/apis/credentials/serviceaccountkey) section. &#x20;

1. Select the **project** to link the service account and where you will collect subscription data later. Create a new project if it is not in the list.&#x20;

   &#x20;

   <figure><img src="/files/uFq3w7adMIa1z5OALtNV" alt=""><figcaption></figcaption></figure>
2. In the list of available service keys, click `CREATE SERVICE ACCOUNT`.&#x20;

   &#x20;

   <figure><img src="/files/V2qyWwXCp7AeRXzZFJEc" alt=""><figcaption></figcaption></figure>
3. Fill in the **Service account name** field. The **Service Account ID** field will be filled in automatically (use the screenshot below as an example) and click `CREATE AND CONTINUE`.&#x20;

   &#x20;

   <figure><img src="/files/z8Gy0m68VIu0zq8iXQNK" alt=""><figcaption><p>s</p></figcaption></figure>
4. Skip the optional steps 2-3 and click `DONE` at the end of the form.&#x20;

   &#x20;

   <figure><img src="/files/ftFBvffIooTkWkooAOK4" alt=""><figcaption></figcaption></figure>
5. After creating a service account, you will be returned to the available Service accounts list. \
   \
   Select the created account and open the **KEYS** tab (1), click `ADD KEY` (2), and then select the **JSON** key type option (3) in the pop-up window. \
   Click `CREATE` to confirm your choice. \
   \
   The generated **private key file** will be downloaded automatically. You will need to upload this key to devtodev later in the following steps (see [Settings on devtodev side](#step-2.-settings-on-devtodev-side)).&#x20;

   &#x20;

   <figure><img src="/files/Brs2xwOeOeigB04cnkPd" alt=""><figcaption></figcaption></figure>
6. Go to the **IAM** section (1) in the **Permissions** tab and click `GRANT ACCESS` (2) to add roles to the service account. \
   In the **New principals** section (3), enter the service account address and grant it the **Pub/Sub Subscriber** role (4). \
   If you do not have this role, you need to activate the **Pub/Sub service** in the Cloud Console ([activate Pub/Sub API](https://console.cloud.google.com/apis/api/pubsub.googleapis.com)). \
   Save the changes (5).

   <figure><img src="/files/1goFKAfnoWhwZjAhw1p6" alt=""><figcaption></figcaption></figure>

### **Pub/Sub service** <a href="#pub-sub-service" id="pub-sub-service"></a>

Go to the [list of topics](< https://console.cloud.google.com/cloudpubsub/topic/list>) in the **Pub/Sub** service.

1. Select the project where you would like to collect subscription data. Click `CREATE TOPIC`.&#x20;

   &#x20;

   <figure><img src="/files/FODj0It3t1GjvarkvPPQ" alt=""><figcaption></figcaption></figure>
2. To create a topic: fill in the **Topic ID** (use the screenshot below as an example), disable **Add a default subscription** option (1) and click `CREATE` (2).&#x20;

   &#x20;

   <figure><img src="/files/OBXkQ0agqBz5bnIBwcjx" alt=""><figcaption></figcaption></figure>
3. Select a topic, click on three dots and select **View permissions**.

   &#x20;

   <figure><img src="/files/pHLPRSITaMYt0GRfzpb8" alt=""><figcaption></figcaption></figure>
4. Click `ADD PRINCIPAL` to add the service account. &#x20;

   &#x20;

   <figure><img src="/files/caUJRvMOjW0RvWua0XnM" alt=""><figcaption></figcaption></figure>
5. Add the `google-play-developer-notifications@system.gserviceaccount.com` service account and grant it the role of **Pub/Sub Publisher**. Save the changes.

   &#x20;

   <figure><img src="/files/71F92bF58scV5UCUVZkk" alt=""><figcaption></figcaption></figure>
6. Open the list of subscriptions and click `CREATE SUBSCRIPTION`.

   &#x20;

   <figure><img src="/files/D0IzviX6WueS5tGijy3S" alt=""><figcaption></figcaption></figure>
7. In the appeared form:&#x20;
   * Specify the **Subscription ID** (1).&#x20;
   * Fill in the Topic name in **Select a Cloud Pub/Sub topic** field (2).&#x20;
   * In the **Delivery type** select **Push** (3)**.**&#x20;
   * Copy **Endpoint URL** from devtodev (see steps 8-9) and insert it in the **Endpoint URL** field (4).  \
     \
     All other parameters remain unchanged. Save the changes.

     &#x20;

     <div data-full-width="false"><figure><img src="/files/7HHhXoHka6yadXVJl5v5" alt=""><figcaption></figcaption></figure></div>
8. To get **Endpoint URL,** go to [devtodev](https://analytics.devtodev.com/), select the same app and open app settings (`Settings → Payments integration → IA refunds tracking`).<br>

   <figure><img src="/files/YvnItaUrlUsyIfV9LqT0" alt=""><figcaption></figcaption></figure>
9. Copy the **Endpoint URL** and paste it in the corresponding field in Google Cloud (step 7).&#x20;

## **Settings on devtodev side** <a href="#step-2.-settings-on-devtodev-side" id="step-2.-settings-on-devtodev-side"></a>

1. Go to `Settings → Payments integration → IA refunds tracking` and click `edit` (3).<br>

   <figure><img src="/files/ksr4nA1ec4jiC1eTmaeI" alt=""><figcaption></figcaption></figure>
2. Fill in the integration form with the data obtained earlier:

   * Android App ID
   * Upload the **Private key file** obtained in [**Service Account**](#service-account) step.

   Click `Save`.<br>

   <figure><img src="/files/UGjMHiyGWtO0JtjNGfke" alt=""><figcaption></figcaption></figure>
3. When the integration is complete, the status will change to **Active.**

   <figure><img src="/files/fEEGZqO5DBVjddm74E3w" alt=""><figcaption></figcaption></figure>

## Settings in **Google Play Console** <a href="#step-3.-google-paly-console" id="step-3.-google-paly-console"></a>

### Service account and User permissions <a href="#service-account-and-user-permissions" id="service-account-and-user-permissions"></a>

To set up user permission, you need to log into your Google Play Console account and invite your [previously created service account](#service-account).

1. Sign into the [Google Play Developer Console](https://play.google.com/apps/publish/signup/).

   <figure><img src="/files/JVNYzpkOyAdX6QvDIrPL" alt="" width="375"><figcaption></figcaption></figure>
2. In the **Users and permissions** section, you can add users and manage their permissions.
   * Go to **Users and permissions.**
   * Click `Invite new users`.<br>

     &#x20;

     <figure><img src="/files/B8Phs1kDCYlA5hQFyiXh" alt=""><figcaption></figcaption></figure>
3. Add [Service Account](#service-account) as a new user:&#x20;

   * Add your service account email in the **Email address** field (1).&#x20;
   * In the **Permissions section** (2) select **the apps** (3) accessible to the service account. Click `Apply` (5). \
     Grant permissions to individual apps, or use account permissions to grant access to all apps in your developer account.&#x20;
   * Grant the necessary rights to perform actions (see next step **Account permissions**).&#x20;

   <figure><img src="/files/HG0bnNXUu4tJG8n702oI" alt=""><figcaption></figcaption></figure>
4. Open **Account permissions** tab. Grant the following permissions:

   * View app information (1)
   * View app quality information (2)
   * View financial data (3)

   Click `Apply` to confirm.&#x20;

{% hint style="info" %}
**Please note that the specified permissions may not apply immediately!**
{% endhint %}

<figure><img src="/files/6M1uGuLP5FS3uMByETw5" alt=""><figcaption></figcaption></figure>

5. Click `Invite user` to finish the user setup.&#x20;

### Monetisation setup

After [creating a subscription](#pub-sub-service) in the **Pub/Sub** **service**, you'll need to register the created topic as a target for **Real-time developer notifications** (RTDN).&#x20;

1. Go to the app’s **Monetise with Play** → **Monetisation setup** section.&#x20;
2. Enter the full name of the topic in the **Topic name** field.&#x20;
3. Tick the **Enable real-time notifications** checkbox.
4. Send a **test notification** using the link below (4). If everything is configured correctly, the test notification will change the integration status of the **Subscriptions** in devtodev to Active (Settings → Payments integration → Subscriptions → Market connection).&#x20;
5. Click `Save changes` to finish the setup.<br>

<figure><img src="/files/i3mbSMORMqttExZmjrlG" alt=""><figcaption></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://docs.devtodev.com/integration/autocapture/automatic-refund-tracking/google-play.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.
