Sovgate sends an event to your server each time something happens in your account, such as checkout.session.completed when a customer pays. Add the endpoint, the https address on your server, in the Dashboard under Developers › Webhooks, and choose the event types it listens to. Endpoints are written only in the Dashboard: a key can read them.
What arrives
Each delivery is a POST with one event as its JSON body. An event is thin: it names what happened and the object it's about, never the object's data.
Treat it as a notice: fetch the object with the API and act on its current state.
Check the signature
Every delivery carries a Sovgate-Signature header: t, when the attempt started in Unix seconds, and one v1 signature for each signing secret in use.
Read the raw body
Before any parsing: a body parsed and written out again no longer matches.
Compute the signature
An HMAC-SHA256, keyed with the endpoint's signing secret, of t, a full stop, and the raw body. In hex.
Compare
Accept the delivery if any v1 matches, compared in constant time. Ignore a signature scheme you don't know: use only the v1 values.
Check the time and the mode
Refuse a t older than 5 minutes, or more than 1 minute in the future. If one address serves both modes, check livemode.
Reveal or roll an endpoint's signing secret in the Dashboard. While a roll overlaps, each delivery carries a signature from both secrets.
Answer fast
Answer with a 2xx within 15 seconds, then do the work. Anything else, or no answer in time, is a failed attempt. A 3xx is a failure too: redirects are never followed.
| Topic | What happens |
|---|---|
| Retries | A failed attempt is retried after about 5 seconds, 5 minutes, 30 minutes, then 2, 5, 10, 14, 20 and 24 hours: 10 attempts over about 3 days. In test mode, 4 attempts. |
| Pauses | A 429, 502, 503, 504 or a timeout pauses deliveries to the endpoint for a minute. A Retry-After is followed, within bounds. |
| Disabling | An endpoint failing for 120 hours is disabled. A 410 answer disables it at once. |
| Resending | From the Dashboard, for up to 15 days. |
Repeats and order
Delivery is at least once, and order isn't promised: retries, resends and recoveries all reorder events.
- Store each event's
idonce you've handled it, and ignore an ID you've seen: a repeat carries the same ID. - Don't assume two events about one object arrive in the order they happened.
- Make the work itself safe to repeat.
You can always list your events and fetch the objects, whatever reached your endpoint.
Event types
| Resource | Events |
|---|---|
| Payments | payment.authorized, payment.succeeded, payment.captured, payment.failed, payment.canceled, payment.expired, payment.refunded |
| Checkout sessions | checkout.session.completed, checkout.session.expired |
| Refunds | refund.created, refund.succeeded, refund.failed, refund.updated |
| Disputes | dispute.created, dispute.funds_withdrawn, dispute.updated, dispute.closed, dispute.funds_reinstated |
| Early fraud warnings | early_fraud_warning.created, early_fraud_warning.updated |
| Invoices | invoice.created, invoice.updated, invoice.send_blocked, invoice.sent, invoice.reminder_sent, invoice.viewed, invoice.payment_succeeded, invoice.paid, invoice.overdue, invoice.canceled |
| Subscriptions | subscription.created, subscription.updated, subscription.billed, subscription.payment_succeeded, subscription.payment_failed, subscription.payment_recorded, subscription.period_voided, subscription.past_due, subscription.paused, subscription.resumed, subscription.canceled, subscription.ended |
| Payment links | payment_link.created, payment_link.updated, payment_link.activated, payment_link.deactivated, payment_link.archived |
| Catalog | product.created, product.updated, price.created, price.updated, price.deleted, coupon.created, coupon.updated, promotion_code.created, promotion_code.updated, shipping_rate.created, shipping_rate.updated, tax_rate.created, tax_rate.updated |
| Usage | telemetry.created, telemetry.updated, telemetry.deactivated, telemetry.reactivated, usage_alert.created, usage_alert.updated, usage_alert.triggered, credit_grant.created, credit_grant.applied, credit_grant.updated |
| Payouts | payout.created, payout.updated, payout.paid, payout.failed, payout.canceled, bank_account.created, bank_account.updated, bank_account.deleted |
| Webhook endpoints | webhook_endpoint.ping, the test event |
A restricted key sees only the events of resources it can read. New event types can be added at any time: ignore a type you don't handle.