In-app Google Play subscriptions

To track subscription status updates on Google Play, create and upload a service account JSON file to AppMetica. The steps for creating a service account are described in detail below.

  1. Creating a service account
  2. Topic for tracking subscriptions
  3. Troubleshooting

Creating a service account

  1. Open Google Play Console settings and go to Setup → API Access.

  2. Link an existing Google Cloud project or create a new one.

    Example
  3. Click the View in Google Cloud Platform link that appears.

    Example
  4. Read and accept the “Terms of Service” if the respective dialog box opens.

  5. Search for the Service accounts menu and open it.

    Example
  6. On the page that opens, click + CREATE SERVICE ACCOUNT at the top of the screen.

    Example
  7. Enter a name for the account, such as “AppMetrica”, and click CREATE.

    Example
  8. Select the Editor role for this account (you can find it via Basic — Editor).

    Example
  9. Create a new private key for the account. To do this, click in the Actions section to the right of the service account and select Manage keys.

    Example
  10. Next, click ADD KEY — CREATE NEW KEY on the key management page that opens. Select the JSON key type and click CREATE.

    Example
  11. Grant the service account access to the app's financial data so that AppMetrica can validate and check the status of Google Play subscriptions.

    Go to Google Play Console → API Access and then to Service accounts. Click Manage Play Console Permissions for the created account.

    Example
  12. In the window that opens, go to the Account permissions tab at the top of the screen.

  13. Select the options:
    • View app information and download bulk reports (read-only)
    • View financial data, orders, and cancellation survey responses
    • Manage orders and subscriptions
    Click Invite User and Send Invite.
    Example
  14. In the left-hand menu, go to Users and Permissions, click on the created service account, and go to App permissions in the section settings. Select your app (Add app), click Apply and then Save changes.

    Example
  15. In the Permissions for Billing Develop form that opens, click Apply.

  16. Go to the AppMetrica interface, your app's settings, and open the Revenue section.

  17. In AppMetrica, the Settings section, the Revenue subsection, upload the service account JSON file under Tracking and validating Google Play subscriptions.

    Example

Topic for tracking subscriptions

You can also track subscription statuses using the Google Cloud Console topic. AppMetrica has three options for working with the topic to choose from:

  1. A new topic will be created in AppMetrica. If you don't use another subscription tracking service, we recommend choosing this option.

    Copy the topic name in the interface and paste it into Google Play Console → Monetization setup → insert the topic in the Topic Name field.

    Note.

    Make sure that the Cloud Pub/Sub topic exists and you have granted Google the necessary permissions to publish notifications. For more information, see the documentation.

  2. Use an existing topic. If you use an additional service to track subscriptions, there should be an existing topic. Google Cloud Console doesn't let you use two topics at the same time. Therefore, you need to copy your current topic and paste it into AppMetrica, the Settings section, the Revenue subsection.

    To do this, go to Google Play Console → Monetization setup, copy the topic name from the Topic name field, and paste it into the Revenue settings input field in the AppMetrica interface.

  3. Don't use a topic. We don't recommend choosing this option, because when no topic is present, AppMetrica will only check subscription statuses once a day and subscription data may be delayed by up to 24 hours. Some of the subscription events will also be unavailable.

Troubleshooting

Error creating a topic

The PERMISSION_DENIED: Cloud Pub/Sub API has not been used in project before or it is disabled error occurs.

It means that the Pub/Sub API isn't enabled for the project. To fix the error, follow the link in the error message (for example, https://console.developers.google.com/apis/api/pubsub.googleapis.com/overview?project=123456) and click Enable to activate the Pub/Sub API. Next, return to AppMetrica and click Save and enable tracking again.

If you didn't find the answer you were looking for, you can use the feedback form to submit your question. Please describe the problem in as much detail as possible. Attach a screenshot if possible.