Subscription setup for Android apps

In order for Adjust to communicate with Google, you need to provide a set of service credentials. In this article, learn how to link your Google Cloud project to the Play Console, and authorize it using a service account.

  1. Set up real-time developer notifications for Android in your Google Play Account. When you set up server notifications, the Google Play Store notifies Adjust of updates to your app's subscriptions. This lets Adjust trigger subscription events on time.
  2. Create your JSON public key for your Google Service Account. You need the JSON key to connect your Google Service Account to Adjust.
  3. Grant financial access to your Service Account.
  4. Connect your Google Service Account in Adjust.

Before you begin

Here's what you need to know before getting started.

Growth solution:

Subscriptions is available as an Adjust Growth solution. Speak with your Adjust representative or sales@adjust.com to get this added to your package.

Requirements

  • Account owner permissions in Google Play Console
  • Permissions to create topics, subscriptions, and assign roles in Google Cloud Console
  • Admin, Editor, or Custom Editor permissions in Adjust to connect your Google Service Account credentials to Adjust

Set up real-time developer notifications

Create a push subscription

  1. Open Topics in the Google Cloud console.
  2. Select your project.
  3. Select Create topic.
  4. Provide a Topic ID, and select Create.
  5. Now, in the left navigation pane, under Pub/Sub, select Subscriptions.
  6. Select Create subscription.
  7. Provide a Subscription ID.
  8. In the Select a Cloud Pub/Sub topic list, select the topic that you created in Step 4.
  9. Under Delivery type, select Push.
  10. In the Endpoint URL field, enter https://subscription.adjust.com/v3/playstore.
  11. Under Retry policy, select Retry after exponential backoff delay, and enter the following:
    • Minimum backoff time - 10
    • Maximum backoff time - 600
  12. Select Create.

Add a principal to your subscription

  1. Select the subscription that you created, and select Add prinicipal.
  2. In the New principals field, enter google-play-developer-notifications@system.gserviceaccount.com.
  3. In the Assign roles list, select Pub/Sub Publisher.
  4. Select Save.

Copy the value of topic name

  1. Open Topics in the Google Cloud console.
  2. Select the topic that you added while creating a push subscription, and copy the value of the Topic’s name.
    • You might have to select (Down arrow icon) to view the complete topic name. Then, select (Copy icon) to copy the value of Topic name.

You'll need this value in the next step.

Enable real-time developer notifications for your apps

  1. Open Google Play console.
  2. Select your app.
  3. Under Monetize, select Monetization setup.
  4. Scroll down to the Google Play Billing section.
  5. For Manage notifications, select Enable real-time notifications.
  6. In the Topic name field, paste the topic name that you copied in the previous step.
  7. Select Save changes.

Repeat steps 2-7 for every app that you want to set up subscriptions.

Create your JSON public key

Enable the Google Play Android Developer API

  1. Open the Google Play Console.
  2. Select an existing project, or create a new project.
  3. Open APIs & Services > Enabled APIs and services.
  4. Select + Enable APIs and Services.
  5. Search for and select the Google Play Android Developer API, and select Enable.
  6. Select Create credentials.
  7. Under Which API are you using?, select Google Play Android Developer API.
  8. Under What data will you be accessing?, select Application data, and select Next.
Important:

It might take up to 36 hours for your credentials to work properly with the Google Play Developer API.

Create a Service Account

Added your product to the Play Console before creating a Service Account?

Important

To create a service account, follow these steps.

  1. Open the Google Cloud Console.
  2. Select the same project that you chose in the previous step.
  3. Open IAM & Admin > Service Accounts.
  4. Select Create Service Account.
  5. Under Service account details, provide a name for your service account.
    • This auto-populates the Service account ID field. This is the email of the service account.
  6. Select Create and Continue.
  7. Under Grant this service account access to project (optional), choose the following roles, and select Continue.
    • Service Account Key Admin - This enables creating and managing service account keys.
    • Pub/Sub Admin - This enables platform server notifications.
    • Monitoring Viewer - This allows monitoring of the notification queue.
  8. Select Done to go back to the Service accounts page.

In Google Cloud Console, select Create Service Account.

1/2

Generate your public key credentials

To generate your public key credentials, follow these steps.

  1. Open the Google Cloud Console.
  2. Select the same project that you chose in the previous step.
  3. Open IAM & Admin > Service Accounts.
  4. For the service account that you created, under Actions, select Manage keys.
  5. Select Add key > Create new key.
  6. Select Key type as JSON, and then Create.

For your service account, select Manage keys.

1/3

Grant financial access

To grant financial access for your service account, follow these steps.

In Google Cloud Console

  1. In Google Cloud Console, select the same project that you chose in the previous step.
  2. Open IAM & Admin > Service Accounts.
  3. For the service account that you created, copy the value of Email.
    • You will need this email in the next step.

In Google Play Console

  1. Open the Google Play Console.
  2. Select Users and permissions > Invite new users.
  3. Enter the email address of the service account that you retrieved in the previous step.
  4. Under App permissions, add your app.
  5. Under Account permissions, select the following permissions:
    • View app information (read-only)
    • View financial data
    • Manage orders and subscriptions
  6. Select Invite user, and then select Send invite.

In Google Play Console, under API access, select Grant access.

1/3

If these options are not available, you might not have adequate account permissions. Contact your Account Owner or Admin.

Connect Google Service Account in Adjust

Follow these steps to add your Google Service Account credentials in Adjust.

  1. Under DataWorks, select Connections.
  2. Select + New Connection.
  3. Under Partner, select Google Service Account.
  4. Under Services, select Subscription.
  5. In the Credentials file field, upload the JSON file you download in the Generate your public key credentials step.
  6. Select Connect.

➡️ Next: Enable subscriptions for your app in Adjust.