Webhooks for API payment gateway
When an API gateway order changes payment state, Zenofy POSTs JSON to the webhook URL configured on the product (not per API request).
Configure URL and optional secret in the merchant app when creating or editing an API Gateway product (External software integration section).
These events are separate from order webhooks (Integrations β Webhook for standard products) and from SaaS subscription webhooks (Software/SaaS products).
Failed deliveries are retried automatically (exponential backoff). Verify authenticity with the optional product webhook secret.
Configuration
Webhook URL is required before POST /checkout/order-api-gateway will succeed. Webhook secret is optional; when set, each request includes X-Signature: sha256=<hex> (HMAC-SHA256 of the raw JSON body).
Outbound HTTP request
POST Β· Content-Type: application/json
POST https://your-server.com/webhooks/zenofy HTTP/1.1
Content-Type: application/json
X-Event: payment.succeeded
X-Signature: sha256=abc123...
{ ... }
Signature verification
Compute HMAC-SHA256 of the raw request body using your product webhook secret. Compare to header X-Signature (prefix sha256=). Event name is also in header X-Event (e.g. payment.succeeded).
Event types
| Event | When |
|---|---|
payment.succeeded | Order marked paid. |
payment.refunded | Order marked refunded. |
payment.chargeback | Order marked chargeback (admin). |
JSON body fields
eventβ event type (same asX-Event)payment_idβ stable id derived from the order (e.g. pay_β¦)checkout_idβ order id (same ascheckout_idfrom create API)referenceβ yourreferencefrom the create request, if anyamountβ integer minor unitscurrencyβ ISO codestatusβsucceeded,refunded, orchargebackcustomerβname,emailpayment_methodβ alias such asmpesa,cardpaid_atβ when the order was paid (refund/chargeback events include this too)refunded_atβ on payment.refundedchargeback_atβ on payment.chargeback
Sample JSON bodies
payment.succeeded (illustrative)
{
"event": "payment.succeeded",
"payment_id": "pay_12abcd01",
"checkout_id": "673f92b2c3d94a0012abcd01",
"reference": "inv-2026-0042",
"amount": 2500,
"currency": "MZN",
"status": "succeeded",
"customer": {
"name": "JoΓ£o Silva",
"email": "buyer@example.com"
},
"payment_method": "mpesa",
"paid_at": "2026-05-19T11:22:00+02:00"
}
payment.refunded (illustrative)
{
"event": "payment.refunded",
"payment_id": "pay_12abcd01",
"checkout_id": "673f92b2c3d94a0012abcd01",
"reference": "inv-2026-0042",
"amount": 2500,
"currency": "MZN",
"status": "refunded",
"customer": {
"name": "JoΓ£o Silva",
"email": "buyer@example.com"
},
"payment_method": "mpesa",
"paid_at": "2026-05-19T11:22:00+02:00",
"refunded_at": "2026-05-20T09:00:00+02:00"
}
← Create API gateway order (POST)
All tutorials