Examples
Webhook Handler
Verify and handle FloPay webhook events using the @flopay/node server SDK.
Use the @flopay/node SDK to verify webhook signatures and handle payment events in your server. The FloPay.webhooks.constructEvent method validates the payload against the Stripe webhook signing secret.
Event Structure
The constructEvent method returns a WebhookEvent with the following shape:
Important Notes
- Always verify the webhook signature before processing events. Never trust raw payloads.
- Use the raw request body (
request.text()) for signature verification -- parsed JSON will not match the signature. - Set your webhook endpoint URL in the Stripe dashboard and note the signing secret.
- Return a
200response promptly. Move heavy processing to a background job to avoid webhook timeouts.