> For the complete documentation index, see [llms.txt](https://docs.devtodev.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devtodev.com/3rd-party-sources/app-marketplace-data/google-play-subscriptions.md).

# Google Play Subscriptions

{% hint style="danger" %}
This functionality is available only for projects with integrated devtodev SDK version 2.1.0 or higher for native applications and not lower than 3.1.0 for Unity!
{% endhint %}

{% hint style="info" %}
Please note that the current section describes how to integrate **only one source** of subscription data – Google Play. To get subscription data in devtodev reports, you also need to integrate the [**Subscription event via SDK**](/integration/integration-of-sdk-v2/setting-up-events/basic-methods.md#subscriptions).\
When you integrate both data sources (Google Play and SDK), the [**Subscriptions report**](/reports-and-functionality/project-related-reports-and-fuctionality/smart-view/monetization-reports.md#subscriptions) will become available, and devtodev will correctly match the data with your users. If one of the integrations is missing, the **Subscriptions** **report** will not work correctly.
{% endhint %}

{% 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)

[Set up Service Account](#service-account)

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

{% step %}

#### [Settings on devtodev side](#step-3.-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)

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

{% step %}

#### [SDK Integration](#sdk-integration-1)

{% 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 for which you want to configure **Google Play Developer API**. Then go to the **APIs and services** section.

<figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FBIZZYTfzo5xyJsR8rnGL%2Fimage.png?alt=media&amp;token=1f9d5029-ca80-41df-b8c0-9b5bc10688c6" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FYq3STJ0lwogyzxn005U6%2Fimage.png?alt=media&amp;token=88e1a53d-db75-4498-9ae6-c007113882c7" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2F1zZhHx92lWRhJbGUyva1%2Fimage.png?alt=media&amp;token=f56a09b6-7f78-4d80-996e-7e25883c0f70" alt=""><figcaption></figcaption></figure>

4. Click `ENABLE` to enable the **Google Play Android Developer API**.

<figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2Fg9i2YY6LQMrgoNYTVkdy%2Fimage.png?alt=media&amp;token=fb68d6cb-62e8-47b5-b8f2-b72ab907f16b" 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 to and where you will collect subscription data later. Create a new project if it is not in the list.&#x20;

   <figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FPD8qscYxs75fHlks9l9Z%2Fimage.png?alt=media&amp;token=e20932db-18dc-4932-810f-aa79e64628e5" alt=""><figcaption></figcaption></figure>
2. In the list of available service keys, click `CREATE SERVICE ACCOUNT`.&#x20;

   <figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FcDEIznrEMQvPD61g0CRJ%2Fimage.png?alt=media&amp;token=c99da195-22b8-4811-9c92-93f9e1adc731" 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). Click `CREATE AND CONTINUE`.&#x20;

   <figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FSvi1PY4q1ZrheGN8DFR6%2Fimage.png?alt=media&amp;token=6af36501-22ad-4ab2-a8bf-bf9b10477b96" alt=""><figcaption></figcaption></figure>
4. Skip the optional steps 2-3 and click `DONE` at the end of the form.&#x20;

   <figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FesaUuhA3MFtfHLslh4kI%2Fimage.png?alt=media&amp;token=1bec8092-79dd-47e2-a21d-e8c1cd5b4db9" alt=""><figcaption></figcaption></figure>
5. After creating a service account, you will be returned to the list of available service accounts.\
   \
   Select the created account and open the **KEYS** tab (1), click `ADD KEY` (2), and then select the **JSON** key type (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 (see [Settings on devtodev side](#step-3.-settings-on-devtodev-side)).&#x20;

   <figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FuCr2ya00z41Poh4KXiUY%2Fimage.png?alt=media&amp;token=4ce92bae-4750-494c-ab30-f8633228ded7" 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).&#x20;

   <figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FuRoVAzLIocJhh0PpFabx%2Fimage.png?alt=media&amp;token=43ad2d68-cc17-410c-b3d4-cfa8586947cf" 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;

<figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FvD6cF0CmE0leMC1IzaFQ%2Fimage.png?alt=media&amp;token=292af50c-7a77-41e9-ad0c-523cb0bdeca5" 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;

<figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FbAvHFyik8l5C0A3lkWWS%2Fimage.png?alt=media&amp;token=61dced9c-9f6c-49b3-bdaa-5c7d0fb1e480" alt=""><figcaption></figcaption></figure>

3. Select a topic, click on three dots and select **View permissions**.&#x20;

<figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FNABN0avZm5i6hBoESg0H%2Fimage.png?alt=media&amp;token=97ca9c0a-2776-4b4d-b06b-5c6bbcb66e41" alt=""><figcaption></figcaption></figure>

4. Click `ADD PRINCIPAL` to add the service account.&#x20;

<figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2F2bpDwgvH5zO9R9OTXlF0%2Fimage.png?alt=media&amp;token=d90f7f38-3d57-4d33-a6f8-442ca03e9891" 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="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FD6MuGWDEVnsSRQcsUJFH%2Fimage.png?alt=media&amp;token=d73108e5-3973-478a-9176-38b79cc20d71" alt=""><figcaption></figcaption></figure>

6. Open the list of subscriptions and click `CREATE SUBSCRIPTION`.&#x20;

<figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2F2WlyAfqQo2VpTCxczdDl%2Fimage.png?alt=media&amp;token=e3f9cb2d-176b-4bc1-b1da-9da3f55ddcdc" alt=""><figcaption></figcaption></figure>

7. In the form that appears:&#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 the **Endpoint URL** from devtodev (see steps 8-9) and insert it in the **Endpoint URL** field (4).&#x20;

Leave all other parameters unchanged. Save the changes.&#x20;

<figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FVwWuRJRomTZAyKStAVSl%2Fimage.png?alt=media&amp;token=21973385-24eb-474a-9567-9b0476d93914" alt=""><figcaption></figcaption></figure>

8. To get **Endpoint URL** go to [devtodev](https://analytics.devtodev.com/), select the same app and open the app settings (**Settings -> Payments integration -> Subscriptions**). Click `Integrate`.&#x20;

<figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FaULAubZPGGp5rVv3CqL8%2Fimage.png?alt=media&amp;token=9d814bb4-79d5-4816-b73c-fa608dce9372" alt=""><figcaption></figcaption></figure>

9. Copy the **Endpoint URL** and paste it in the corresponding field in Google Cloud (step 7).&#x20;

<figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FHL7vee0CyAQqBC8I68Ca%2Fimage.png?alt=media&amp;token=475db163-f31a-45c9-b067-81067626b2e7" alt=""><figcaption></figcaption></figure>

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

1. Upload the **Private key file** obtained in the [Service Account](#service-account) step (1).&#x20;
2. Specify Android App ID (2).&#x20;
3. Add all existing subscriptions, specifying the bundle, subscription period, and name for each subscription.&#x20;
4. Click `Save` (3) to finish integration.&#x20;

<figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FlcV7hvDje8OWiixKfLOL%2Fimage.png?alt=media&amp;token=e483c2ca-0117-4136-9ad9-6371b924d4c7" 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).&#x20;

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

<figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FoP6S3uxww8FKsniWOzXL%2Fimage.png?alt=media&amp;token=79805b9a-b617-4f1f-b45b-cf21a2e1f44e" alt=""><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`.&#x20;

<figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2Fzo743m4tskYzMk1VInmo%2Fimage.png?alt=media&amp;token=f416463d-8a52-47ce-829a-0c5ca2b4e709" alt=""><figcaption></figcaption></figure>

3. Add the [Service Account](#service-account) as a new user:&#x20;
   * Add your service account email in the **Email address** field (1).
   * In the **Permissions section** (2), select **the apps** (3) the service account will have access to. 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="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FClZGcN14xqNWArOkiSv2%2Fimage.png?alt=media&amp;token=22814fe0-2af1-4877-ad06-ee1efe5d0535" alt=""><figcaption></figcaption></figure>

4. Open **Account permissions** tab. Grant the following permissions:

   * View app information (1)&#x20;
   * View app quality information (2)&#x20;
   * 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="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2Fwlm4nde6r8rOTm21Z79z%2Fimage.png?alt=media&amp;token=284c3748-94fe-42a5-95f4-07ad14e63251" alt=""><figcaption></figcaption></figure>

5. Click `Invite user` to finish the user setup.

### 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.
2. Enter the full name of the topic in the **Topic name** field.
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.

<figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FXFJahQgrkAulG8wDGy4e%2Fimage.png?alt=media&amp;token=77da6b40-0a3d-4c49-ae06-27feb1c1f160" alt=""><figcaption></figcaption></figure>

## SDK Integration

Integrate the [SDK Subscription event](/integration/integration-of-sdk-v2/setting-up-events/basic-methods.md#subscriptions) to complete the integration.&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devtodev.com/3rd-party-sources/app-marketplace-data/google-play-subscriptions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
