Google Play Subscriptions

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!

Please note that the current section describes how to integrate only one source of subscription data - from the Google Play. You’ll also need to integrate the Subscription event via SDK to get the subscription data in the devtodev reports (the documentation link is at the bottom of the page). When you integrate both data sources (Google Play and SDK), you’ll be able to see the Subscription report and devtodev will connect that data with the users successfully. If one of the integrations is missing, the Subscription report won’t be working correctly.

Step 1. Service account

To create a service account, click the link

If you already have selected an active project, then skip the project selection block below.

  • Select the project that you will link to the service account and for which you will collect subscription data later. If the project is not listed, create it.

  • In the list of available service keys, click on the Create service account link.

  • In the provided free form, fill in the required fields (use the screenshot below as an example). And click the continue button. Skip the rest of the form by clicking next and confirm the creation of an account at the end of the form.

  • After creating a service account, you will be returned to the list of available accounts. Select the created account and open the KEYS tab, click the ADD KEY button, and then select the JSON option in the pop-up window. Confirm your choice by clicking the Create button. The generated key file will be automatically downloaded. This key you will need to download to the subscription analysis connection form.

  • Go to the IAM section in the Permissions tab and click ADD+ to add roles to the service account. In the appeared form, enter the service account address and give it the Pub/Sub Subscriber role. If you don’t have this role, you need to activate the Pub/Sub service in the Cloud Platform. Save the changes.

  • Next, you need to give the service account permission to receive data on subscriptions and refunds. To do this, go to the Setup tab → API Access in the Google Play Console.

    If you’ve completed all steps correctly, you will see the created service account in the list. Click on View access to set permissions for the account.

  • If you need to set permissions for all the account apps at once, select the Account permissions tab and set permissions as on the screenshot below.

If you want to select some apps, go to the App permissions tab, click on Add app, select the apps you need in the list and set the following permissions:

Step 2. Google Cloud Platform. Setting up Pub/Sub topic / subscription

  • Select the project on which you want to collect subscription data if it is not selected yet, then click the CREATE TOPIC link and create a topic. To do this, fill in the Topic ID (use the screenshot below as an example), disable Add a default subscription option and confirm the topic creation.

  • Add the service account, and grant it the role of Pub/Sub Publisher.

  • After that, open the list of subscriptions and create a subscription.

  • In the appeared form, specify the Subscription ID (always with devtodev-subscription), in the field below specify the topic you’ve just created, in the Delivery type choose Push and in the Endpoint URL field insert the link obtained from the devtodev subscription integration window. All other parameters remain unchanged.

To get Endpoint URL go to devtodev, select the same app and open the app settings (Settings -> 3rd Party Sources -> Google Play Console). Copy the Endpoint URL

  • After creating a subscription in the Pub/Sub service, you need to open the developer console and register the created topic as a target for RTDN (Real-time developer notifications). To do this, go to the app’s Monetization Setup section and enter the full name of the topic in the Topic name field. After that, send a test notification using the link below. If everything is configured correctly, then the test notification will change the integration status of the subscription in devtodev to Active.

  • Remember to save your changes.

Step 3. Settings on devtodev side

  • Go back to the devtodev app settings, specify the app package, and upload the private key file you received in Step 1.

  • Add all existing subscriptions, specifying the bundle, subscription period, and name for each subscription.

Last updated