LogoLogo
My AppsLive demoNewsArticles
  • Introduction
  • 📌Product updates: 2025
    • 2024
    • 2023
  • Getting Started
    • Registration
    • Adding a space
    • Adding an app to the space
  • Basic Events & Custom Events
  • Integration
    • Expert Tips
      • What to track
      • Payments & Anti-cheat
      • Check your integration
    • Integration of SDK 2.0+
      • SDK Integration
        • Android
        • iOS
        • macOS
        • Windows
        • Web
          • Web SDK Integration
          • Web SDK Releases
        • Unity
        • Unreal Engine
        • Godot Engine
      • Automatic payment tracking
        • App Store
        • Google Play
      • Setting up Events
        • Basic methods
        • Secondary methods
        • User profile
        • Anticheat methods
        • Track sessions
      • Push notifications
        • Android
        • iOS
        • Windows (UWP)
        • Unity
          • Android
          • iOS
          • Windows (UWP/WSA)
        • Unreal Engine
      • A/B testing
        • Description of A/B testing on the SDK side
        • Working with A/B tests in the devtodev interface
        • A/B testing examples
    • Integration of SDK 1.0+ (deprecated)
      • SDK Integration
        • iOS
        • Android
        • Windows 8.1 and 10
        • Web
        • Unity
        • Mac OS
        • Adobe Air
        • UE4
      • Setting up Events
        • Basic methods
        • Secondary methods
        • User profile
        • Anti-cheat Methods
      • Push Notifications
        • IOS
        • Android
        • Windows 8.1 and Windows 10
        • Unity
        • Abode Air
        • UE4
    • Test Devices
    • Server API
      • Data API 2.0
      • Subscription API
      • Push API
        • IOS
        • Android
        • Windows UWP
        • Windows
      • Raw Export
      • Labels API
      • Data API
    • Import historical data via API
    • Data Export
      • Data Export to Cloud Storage (BigQuery / Amazon S3)
  • 3rd Party Sources
    • Attribution Trackers
      • AppsFlyer
      • Adjust
      • Branch.io
      • Kochava
      • Tenjin
      • Tune (MAT)
      • Singular
      • Custom postback API
      • Facebook Ads referral decryption
    • App Marketplace Data
      • App Store Connect Stats
      • App Store Subscriptions
      • Google Play Console Stats
      • Google Play Subscriptions
      • AppGallery Connect Stats
    • Ad revenue
      • AdColony
      • AdMob
      • Facebook
      • MoPub
      • Unity Ads
      • Vungle
      • Ad revenue API
    • Cohort export
  • Reports and Functionality
    • Space-related Reports and Functionality
      • Overview
      • Custom dashboards & Reports
      • SQL
        • SQL tips
        • SQL Query examples
      • Audience overlap
    • Project-related Reports and Functionality
      • Overview
        • Real-Time Dashboard
        • Acquisition reports
        • Engagement reports
        • Monetization reports
        • In-game analysis reports
        • Cohort analysis
      • Reports
      • Push Notifications
        • Android Notifications
        • IOS Notifications
        • Windows Notifications
        • Button Templates
      • Predictions
      • Users & Segments
      • Filters
      • A/B Testing
      • Tuning
      • Settings
  • Metrics and Glossary
    • Ad networks metrics
    • Market Metrics
    • Prediction Metrics
    • SDK Metrics
    • Subscription metrics
  • Space Management
  • User Profile Management
  • Limits
  • Scenarios and Best Practices
    • Analytics use cases
    • Match-3
    • MMORPG Games
    • Hyper-Casual games
    • Social Casino
    • RPG games
    • Farming games
    • Non-gaming app
    • Acquisition Example
  • FAQ
    • Identification
    • Raw Data
    • All about data discrepancies
  • Slack
Powered by GitBook
On this page
  • SDK integration
  • Subscription restore
  • Settings in Google Cloud Platform Console
  • Google Play Android Developer API
  • Service account
  • Pub/Sub service
  • Settings on devtodev side
  • Settings in Google Play Console
  • Service account and User permissions
  • Monetisation setup

Was this helpful?

Export as PDF
  1. Integration
  2. Integration of SDK 2.0+
  3. Automatic payment tracking

Google Play

PreviousApp StoreNextSetting up Events

Last updated 1 month ago

Was this helpful?

1

2

3

4

SDK integration

Prerequisites:

  • DTDAnalytics 2.5.0 and higher

dependencies {
    implementation ("com.devtodev:android-google-purchases:*.*.*")
    // Starting from version 6.0.0
    implementation ("com.android.billingclient:billing:*.*.*")
}

Prerequisites:

  • DTDAnalytics 2.5.0 and higher

dependencies {
    implementation 'com.devtodev:android-google-purchases:*.*.*'
    // Starting from version 6.0.0
    implementation 'com.android.billingclient:billing:*.*.*'
}

Prerequisites:

  • DTDAnalytics 3.9.0

  • DTDPurchases 3.9.0

To initialize the service, call the startAutoTracking method of the DTDPurchases interface. Call the method after the SDK initialization call:

val config = DTDAnalyticsConfiguration()
DTDAnalytics.initialize("App ID", config, context)
DTDGooglePurchases.initialize(context)
DTDGooglePurchases.startAutoTracking()
DTDAnalyticsConfiguration config = new DTDAnalyticsConfiguration();
DTDAnalytics.INSTANCE.initialize(appKey, config, context);
DTDGooglePurchases.INSTANCE.initialize(context);
DTDGooglePurchases.INSTANCE.startAutoTracking();
DTDAnalytics.Initialize(APPKey, new DTDAnalyticsConfiguration
{
  UserId = userId,
  ApplicationVersion = Application.version,
  CurrentLevel = lvl,
  LogLevel = DTDLogLevel.No,
  TrackingAvailability = DTDTrackingStatus.Enable
});
DTDPurchases.StartAutoTracking();

Subscription restore

The SDK will automatically restore the list of previously purchased subscriptions at the first launch of the autotracking service. No additional integration is required.

Settings in Google Cloud Platform Console

Google Play Android Developer API

  1. Go to the Library section.

  1. Find the Google Play Developer API section.

  1. Press ENABLE to enable the Google Play Androd Developer API.

Service account

  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.

  2. In the list of available service keys, click CREATE SERVICE ACCOUNT.

  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.

  4. Skip the optional steps 2-3 and click DONE at the end of the form.

Pub/Sub service

  1. Select the project where you would like to collect subscription data. Click CREATE TOPIC.

  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).

  3. Select a topic, click on three dots and select View permissions.

  4. Click ADD PRINCIPAL to add the service account.

  5. Add the google-play-developer-notifications@system.gserviceaccount.com service account and grant it the role of Pub/Sub Publisher. Save the changes.

  6. Open the list of subscriptions and click CREATE SUBSCRIPTION.

  7. In the appeared form:

    • Specify the Subscription ID (1).

    • Fill in the Topic name in Select a Cloud Pub/Sub topic field (2).

    • In the Delivery type select Push (3).

    • 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.

  8. Copy the Endpoint URL and paste it in the corresponding field in Google Cloud (step 7).

Settings on devtodev side

  1. Go to Settings → Payments integration → IAP auto tracking and click edit (3).

  2. Fill in the integration form with the data obtained earlier:

    • Android App ID

    Click Save.

  3. When the integration is complete, the status will change to Active.

  4. If you use subscriptions, go to Payments integration → Subscriptions and click Integrate.

Settings in Google Play Console

Service account and User permissions

  1. In the Users and permissions section, you can add users and manage their permissions.

    • Go to Users and permissions.

    • Click Invite new users.

    • Add your service account email in the Email address field (1).

    • 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.

    • Grant the necessary rights to perform actions (see next step Account permissions).

  2. 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.

Please note that the specified permissions may not apply immediately!

  1. Click Invite user to finish the user setup.

Monetisation setup

  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).

  5. Click Save changes to finish the setup.

If you have already activated the and set up a to work with devtodev, you can skip this section and proceed to .

Go to 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).

Go to the section.

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 ).

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 (). Save the changes (5).

Go to the in the Pub/Sub service.

To get Endpoint URL, go to , select the same app and open app settings (Settings → Payments integration → Subscriptions). Click Integrate.

Upload the Private key file obtained in step.

Upload the Private key file obtained in step (1). Specify Android App ID (2). Add all existing subscriptions, specifying the bundle, subscription period, and name for each subscription. Click Save (3) to finish integration.

To set up user permission, you need to log into your Google Play Console account and invite your .

Sign into the .

Add as a new user:

After in the Pub/Sub service, you'll need to register the created topic as a target for Real-time developer notifications (RTDN).

Google Cloud Console
Service accounts
activate Pub/Sub API
list of topics
devtodev
Google Play Developer Console
SDK Integration
Settings in Google Cloud Platform Console
Enable Google Play Android Developer API
Set up Service account
Set up Pub/Sub service
Settings on devtodev side
Settings in Google Play Console
Add service account and grant permissions
Set up Real-time developer notifications
Google Play Android Developer API
service account
Pub/Sub service setup
Settings on devtodev side
Service Account
Service Account
previously created service account
Service Account
creating a subscription
s