DOCS Live

The basics

Receiving webhooks

Register an endpoint, verify every signature, answer quickly, and catch up on anything you missed.

KulPay tells you when something happens (a payment succeeded, a deposit was credited, a payout returned) by posting a signed event to your HTTPS endpoint. Webhooks wake you up; the API is the truth. Read the object back when the decision matters.

Before you start

The flow at a glance

#WhoWhat happens
1Your teamRegisters an endpoint and the event types it wants, and stores the signing secret.
2KulPayPosts each event, signed, retrying on failure for 24 hours.
3Your systemVerifies the signature, records the event ID, answers 2xx, then processes it.
4Your systemCatches up on anything missed through the events API.

1. Register an endpoint

Your team.

POST /v1/webhook-endpoints · API reference

Subscribe to exact types (payment.succeeded), families (payment.*) or everything (leave event_types out). An endpoint belongs to the key's mode. contacts are told when deliveries keep failing. The answer holds the signing secret once.

Request

{
  "url": "https://shop.example.co.mz/kulpay/webhooks",
  "event_types": [
    "payment.*",
    "refund.*"
  ],
  "contacts": [
    "ops@shop.example.co.mz"
  ]
}

Response

{
  "id": "3KUXQ43bztiuf9tCMNgbcrYvne3",
  "mode": "live",
  "url": "https://shop.example.co.mz/kulpay/webhooks",
  "enabled": true,
  "status": "active",
  "event_types": [
    "payment.*",
    "refund.*"
  ],
  "contacts": [
    "ops@shop.example.co.mz"
  ],
  "secret": "whsec_…",
  "created_at": "2026-10-22T09:30:00Z"
}

2. Verify every delivery

Your system, for every request it receives.

Each delivery carries KulPay-Signature: t=<unix time>,v1=<hex>. Compute HMAC-SHA256 of t + "." + raw body with your secret and compare it, in constant time, with each v1 value (during a secret roll there are two). Refuse a delivery whose t is more than 5 minutes from your clock. Use the raw body: parsing and re-serialising JSON changes the bytes. Verification code in several languages is in the integration guide.

Optionally, deliveries can also carry an Ed25519 signature (v1e=) you verify with KulPay's public key from /.well-known/kulpay-webhook-keys.

3. Answer fast, then process

Your system.

Answer 2xx as soon as the signature checks and the event is recorded; do the work afterwards. Events can arrive more than once and out of order: keep the event id and ignore one you have seen; for state, read the object back through the API.

A failed delivery is retried 1 min, 5 min, 15 min, 1 h, 3 h, 8 h and 24 h after the first attempt (10 seconds each). After the last failure it is dead-lettered and your contacts are alerted. A 410 answer disables the endpoint, as do three days running of dead-lettered deliveries.

4. Test the endpoint

Your team.

POST /v1/webhook-endpoints/{id}/test · API reference

Sends a signed webhook_endpoint.tested event through the normal delivery path, so you see your verification work end to end. GET /v1/webhook-endpoints/{id}/deliveries shows each delivery's status, attempts, answer and latency.

5. Catch up and replay

Your system or your team, after an outage.

GET /v1/events · API reference

GET /v1/events?since=<last event id you processed> returns every later event, oldest first (since= with no value starts from the beginning). Or queue the deliveries again with POST /v1/webhook-endpoints/{id}/replay (the last 30 days, or only the dead-lettered ones).

6. Roll the signing secret

Your team, periodically or when it may have leaked.

POST /v1/webhook-endpoints/{id}/roll-secret · API reference

A new secret, shown once; the old one keeps signing for the grace period (default 24 hours), so each delivery carries a v1= for each. Deploy the new secret, then let the old one lapse.

Request

{
  "grace": "24h"
}

Events

EventWhat it tells you
webhook_endpoint.tested

The test delivery.

webhook_endpoint.disabled

The endpoint was disabled (a 410, or three days of failures). Fix it and enable it again.

Errors that matter here

Every error is application/problem+json with a stable code; branch on the code, not the message. The full list is in the error catalogue.

ErrorWhenWhat to do
400 invalid_request

The URL is not an absolute https URL, carries credentials, or points at a private or reserved address.

Use a public https URL.

403 insufficient_scope

The key lacks webhooks:manage or webhooks:replay.

Use a key with the scope.

Testing it

Register a test-mode endpoint, send the test event and check your verification accepts it. Then change one byte of the body your code verifies, or the secret, and check it refuses.


All flows · API reference · Error catalogue