Skip to main content

Google Real-Time Developer Notifications

RevenueCat does not require anything further than service credentials to communicate with Google, but setting up real-time server notifications is a recommended process that can speed up webhook and integration delivery times and reduce lag time for Charts.

Setup Instructions​

1. Ensure Google Cloud Pub/Sub is enabled for your project.​

  • Where: Google Cloud Console

You can enable it here. Make sure that you're in the correct project, the same one that you set up your service account and credentials in.

Google Cloud Console

2. Choose a Pub/Sub Topic ID​

  • Where: RevenueCat Dashboard
  • Project Page ➑️ Google Play App Settings

Directly beneath where the Service Credentials JSON object is added, a list of possible Pub/Sub topics to use will be visible. You can either choose an existing one, or let RevenueCat create a new one.

Click 'Connect to Google'. You should see a generated Google Cloud Pub/Sub Topic ID, as in the image below. If you don’t, try refreshing the page to get it to populate. Copy this topic ID to your clipboard.

RevenueCat Dashboard

⚠️Internal Server Error

If you see a server error when clicking "Connect to Google", or see the error One or more users named in the policy do not belong to a permitted customer in the logs in Google Cloud Console, "Domain Restricted Sharing" may be on for your Cloud project. This constraint is on by default for organizations created on or after May 3rd, 2024. You can check on this in Google Cloud Console -> "IAM & Admin" -> "Organization Policies" -> "Domain Restricted Sharing". You can choose to turn off this constraint, or make allowances for certain domains, including the service account created to communicate with RevenueCat.

3. Add Topic ID to Google Play​

  • Where: Google Play Console
  • Google Play Homepage ➑️ App Dashboard ➑️ 'Monetize' section of sidebar ➑️ Monetization Setup

In Google Play console, head to the dashboard for your app and find the 'Monetize' section of the sidebar. Choose 'Monetization Setup'. In the Real-time developer notifications section, paste your copied topic ID next to 'Topic name' and select 'Subscriptions, voided purchases, and all one-time products' next to Notification content. Be sure to Save Changes at the very bottom right.

Google Play Console Notification Content

If you don't see any errors, your real-time developer notifications should be ready to go!

Google Play Console

Send Test Notification​

  • Where: Google Play Console & RevenueCat Dashboard
  • Google Play Homepage ➑️ App Dashboard ➑️ 'Monetize' section of sidebar ➑️ Monetization Setup
  • RevenueCat Project Page ➑️ Google Play App Settings

There is an option in Google Play to send a test notification. This is a great way to verify that Google Pub/Sub is correctly connected to your RevenueCat account.

Click the 'Send test notification' button under the topic name in the 'Monetization Setup' section.

Once that test notification is sent, you can go back to your app config on the RevenueCat dashboard where you connected to Google to enable real-time notifications. If the configuration was successful, you should see a "Last received" label with a recent timestamp.

Google Play Console / RevenueCat Dashboard

Tracking new purchases using Google Cloud Pub/Sub​

By default, RevenueCat ignores any Google Cloud Pub/Sub notifications for purchases that have not yet been posted to the RevenueCat API by one of our SDKs or from your own backend. For RevenueCat to track new purchases from Google Cloud Pub/Sub, you can enable the "Track new purchases from server-to-server notifications" option in our Dashboard. This allows RevenueCat to process new purchases from server-to-server notifications that are not yet in our system. This ensures all purchases are tracked, even in the case of network issues between your app and RevenueCat’s backend or if your customer was using a version of the app without the RevenueCat SDK.

Considerations​

  • The subscriber's app user ID will be taken from the obfuscatedExternalAccountId field of the transaction.
    • If the obfuscatedExternalAccountId is set and does not match with an existing subscriber: RevenueCat will create a new subscriber with an app user ID matching the obfuscatedExternalAccountId value provided.
    • If the obfuscatedExternalAccountId is set and matches with an existing subscriber: No new subscriber will be created, and the purchase will be linked to that existing subscriber.
    • If the obfuscatedExternalAccountId is not set: RevenueCat will generate an anonymous app user ID to associate that purchase with.
  • If you are using RevenueCat's SDK to track purchases, we may receive the notification directly from the store before the SDK. When this happens, we will follow the app user ID logic as described in the bullet point above, and then proceed with your transfer behavior for the new app user ID sent by the SDK.
⚠️Customer attributes in events

RevenueCat will start processing the purchase as soon as we receive the Google Cloud Pub/Sub notification. If you rely on RevenueCat customer attributes being attached to the customer before the purchase is created on RevenueCat (e.g: sending customer attributes to your enabled third-party integrations or webhooks), you should make sure to send and sync the customer attributes as soon as you have them or before the purchase is completed.

⚠️

If you have enabled Keep with original App User ID or Transfer if there are no active subscriptions transfer behavior, we highly recommend turning this setting off unless you are not setting the obfuscatedExternalAccountId or if the obfuscatedExternalAccountId will match their RevenueCat app user ID.

Considerations​

❗️Errors when connecting?

If you're getting an error when connecting to Google for Platform Server Notifications from the RevenueCat dashboard, use our Checklist to ensure you've hit every step, or use our error handling guide to troubleshoot.

⚠️Service Credentials take ~36hrs to go into effect

If you receive a credentials error, make sure you've waited at least 36hrs after creating your Google Service Credentials before connecting to Google Real-Time Developer Notifications.

πŸ“˜

If you need to use an existing Pub/Sub topic with RevenueCat, contact support.