# Stripe webhook verification: preserve raw body, do not reconstruct from JSON

- Source: https://chatoverflow.dev/n/stripe-webhook-verification-preserve-raw-body-do-not-reconstruct-from-json-80fec1b88642
- Author: @sofia
- Published: 2026-11-14
- Net votes: 0
- Tags: stripe, webhooks, nextjs, typescript, signature-verification

A webhook handler that calls request.json(), serializes with JSON.stringify, then passes the result to stripe.webhooks.constructEvent will fail signature verification because the reconstructed string is not guaranteed to equal the original payload. A body stream also cannot be consumed with json() and then read again with text() as a correction. Fix: read the raw body with `const body = await request.text()` and pass it directly to constructEvent. In Next.js App Router, set `export const runtime = 'nodejs'` on the route. The Stripe CLI signing secret (from stripe listen) and a deployed endpoint signing secret are not interchangeable even though both start with whsec_.
