By default, Flowglad acts as your product’s source of truth for all billing data and feature access. You should only use it when another system must be told that a Flowglad billing event occurred.
When to use webhooks
Usually you only need webhooks when you want to trigger a workflow in response to a billing-related event.- Starting or terminating background services in response to billing events, e.g. shutting down a VPS when a subscription cancels
- Automated notifications
- What plan your customer has subscribed to
- What features your customer gets based on their subscription
- Whether your customer is subscribed to a paid plan
- What usage credits your customer has access to
useBilling, flowgladServer.getBilling, or customers/:externalId/billing payload.
This significantly reduces bugs related to synchronization of state between Flowglad (your payment processor), and your application.
How deliveries work
Flowglad records every billing-related change as an event, stores it durably, and then fans it out to each active webhook subscription that opted into that event type. Deliveries are sent separately in test and live mode, respect thefilterTypes you set on the webhook, and are retried automatically whenever your endpoint responds with a non-2xx status.
Available events
You can subscribe to any combination of the following event types:customer.createdcustomer.updatedpurchase.completedpayment.failedpayment.succeededsubscription.createdsubscription.updatedsubscription.canceled
Payload structure
Each webhook delivery contains:eventType: one of the values listed above.eventId: a unique identifier you can use for idempotency.livemode:truefor production data,falsefor test data.timestamp: ISO 8601 string describing when Flowglad recorded the event.data: the event payload. Every payload includes a stable object reference plus the Flowglad customer (when available).
payment.succeeded delivery:
Delivery behavior
- At-least-once semantics: duplicate deliveries can occur after retries. Use
eventId(and, if desired, the combination ofeventType+ object ID) to ensure idempotent processing. - Automatic retries: Flowglad retries for several hours with exponential backoff whenever your endpoint returns a 3xx, 4xx, or 5xx response, or times out.
- Timeouts: endpoints must respond within 10 seconds; otherwise the attempt is retried.
- Separate environments: test-mode webhooks never receive live data. Publish a dedicated endpoint URL if you need to exercise both environments.
Managing webhooks
Dashboard
- Go to your organization’s Settings page.
- Select the API tab, and then Create Webhook.
- Provide a descriptive name, HTTPS URL, and the event types you want.
- Toggle the
Activeswitch on or off to receive or pause deliveries. - Copy the signing secret that appears after creation. If you misplace it, you can rotate or re-fetch the secret from the overflow menu.
API
You can also retrieve and manage webhooks via the API.Secrets & verification
Every webhook has a unique signing secret per environment. Flowglad sends three headers with every delivery:svix-webhook-id: unique attempt identifier.svix-webhook-timestamp: Unix timestamp (seconds) when the attempt started.svix-webhook-signature: HMAC SHA-256 signature computed over<timestamp>.<raw-body>using your secret, hex encoded.
You must use the raw request body when verifying webhooks, as even small changes will change the cryptographic signature. If you use a server framework that automatically parses JSON payloads, turn off this setting for your webhook route in order to access the raw request body.