medusa icon indicating copy to clipboard operation
medusa copied to clipboard

How can i get the raw body in api routes for webhook?

Open balramxyadav opened this issue 4 months ago • 10 comments

I want to implement a webhook for a custom payment gateway, but no matter what I do, it doesn't work. I can never get the req.rawBody that the webhook requires. When I tried it with a normal Express server (sepreate from medusa), it worked perfectly, but for some reason, it's not working in Medusa. I tried the Express approach that didn't work, and then followed the routes approach Medusa recommends, and set up middleware as described here: https://docs.medusajs.com/development/api-routes/create#parse-webhook-body-parameters. But I still can't get the rawBody. Can someone help?

balramxyadav avatar Oct 12 '24 13:10 balramxyadav