Webhooks (Endpoints)
Webhooks let Sangho notify your server in real time when important events occur — a successful payment, a refund issued, a subscription canceled, and so on. Rather than polling the API, your server receives an HTTP POST request as soon as the event occurs.
Each webhook endpoint listens to a configurable list of events and has its own HMAC-SHA256 signing secret. See the Events reference for the complete list of available types.
Every webhook request includes a Sangho-Signature header.
Always verify this HMAC-SHA256 signature before processing the event — this
guarantees that the request genuinely comes from Sangho and not from a malicious
third party. See the signature verification guide.
Available events
| Event | Trigger |
|---|---|
payment_intent.succeeded | PaymentIntent moved to succeeded status. |
payment_intent.failed | PaymentIntent moved to canceled status after failure. |
transaction.succeeded | Transaction created and completed. |
refund.succeeded | Refund returned to the buyer. |
refund.failed | Refund failed on the operator's side. |
invoice.paid | Invoice paid. |
invoice.payment_overdue | Due date passed without payment. |
checkout.session.completed | CheckoutSession moved to complete status. |
subscription.created | New subscription created. |
subscription.canceled | Subscription canceled. |
subscription.payment_failed | Renewal attempt failed. |
customer.created | New Customer created. |
customer.deleted | Customer deleted. |
Endpoints
| Méthode | Endpoint | Description |
|---|---|---|
| POST | /webhooks/ | Create a webhook endpoint |
| GET | /webhooks/ | List endpoints |
| GET | /webhooks/{id}/ | Retrieve an endpoint |
| PATCH | /webhooks/{id}/ | Update an endpoint |
| DELETE | /webhooks/{id}/ | Delete an endpoint |
| POST | /webhooks/{id}/disable/ | Disable (suspend deliveries) |
| POST | /webhooks/{id}/enable/ | Re-enable a disabled endpoint |
| POST | /webhooks/{id}/roll-secret/ | Regenerate the signing secret |
| POST | /webhooks/{id}/test/ | Send a test event |
| GET | /webhooks/{id}/deliveries/ | Delivery logs |
| POST | /webhooks/{id}/deliveries/{did}/retry/ | Retry a failed delivery |
Object schema
Create a webhook endpoint
Registers a new URL to which Sangho will send the selected events. The HMAC signing secret is returned only once at creation time — store it immediately in your secrets manager.
nameRequisDescriptive name for the endpoint. Shown in your dashboard — use a name that clearly identifies the environment or purpose.
Max 255 characters. A good name includes the environment and functional scope,
for example “Production — payments & subscriptions” or “Staging — all events”.
urlRequisURL of your webhook endpoint. Must be publicly accessible over HTTPS. Sangho performs a validation ping at creation.
The URL must respond with a 2xx HTTP status code within 10 seconds to be validated. For local testing, use a tunnel such as ngrok or localtunnel.
eventsRequisList of event types to listen for on this endpoint. Use [“*”] to receive all events.
Prefer an explicit list rather than “*” to reduce the
volume of requests hitting your server and to simplify debugging. Each endpoint
can listen to up to 50 distinct event types. See the events reference
for the complete list.
security_profileOptionnelMethod used to sign webhook requests.
En savoir plus
Values: HMAC_SHA256 (recommended — Sangho-Signature header), JWT (signed
JWT token in the Authorization header), BASIC (Basic Auth —
not recommended in production). See the signature guide for
implementation details.
ssl_verificationOptionnelEnables SSL certificate verification for your endpoint.
En savoir plus
Only disable ssl_verification in a development environment
with a self-signed certificate. In production, always keep this option set to true.
retry_policyOptionnelRetry policy for delivery failures (timeout, 5xx error).
En savoir plus
Object with two fields: max_attempts (default: 5, max: 10)
and backoff_type (exponential or linear, default: exponential). With
exponential backoff, retries happen at 1 min, 5 min, 30 min, 2 h, 8 h. With linear: every 30 minutes.
metadataOptionnelFree-form data associated with the endpoint — environment, owning team, etc.
The secret field returned at creation will never be shown
again. Store it immediately in your secrets manager (environment variable, Vault, AWS
Secrets Manager, etc.). If you lose it, generate a new one via POST /webhooks/{id}/roll-secret/.
Create an endpoint
Verify the signature
With every delivery, Sangho computes an HMAC-SHA256 signature of the request body
using your secret and includes it in the Sangho-Signature
header. You must recompute this signature on your server and compare it using a
method resistant to timing attacks.
The signature is computed on the raw body of the request, before
any JSON parsing. In Express.js, configure express.raw({ type: 'application/json' })
on the webhook route — don’t use express.json(), which
would transform the body.
Managing deliveries
The GET /webhooks/{id}/deliveries/ endpoint returns the
history of delivery attempts for a given endpoint. If a delivery fails, you can
retry it via POST /webhooks/{id}/deliveries/{did}/retry/.
Your endpoint must return a 200 within 10 seconds.
For long-running processing (sending an email, calling a third-party service), queue
the task (Celery, Bull, Sidekiq, etc.) and respond immediately. Past this delay,
Sangho considers the delivery failed and triggers the retry policy.