Setup Stripe webhook


I like to move my stripe-webhook to mongodb. Currently I have a nodejs server where I can get the raw body from the request like (because stripe needs the raw request body)’/webhook’, bodyParser.raw({ type: ‘application/json’ }), (request, response)

Is it possible to get the raw body request somehow in a mongodb webhook?


1 Like

Do these docs help - ?
Sounds like you may want to use one of the parse functions.

hm sadly not. Non of them were successfully.

the raw body on my nodejs application was like:

<Buffer 7b 0a 20 20 22 63 72 65 61 74 65 64 22 3a 20 31 33 32 36 38 35 33 34 37 38 2c 0a 20 20 22…

and stripe error is like:

“Webhook Error: No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?

Hi @rouuuge.

For some general examples of working with Stripe from Realm. you could take a look at this eCommerce app that I built a while back: For example, this function creates a Stripe checkout session:

The frontend (Vue.js) app is here:


hi andrew, thx for the example! Good to know that at least the stripe api seems to work! But for me its not really a option, because I use the UI-Forms directly from Stripe directly:

to get data into mongodb I need their webhook. Of course I could run a own nodejs server like now. But I would like ot move as much code as possible to the same place.

1 Like

Did anyone know how to get the raw request body?

Stripe Webhook does need it, I have the same error as @rouuuge


You need to parse the Stripe webhook event as raw data. Usually, everyone have JSON parser before any router defined:


Express executes code from top to bottom. That means that express.json() will be called before express.raw({ type: 'application/json'}) defined in the /webhook endpoint.

So, all you have to do is to move /webhook endpoint before defining express.json() parser.'/webhook', express.raw({ type: 'application/json' }), (req, res) => {


Thanks, that works for NodeJS directly, sorry I meant on Realm Functions. There looks like no way to get the raw response data on Realm Functions.

1 Like

Hi… im having the same problem. Were you able to solve this using realm functions?