Skip to main content
Solved

Set email metadata from stripe purchase link


Forum|alt.badge.img

Hello, the flow I’m trying to implement is the following:

  • ✅ user might or might not have downloaded and logged in on the app
  • ✅ user visits my website and by following a stripe payment link they purchase a subscription through a stripe checkout session
  • ✅ stripe sends the purchase to revenuecat through server to server notifications
  • ✅ revenuecat creates an anonymous user with an anonymous user id
  • ✅ user gets in the app, logs in with their email (same email as they used for stripe)
  • ⚠️ what i’d want to do at this point: call loginUser with revenuecat, a user with the same email is found and they have a stripe subscription attached, in the app i get identified as that user and with access to the revenuecat offering.

i think there are two blockers i’m not finding a solution for:

  1. revenuecat is not setting the email field in the user metadata (of the anonymous user it creates) when it receives the server to server notification, this is somewhat necessary because it’s the only way i have to connect the user identity that purchased to the one that logs in the app
  2. i should login the user (for revenuecat) primarily based on the email, or just find a way to merge the two identities (the one created at stripe subscription time, and the one created at app user login time)

am i missing something? is it possible to do this through server 2 server notifications only? or do i need to implement some custom webhooks that make this connection?

i’d really love to do this as automated as possible, i hope there’s a way 🤞

thank you a lot in advance for your patience and help! 

Best answer by kaitlin

Hey ​@Alberto Giunta,

As you said, the only way to dynamically set an app user id for Stripe through server notification is via the metadata field. Additionally, we don’t generally recommend using email addresses as the app user id as it can be more guessable and potentially against GDPR compliance.

You’ll likely need an additional call somewhere to get more information into RevenueCat in order to allow your users to be identified across your website and your app. For example, after the user purchases through your payment link, you could send an additional call to POST /receipts with the fetch token from the purchase and the user ID that you’d like the user to be identified by. This would alias the anonymous id and your custom id on our end, then you could use this custom id to log in the user in the app if they do make an account. 

View original
Did this post help you find an answer to your question?

3 replies

Forum|alt.badge.img

More about this after diving deeper into it: ideally, what i’d want is to setup the stripe app in a way that in the “App User ID detection method” i could use the email that the user used to purchase the subscription from the stripe payment link.

in the app i could then identify the users with their logged email, and the two identities would match/be joined based on email (of course, the two emails would need to be the same)

thing is that revenuecat can read from the stripe metadata field only, making it impossible (i think) to use stripe payment links, because in stripe payment links you can’t dynamically put the email the user used to purchase in the metadata field.

my specific use case (which i understand is stretching a bit the use case of this feature) is that i need to use stripe payment links because random/anonymous users could visit a website,  purchase subscriptions using stripe payment links, and then create an account into the app, and automatically be pro users as a result.

thank you A LOT to anyone that is willing to help!


Forum|alt.badge.img

cc ​@guilherme, sorry to bother you, just to understand if you guys have any input on this? 


kaitlin
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 405 replies
  • Answer
  • June 9, 2025

Hey ​@Alberto Giunta,

As you said, the only way to dynamically set an app user id for Stripe through server notification is via the metadata field. Additionally, we don’t generally recommend using email addresses as the app user id as it can be more guessable and potentially against GDPR compliance.

You’ll likely need an additional call somewhere to get more information into RevenueCat in order to allow your users to be identified across your website and your app. For example, after the user purchases through your payment link, you could send an additional call to POST /receipts with the fetch token from the purchase and the user ID that you’d like the user to be identified by. This would alias the anonymous id and your custom id on our end, then you could use this custom id to log in the user in the app if they do make an account. 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings