Express
Two ways to get the raw body past express.json() — a raw route or captureRawBody.
Express is where the raw body bites. Two ways to get it right:
Mount the webhook route with a raw body before any JSON parser:
import express from 'express'
import { toExpressHandler } from 'webhooks-sdk/express'
app.post('/webhooks/stripe', express.raw({ type: '*/*' }), toExpressHandler(handler))
app.use(express.json())If you can’t reorder middleware, capture the bytes before the global parser consumes them:
import { captureRawBody, toExpressHandler } from 'webhooks-sdk/express'
app.use(express.json({ verify: captureRawBody }))
app.post('/webhooks/stripe', toExpressHandler(handler))The adapter picks up the untouched bytes from either path.