Webhooks
Receive real-time HTTP notifications when events occur in your account. When an event fires, we POST a signed JSON payload to your endpoint URL.
Event types#
Subscribe to the events you need. Each endpoint can listen to one or more:
| Event | Trigger |
|---|---|
transfer.executed | Fires when an outgoing transfer is executed |
payment_link.paid | Fires when a payment link receives a payment |
payment_link.payment_settled | Fires when the provider settles a payment link payment |
checkout_session.completed | Fires when a checkout session payment completes |
checkout_session.settled | Fires when the provider settles a checkout session payment |
payment_link.refunded | Fires when a refund of a payment link payment completes |
payment_link.charged_back | Fires when the payer's bank takes a payment link payment back (a chargeback lost or accepted) |
payment_link.dispute_opened | Fires when the payer's bank opens a dispute on a payment link payment (South Africa only) |
checkout_session.refunded | Fires when a refund of a checkout session payment completes |
checkout_session.charged_back | Fires when the payer's bank takes a checkout session payment back (a chargeback lost or accepted) |
checkout_session.dispute_opened | Fires when the payer's bank opens a dispute on a checkout session payment (South Africa only) |
test.ping | Manual test event sent from the dashboard (not subscribable) |
payment.authorization_requested | Sent only to an endpoint enrolled for transfer authorization, with a copy to manza listen --authorizer (not subscribable) |
checkout_session.completed fires once the payer's payment is accepted and credited. In that payload the session status is usually clearing (or already complete if settlement landed first): fulfill on the event itself, not on the status. checkout_session.settled follows once the provider settles the funds.
The refund, chargeback and dispute events carry the payment link or checkout session as its other events do, with reversed_amount (what completed refunds and chargebacks took back so far), plus card_topup_id (the payment) and reversal: its id, kind (refund or chargeback), status (pending, completed or cancelled), amount, currency_code, occurred_at, completed_at and resolution (the acquirer's outcome when it gives one: merchant_accepted or auto_accepted for a chargeback taken, won for a dispute the merchant won, failed for a refund that did not go through; an outcome we do not map arrives as the acquirer sent it; else null). On a reusable link, card_topup_id and the checkout identifiers name the payment that was reversed. The reversal shows its state when the delivery was built, so a dispute_opened delivered after the dispute ended can already read completed. A dispute the merchant wins, and a Morocco chargeback the acquirer gives back after taking it, send no event: read reversed_amount on the payment link or checkout session for the current total. A refund cannot be started through the API.
Payload format#
Every webhook delivers a JSON payload with this structure:
data.transfer.payment_id identifies the originating payment and matches the id returned by POST /api/payments. It is null when the transfer has no linked payment. data.transfer.id remains the transfer ID.
{
"event": "transfer.executed",
"created_at": "2026-03-16T12:00:00Z",
"data": {
"transfer": {
"id": "01958e51-7c5a-7000-8000-000000000002",
"payment_id": "01958e51-7c5a-7000-8000-000000000001",
"amount": "2500.0",
"currency_code": "MAD",
"operation": "debit",
"status": "accepted",
"payment_reference": "PAY-2026-001",
"posted_at": "2026-03-16T11:58:00Z",
"created_at": "2026-03-16T11:55:00Z"
}
}
}{
"event": "payment_link.paid",
"created_at": "2026-03-16T12:00:00Z",
"data": {
"payment_link": {
"id": "01958e51-7c5a-7000-8000-000000000001",
"slug": "pay-invoice-42",
"amount": "1500.0",
"currency_code": "MAD",
"status": "clearing",
"title": "Invoice #42",
"description": "Invoice for January 2026",
"payment_reference": "REF-2026-001",
"link_type": "single",
"paid_at": "2026-03-16T11:59:00Z",
"settled_at": null,
"payments_count": 1,
"reversed_amount": "0.0",
"created_at": "2026-03-15T10:00:00Z",
"client_reference_id": "user-42",
"customer_email": "customer@example.com",
"customer_id": "usr-42",
"customer_name": "Alice Customer"
}
}
}{
"event": "payment_link.payment_settled",
"created_at": "2026-03-16T12:15:00Z",
"data": {
"payment_link": {
"id": "01958e51-7c5a-7000-8000-000000000001",
"slug": "pay-invoice-42",
"amount": "1500.0",
"currency_code": "MAD",
"status": "paid",
"title": "Invoice #42",
"description": "Invoice for January 2026",
"payment_reference": "REF-2026-001",
"link_type": "single",
"paid_at": "2026-03-16T11:59:00Z",
"settled_at": "2026-03-16T12:15:00Z",
"payments_count": 1,
"reversed_amount": "0.0",
"created_at": "2026-03-15T10:00:00Z",
"client_reference_id": "user-42",
"customer_email": "customer@example.com",
"customer_id": "usr-42",
"customer_name": "Alice Customer"
}
}
}{
"event": "checkout_session.completed",
"created_at": "2026-03-24T10:05:00Z",
"data": {
"checkout_session": {
"currency_code": "MAD",
"status": "clearing",
"metadata": {
"order_id": "ORD-123",
"user_id": "usr_456"
},
"customer_email": "customer@example.com",
"description": "Order #123",
"id": "cs_abc123def456",
"amount": "1500.0",
"reversed_amount": "0.0",
"completed_at": "2026-03-24T10:05:00Z",
"settled_at": null,
"created_at": "2026-03-24T10:00:00Z",
"transaction": {
"id": "01964a3b-7c8d-7000-8000-deadbeef1234",
"status": "accepted",
"currency_code": "MAD",
"payment_reference": "REF-2026-001",
"card_brand": "Visa",
"card_last_four": "4242",
"amount": "1500.0",
"fee_amount": "15.0",
"net_amount": "1485.0",
"provider_reference": "PAY-2026-001",
"account_transaction_id": "01964a3b-7c8d-7000-8000-feedface1234",
"processed_at": "2026-03-24T10:04:58Z",
"created_at": "2026-03-24T10:04:00Z",
"reversals": []
}
}
}
}{
"event": "checkout_session.settled",
"created_at": "2026-03-24T10:20:00Z",
"data": {
"checkout_session": {
"currency_code": "MAD",
"status": "complete",
"metadata": {
"order_id": "ORD-123",
"user_id": "usr_456"
},
"customer_email": "customer@example.com",
"description": "Order #123",
"id": "cs_abc123def456",
"amount": "1500.0",
"reversed_amount": "0.0",
"completed_at": "2026-03-24T10:05:00Z",
"settled_at": "2026-03-24T10:20:00Z",
"created_at": "2026-03-24T10:00:00Z",
"transaction": {
"id": "01964a3b-7c8d-7000-8000-deadbeef1234",
"status": "accepted",
"currency_code": "MAD",
"payment_reference": "REF-2026-001",
"card_brand": "Visa",
"card_last_four": "4242",
"amount": "1500.0",
"fee_amount": "15.0",
"net_amount": "1485.0",
"provider_reference": "PAY-2026-001",
"account_transaction_id": "01964a3b-7c8d-7000-8000-feedface1234",
"processed_at": "2026-03-24T10:04:58Z",
"created_at": "2026-03-24T10:04:00Z",
"reversals": []
}
}
}
}{
"event": "payment_link.refunded",
"created_at": "2026-03-28T09:30:05Z",
"data": {
"payment_link": {
"id": "01958e51-7c5a-7000-8000-000000000001",
"slug": "pay-invoice-42",
"amount": "1500.0",
"currency_code": "MAD",
"status": "paid",
"title": "Invoice #42",
"description": "Invoice for January 2026",
"payment_reference": "REF-2026-001",
"link_type": "single",
"paid_at": "2026-03-16T11:59:00Z",
"settled_at": "2026-03-16T12:15:00Z",
"payments_count": 1,
"reversed_amount": "1500.0",
"created_at": "2026-03-15T10:00:00Z",
"client_reference_id": "user-42",
"customer_email": "customer@example.com",
"customer_id": "usr-42",
"customer_name": "Alice Customer"
},
"card_topup_id": "01964a3b-7c8d-7000-8000-deadbeef1234",
"reversal": {
"id": "01964f10-2a3b-7000-8000-0badc0ffee01",
"kind": "refund",
"status": "completed",
"amount": "1500.0",
"currency_code": "MAD",
"occurred_at": "2026-03-27T08:15:00Z",
"completed_at": "2026-03-28T09:30:00Z",
"resolution": null
}
}
}{
"event": "checkout_session.charged_back",
"created_at": "2026-03-28T09:30:05Z",
"data": {
"checkout_session": {
"currency_code": "MAD",
"status": "complete",
"metadata": {
"order_id": "ORD-123",
"user_id": "usr_456"
},
"customer_email": "customer@example.com",
"description": "Order #123",
"id": "cs_abc123def456",
"amount": "1500.0",
"reversed_amount": "1500.0",
"completed_at": "2026-03-24T10:05:00Z",
"settled_at": "2026-03-24T10:20:00Z",
"created_at": "2026-03-24T10:00:00Z",
"transaction": {
"id": "01964a3b-7c8d-7000-8000-deadbeef1234",
"status": "accepted",
"currency_code": "MAD",
"payment_reference": "REF-2026-001",
"card_brand": "Visa",
"card_last_four": "4242",
"amount": "1500.0",
"fee_amount": "15.0",
"net_amount": "1485.0",
"provider_reference": "PAY-2026-001",
"account_transaction_id": "01964a3b-7c8d-7000-8000-feedface1234",
"processed_at": "2026-03-24T10:04:58Z",
"created_at": "2026-03-24T10:04:00Z",
"reversals": [
{
"id": "01964f10-2a3b-7000-8000-0badc0ffee01",
"kind": "chargeback",
"status": "completed",
"amount": "1500.0",
"currency_code": "MAD",
"occurred_at": "2026-03-27T08:15:00Z",
"completed_at": "2026-03-28T09:30:00Z",
"resolution": "merchant_accepted"
}
]
}
},
"card_topup_id": "01964a3b-7c8d-7000-8000-deadbeef1234",
"reversal": {
"id": "01964f10-2a3b-7000-8000-0badc0ffee01",
"kind": "chargeback",
"status": "completed",
"amount": "1500.0",
"currency_code": "MAD",
"occurred_at": "2026-03-27T08:15:00Z",
"completed_at": "2026-03-28T09:30:00Z",
"resolution": "merchant_accepted"
}
}
}Request headers#
| Header | Description |
|---|---|
Content-Type | application/json |
User-Agent | Manza-Webhook/1.0 |
X-Manza-Signature | HMAC-SHA256 signature for verification |
X-Manza-Timestamp | Unix timestamp of the request |
X-Manza-Event | Event type (e.g. transfer.executed) |
X-Manza-Event-Id | Unique event ID (UUID v7) |
X-Manza-Delivery-Id | Unique delivery ID (UUID v7) |
Manza-Webhook/1.0 on every delivery. If you allow-list by User-Agent rather than by signature, update that rule.Verifying signatures#
Every request is signed with your endpoint's signing secret using HMAC-SHA256. Concatenate the timestamp and raw request body separated by a dot, compute the HMAC, and compare with the X-Manza-Signature header using a constant-time comparison.
Then reject the request when its timestamp is more than 5 minutes off your clock, so a captured request cannot be replayed later. The official clients' verifiers use this 300-second tolerance by default. Inside that window a replay is still possible, so also skip any X-Manza-Event-Id you have already processed (see the retry policy below).
signature = request.headers["X-Manza-Signature"]
timestamp = request.headers["X-Manza-Timestamp"]
payload = request.raw_post
expected = OpenSSL::HMAC.hexdigest(
"SHA256", signing_secret, "#{timestamp}.#{payload}"
)
unless ActiveSupport::SecurityUtils.secure_compare(signature, expected)
head :unauthorized and return
end
# Reject a timestamp more than 5 minutes off: a replayed request.
head :unauthorized and return if (Time.now.to_i - timestamp.to_i).abs > 300const crypto = require("crypto");
const signature = req.headers["x-manza-signature"];
const timestamp = req.headers["x-manza-timestamp"];
const payload = req.rawBody;
const expected = crypto
.createHmac("sha256", signingSecret)
.update(`${timestamp}.${payload}`)
.digest("hex");
if (!crypto.timingSafeEqual(
Buffer.from(signature), Buffer.from(expected)
)) {
return res.status(401).send("Invalid signature");
}
// Reject a timestamp more than 5 minutes off: a replayed request.
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) {
return res.status(401).send("Stale timestamp");
}import hmac, hashlib, time
signature = headers["X-Manza-Signature"]
timestamp = headers["X-Manza-Timestamp"]
expected = hmac.new(
signing_secret.encode(),
f"{timestamp}.{body}".encode(),
hashlib.sha256,
).hexdigest()
if not hmac.compare_digest(signature, expected):
raise ValueError("Invalid signature")
# Reject a timestamp more than 5 minutes off: a replayed request.
if abs(time.time() - int(timestamp)) > 300:
raise ValueError("Stale timestamp")Retry policy#
Failed deliveries (non-2xx or network error) are retried with exponential backoff:
| Attempt | Delay before this attempt |
|---|---|
| 1st retry | 5 seconds |
| 2nd retry | 5 minutes |
| 3rd retry | 30 minutes |
| 4th retry | 2 hours |
| 5th retry | 5 hours |
| 6th retry | 10 hours |
| 7th retry | 10 hours |
After 7 retries (8 total attempts over ~28 hours) the delivery is marked permanently failed.
Retrying by hand
A failed delivery can be retried from Settings, or through the API: one delivery with POST /api/webhook_deliveries/:id/retry, or up to 500 eligible failed deliveries of an endpoint from the last 7 days with POST /api/webhook_endpoints/:id/retry_failed (see the Webhook Deliveries API). Only failed deliveries are retried; one that succeeded is never resent.
A payment.authorization_requested challenge is retried only while it can still be answered: once it was authorized or declined, or its one-hour window has passed, a retry is refused.
Automatic disabling#
Brief outages do not immediately disable an endpoint. Once failures span at least 12 hours, a subsequent failed delivery starts a five-day countdown. Another failure at or after that countdown expires disables the endpoint. Any successful delivery clears the failure window and countdown.
Authorized team members are notified when an endpoint is disabled. Inspect the delivery log, fix the underlying problem, then re-enable the endpoint from the dashboard or Webhook endpoints API. Re-enabling resets the failure window.
Endpoint requirements#
- HTTPS — only HTTPS URLs are accepted
- No private IPs — URLs resolving to private or loopback addresses are blocked
- 10-second timeout — your endpoint must respond within 10 seconds
- 2xx — any 200–299 status counts as a successful delivery
Testing locally#
An endpoint URL cannot point at your laptop. manza listen forwards a copy of each event to a local server instead, signed like a real delivery but with your API key's listen signing secret. Your registered endpoints keep receiving everything.
manza login --base-url https://ma.manza.dev # or https://za.manza.dev
echo "MANZA_WEBHOOK_SECRET=$(manza listen --print-secret)" >> .env
# Then one of these; it runs until ^C:
manza listen --forward-to http://localhost:4242/webhooks
manza listen --forward-to http://localhost:4242/webhooks --events transfer.executed,payment_link.paidVerify each request with that secret, exactly as above. To check a captured request by hand, with MANZA_WEBHOOK_SECRET exported in your shell: manza webhooks verify --secret-env MANZA_WEBHOOK_SECRET --timestamp <t> --signature <hex>.
- Listen sessions work in the sandbox only, and need the
release_webhook_listenersfeature on your workspace (ask support) and a key withwebhook_listeners:write. - A failed forward is reported and not retried. Requests time out after 10 seconds.
- Sessions last 12 hours; the CLI opens the next one by itself.
--authorizeralso forwards transfer-authorization challenges; read Testing locally first: the first answer wins, and five bad signatures in a row suspend the authorizer for everyone using it.
To test a real endpoint before going live, expose it through a tunnel (ngrok, cloudflared) and send POST /api/webhook_endpoints/:id/test.
Best practices#
- Verify
X-Manza-Signatureagainst the raw request body before accepting an event. - Persist the event or enqueue it durably, return a
2xxwithin 10 seconds, and process business work asynchronously. Do not acknowledge work you would lose on a crash. - Deduplicate with
X-Manza-Event-Idso retries cannot fulfill an order twice. - Send a
test.pingfrom the dashboard or test endpoint before going live. - Monitor the dashboard delivery log: inspect response codes and bodies for failed attempts, and reconcile payment state after an outage.