Skip to main content
Answer

Forward Metadata from Strip to RevenueCat Webhooks

  • August 20, 2025
  • 5 replies
  • 168 views

Forum|alt.badge.img+7

Hello,

I am wondering if it is possible for stripe checkout metadata to be propagated from the revenue cat webhooks that get sent to my server. I understand how we can set the app_user_id ( a combination of setting the metadata in checkout.sessions.create ) but is is possible to set other metadata on the stripe session that will propagate to my server? This feature would be useful in cases where the I have a ton of different products and I could link it the db identifier on my end to avoid looking up the product from stripes api.

Thanks!

Best answer by jeffrey_bunn

@Carl Reiser Yes, attributes will be overwritten if the same flow is followed, which doesn’t really help in the flow you’re looking to create. I have shared the request to pass along Stripe Checkout metadata to integrations/webhooks with our product team. 

 

The reason why I care about any of this is I am trying to know the price_id from stripe, not the product_id. It is nice that the product_id comes in from the webhooks from RC but that doesnt tell me which specific offering within that product was purchased… So I am forced to have only one offering within my product from stripe, which is not ideal

That makes sense. This is probably rough, but would you be able to know by the price paid? 

 

Also, if I post receipts like this to revenue cat, will a webhook for the INITIAL_PURCHASE of the subscription be sent from RC?

Yes, the initial_purchase webhook will be triggered for a new purchase posted to us.

 

I am also wondering, since it isn’t clear to me in the docs - if we should not listen to customer.subscription.created and checkout.session.completed in the direct stripe → rev cat “server to server” architecture. I’d imagine in the flow I am building that there would be a race condition between my server listening to that + updating the customer attributes and RC’s server getting the events and generating the webhook “before” I am able to update customer attributes?

Please ensure you have Stripe server notifications enabled, but importantly, do not enable “Track new purchases from server-to-server notifications”. The latter option will result in us creating the purchase in RevenueCat, while the former will not process Stripe server notifications if the purchase has not already been posted to us by you.

 

I think if RC had an option to just forward stripe metadata to their webhooks to our servers this problem would get a lot easier from a developers perspective.

100%. Hopefully we can support this in the near future.

Please let me know if you have additional questions. Thanks, Tony!

This post has been closed for comments

5 replies

jeffrey_bunn
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • August 20, 2025

Hi ​@Carl Reiser! This isn’t currently possible. However, what you can do is first send the additional data as customer attributes. Then send us the Stripe token, which we’ll associate with the (previously created) customer, and kick off webhooks, which will include customer attributes. The flow will look like the following;

  1. When the customer makes their purchase, create the customer via API if they haven’t yet been identified by your app.
  2. Set the relevant customer attributes via API
  3. POST the Stripe purchase to us (and include app_user_id in the metadata fields)
  4. When we send webhooks, we’ll include the customer attributes set in step 2.

More information is available here. Please let me know if you have additional questions!


Forum|alt.badge.img+7
  • Author
  • Active Member
  • August 21, 2025

@jeffrey_bunn So I am still a little confused on how this should all work.

This is the flow as I understand it:
Let’s say I have a server that is running that receives the customer.subscription.created or checkout.session.completed webhook from stripe. In this server, when I receive either of these events, I will get the app_user_id metadata field that I set in the stripe checkout session. With this app_user_id, I will then get / create the customer on RC’s end using standard RC api. Then I will update that customer’s attributes via the /attribtues call. Here I can set custom attributes such as “lastStripePriceIdSeen” and “lastStripeProductIdSeen” ids. This metadata will be saved on the customer and returned by future webhooks. Here is a relevant code snippet to describe what I am talking about.
 

async postStripeReceipt(event: Stripe.Event, isSandbox: boolean) {
const bearerTkn = isSandbox
? this.environment.revenueCatStripeSandboxPublicApiKey
: this.environment.revenueCatStripePublicApiKey;

const appUserId = (event.data.object as any).metadata.app_user_id;
const priceId = (event.data.object as any).plan.id;
const productId = (event.data.object as any).plan.product;
// update the customer attributes to have this specific priceid

try {
// get or create the customer
await axios.get(`https://api.revenuecat.com/v1/subscribers/${appUserId}`, {
headers: { Authorization: `Bearer ${this.environment.revenueCatApiKey}` },
});

const body = {};
body[productId] = priceId;
// update the customerAttributes
await axios.post(`https://api.revenuecat.com/v1/subscribers/${appUserId}/attributes`, body, {
headers: { Authorization: `Bearer ${this.environment.revenueCatApiKey}` },
});
} catch (err) {}

try {
// clone headers and override host

await axios.post(
`https://api.revenuecat.com/v1/receipts`,
{
app_user_id: appUserId,
},
{
headers: {
Authorization: "Bearer " + bearerTkn,
},
}
);

this.logger.infoV2(`Successfully posted Stripe receipt to RevenueCat`);
} catch (err) {
this.logger.errorV2(`Failed to forward Stripe event to RevenueCat`, {
error: err,
});
}
}



This is where the confusion comes in - this still isn’t bound to the particular subscription flow right? For example, if that customer then goes and purchases a different subscription, won’t these fields get globally overwritten? The reason why I care about any of this is I am trying to know the price_id from stripe, not the product_id. It is nice that the product_id comes in from the webhooks from RC but that doesnt tell me which specific offering within that product was purchased… So I am forced to have only one offering within my product from stripe, which is not ideal. Also, if I post receipts like this to revenue cat, will a webhook for the INITIAL_PURCHASE of the subscription be sent from RC?

I am also wondering, since it isn’t clear to me in the docs - if we should not listen to customer.subscription.created and checkout.session.completed in the direct stripe → rev cat “server to server” architecture. I’d imagine in the flow I am building that there would be a race condition between my server listening to that + updating the customer attributes and RC’s server getting the events and generating the webhook “before” I am able to update customer attributes?

I think if RC had an option to just forward stripe metadata to their webhooks to our servers this problem would get a lot easier from a developers perspective.

Thanks, I hope this makes sense!
- Tony
 


jeffrey_bunn
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • Answer
  • August 28, 2025

@Carl Reiser Yes, attributes will be overwritten if the same flow is followed, which doesn’t really help in the flow you’re looking to create. I have shared the request to pass along Stripe Checkout metadata to integrations/webhooks with our product team. 

 

The reason why I care about any of this is I am trying to know the price_id from stripe, not the product_id. It is nice that the product_id comes in from the webhooks from RC but that doesnt tell me which specific offering within that product was purchased… So I am forced to have only one offering within my product from stripe, which is not ideal

That makes sense. This is probably rough, but would you be able to know by the price paid? 

 

Also, if I post receipts like this to revenue cat, will a webhook for the INITIAL_PURCHASE of the subscription be sent from RC?

Yes, the initial_purchase webhook will be triggered for a new purchase posted to us.

 

I am also wondering, since it isn’t clear to me in the docs - if we should not listen to customer.subscription.created and checkout.session.completed in the direct stripe → rev cat “server to server” architecture. I’d imagine in the flow I am building that there would be a race condition between my server listening to that + updating the customer attributes and RC’s server getting the events and generating the webhook “before” I am able to update customer attributes?

Please ensure you have Stripe server notifications enabled, but importantly, do not enable “Track new purchases from server-to-server notifications”. The latter option will result in us creating the purchase in RevenueCat, while the former will not process Stripe server notifications if the purchase has not already been posted to us by you.

 

I think if RC had an option to just forward stripe metadata to their webhooks to our servers this problem would get a lot easier from a developers perspective.

100%. Hopefully we can support this in the near future.

Please let me know if you have additional questions. Thanks, Tony!


  • New Member
  • September 8, 2025

@Carl Reiser Yes, attributes will be overwritten if the same flow is followed, which doesn’t really help in the flow you’re looking to create. I have shared the request to pass along Stripe Checkout metadata to integrations/webhooks with our product team. 

 

Hi, Is there any way to track progress or decision that was made by the product team?

Thanks!


jeffrey_bunn
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • September 12, 2025

@Bumblebee Hi! At this time, we don’t have a way to track this, unfortunately. But it’s definitely under consideration. Thanks!