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.
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.
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.
If you don't see any errors, your real-time developer notifications should be ready to go!
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.
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.
App User ID Detection Methodsβ
RevenueCat provides different ways to detect the App User ID for purchases coming through Google Pub/Sub notifications. The purchase will be associated with the detected App User ID.
- Use anonymous App User IDs: RevenueCat will generate a RevenueCat anonymous App User ID to associate the new purchase with. If you are using the RevenueCat SDK, we strongly recommend selecting this option. The RevenueCat SDK automatically sets the
obfuscatedExternalAccountId
as a hashed App User ID, which can cause unintended overwrites. - Use Google's obfuscatedExternalAccountId as App User ID: RevenueCat will use the
obfuscatedExternalAccountId
field as the RevenueCat App User ID. Only select this option if you are using both theobfuscatedExternalAccountId
field as your RevenueCat app user ID and are using RevenueCat without our SDK.
The diagram below will help you determine which App User ID detection method to select based on your setup.
Considerationsβ
- If you have selected the "Use Google's obfuscatedExternalAccountId as App User ID" option:
- 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 theobfuscatedExternalAccountId
value provided. - If the
obfuscatedExternalAccountId
is set and matches with an existing subscriber: 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 the
- 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, the App User ID detection method described above will be applied, and then RevenueCat will follow your restore behavior for the new app user ID sent by the SDK.
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), ensure you send and sync customer attributes as early as possible. Delays can result in missing attributes for purchases, which may affect third-party integrations or webhook events.
If you have enabled Keep with original App User ID or Transfer if there are no active subscriptions transfer behavior or Share between App User IDs (legacy), we highly recommend turning this setting off unless you have selected the "Use anonymous App User IDs" as the App User ID detection method or are using RevenueCat without our SDK.
Considerationsβ
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.
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.