Skip to main content
Question

RevenueCat / Intercom integration doesn't send user id from stripe purchases

  • 5 June 2024
  • 3 replies
  • 59 views

Hi there,

We are using the Intercom integration in RevenueCat. For our stripe purchases, RevenueCat sends an RCAnonymousID instead of the app user id.  When a stripe purchase is made, we call the receipts API from our backend and pass in the app_user_id, this correctly surfaces in RevenueCat linking the user id to the purchase.  However, RevenueCat is creating an alias, and sending that alias to intercom instead of the app user id.  Is there anyway to fix this?  Thanks!

 

Payload from RevenueCat to Intercom:

{
"app_id": 1094850,
"create_contact_payload": {
"custom_attributes": {
"expires_at": 1725546041,
"latest_entitlement": null,
"latest_store": "STRIPE"
},
"external_id": "$RCAnonymousID:6948fc31576641ed98c9c171826ae506"
},
"product_identifier": "prod_QCyCt8PLphAYgl",
"search_contact_payload": {
"query": {
"field": "external_id",
"operator": "=",
"value": "$RCAnonymousID:6948fc31576641ed98c9c171826ae506"
}
},
"send_event_payload": {
"created_at": 1717597241,
"event_name": "rc_initial_purchase_event",
"metadata": {
"app_id": "appb6012f26b7",
"entitlement": null,
"environment": "sandbox",
"expires_at": 1725546041,
"product_identifier": "prod_QCyCt8PLphAYgl",
"store": "STRIPE"
},
"user_id": "$RCAnonymousID:6948fc31576641ed98c9c171826ae506"
}
}

Here is the purchase event:

 

3 replies

Userlevel 4
Badge +6

Hello @ross-staszak-7f26c4 ,

 

This is likely because the event is being sent with the original anonymous ID that is first created when the user first opens the app, prior to the app user ID that you create being made. I would recommend setting the app user ID prior to the purchase so this app user ID is sent with the Intercom event as well as the Stripe purchase! 

Badge +3

Hi @Michael Fogel 

These are stripe transactions happening via our web app.  As far as I know there is no web SDK that works outside of RevenueCat Billing.  

Our backend is what calls the RevenueCat receipts API with the user id as described here: https://www.revenuecat.com/docs/web/stripe#5-send-stripe-tokens-to-revenuecat

When you recommend setting the app user id, how do you recommend this is done in a stripe flow in which our backend is calling RevenueCat receipts API? 

As you can see in the above screenshot, RevenueCat gets the app user id, it’s only that it uses an anonymous ID when calling Intercom.

Thanks!

  • John
Userlevel 5
Badge +9

Hi @ross-staszak-7f26c4,

Apologies for the delay. Aliases are expected in general RevenueCat operation, but the specifics depend on your implementation. Aliases are more common on mobile than on the web. It looks like the original c4080438-c0a1-7003-9dc1-2cd0c23183b1 user was created on 2024-06-03 19:22:59.850553 and the alias $RCAnonymousID:6948fc31576641ed98c9c171826ae506 was created on 2024-06-05 14:20:45.235528. I also see a mix of App Store and Stripe purchases for this customer. What I believe happened is this:

  1. You created the initial user c4080438-c0a1-7003-9dc1-2cd0c23183b1 on the mobile device.
  2. You later sent a Stripe purchase for this user.
  3. At some point in the mobile app you generated an anonymous ID, possibly by deleting and reinstalling the app.
  4. When you logged in with the initial user on the device or restored purchases, the anonymous user ID aliased with the initial user ID.

It’s tough to know for sure the exact flow from just that event and screenshot so it’s possible you took a different set of steps to arrive at the same state, but it most likely includes some interaction between the mobile device and the web purchase.

I’d recommend testing again and noting down each step taken that results in this, then we can figure out how to avoid this series of steps.

We do have a guide that explains how to never have anonymous user IDs that you can refer to: https://www.revenuecat.com/docs/customers/user-ids#how-to-only-use-custom-app-user-ids

Reply