Guides
Webhooks
Verify and handle payment webhooks with the FloPay Node SDK.
Webhooks
The @flopay/node SDK provides webhooks.constructEvent to verify Stripe webhook signatures and parse event payloads.
Setup
You need:
- A Stripe webhook endpoint secret (
whsec_...) - The raw request body (as a string or Buffer -- not parsed JSON)
- The
Stripe-Signatureheader from the incoming request
Next.js API Route Example
You must read the request body as raw text (request.text()), not parsed JSON. Stripe signature verification requires the exact bytes that were sent. If your framework parses the body automatically, configure it to skip parsing for your webhook route.
Express Example
Testing Locally
Use the Stripe CLI to forward events to your local server:
The CLI prints a webhook signing secret (whsec_...) to use during development.