Webhooks
Webhooks are merchant-wide, event-based notifications configured once at the merchant account level by Zenith. The merchant provides an HTTPS endpoint URL, and Zenith registers it against the merchant account.
Once registered, Zenith will POST JSON payloads whenever:
- A transaction status changes (e.g. Pending → Successful) across any payment method or channel.
- PayTo mandate status changes
- isSettledToMerchant status changes
Webhooks are dispatched on a scheduler/timer that evaluates states and posts updates. All payment methods and channels trigger the same webhook mechanism.
If you are using the Hosted Payment Page and need immediate, per-transaction notifications, see Callbacks and Returns. Callbacks are HPP-only and apply to a single transaction.
Callbacks vs Webhooks
Requirements
- HTTPS POST endpoint – Must be reachable from Zenith's servers.
- Stable URL – The endpoint is configured once by Zenith; changes require contacting Zenith.
Webhook Headers
Every webhook has three headers.
x-signature: a 64-character code, different for every webhook. It proves the webhook came from ZenPay and was not changed. See Verifying the Signature.x-version:1. The webhook format version, the same asVersionin the body.x-platform:zenpay. Who sent it.
Verifying the Signature
Each webhook is signed, so you can check that it came from ZenPay and was not changed. The signature is in the x-signature header. It is the HMAC-SHA256 of the request body, written as lowercase hex, and the key is your ZenPay API key for the environment that sent the webhook (sandbox or live).
To check a webhook:
- Read the request body as text, exactly as it arrived.
- Work out the HMAC-SHA256 of that text, with your API key as the key.
- Compare it with the
x-signatureheader. - If they match, parse the JSON and process the webhook. If they do not match, answer
401and ignore it.
Use the text you received, not JSON you parsed and turned back into text. ZenPay writes whole amounts with a decimal point ("CustomerFee":0.0). Parsing and writing the JSON again drops it (0), so the text changes and the signature no longer matches.
In Node.js:
import { createHmac, timingSafeEqual } from 'node:crypto';
function isFromZenPay(rawBody, apiKey, signature) {
const expected = Buffer.from(createHmac('sha256', apiKey).update(rawBody).digest('hex'));
const received = Buffer.from(signature);
return received.length === expected.length && timingSafeEqual(received, expected);
}
Only the body is signed and there is no timestamp, so a replayed copy still passes. Make handling the same webhook twice harmless, for example by skipping a PaymentReference and PaymentStatus pair you have already handled.
Webhook Payload Fields
The body has four top-level fields. The payment details are inside Payload.
{
"Version": 1,
"Event": "New",
"PayloadType": "Payment",
"Payload": { "PaymentReference": "250899", "PaymentStatus": 3, "...": "..." }
}
| Field | Type | Notes |
|---|---|---|
Version | number | Webhook format version. Same value as the x-version header. |
Event | string | What happened, for example New. |
PayloadType | string | What Payload holds, for example Payment. |
Payload | object | The payment details, listed below. |
Payment fields
These fields are inside Payload.
| Field | Type | Notes |
|---|---|---|
PaymentReference | string | Unique payment reference assigned by Zenith. |
CustomerName | string | null | Name of the customer; null when there is none. |
CustomerReference | string | Reference provided by the merchant. |
PaymentStatus | number | Numeric status code. |
PaymentStatusDisplay | string | Human-readable payment status. |
BaseAmount | number | Base amount before fees. |
FundsToMerchant | number | Net amount payable to the merchant. |
CustomerFee | number | Fee charged to the customer. |
MerchantFee | number | Fee charged to the merchant. |
PaymentAmount | number | Total amount of the transaction. |
AccountOrCardNo | string | Masked account or card number. |
PaymentMethod | number | Numeric code for the payment method. |
PaymentMethodDisplay | string | Human-readable payment method. |
PaymentCardType | number | Numeric code for the card type. |
PaymentCardTypeDisplay | string | Human-readable card type. |
SubCardType | number | null | Numeric code for the sub card type; null when there is none. |
SubtCardTypeDisplay | string | null | Human-readable sub card type; null when there is none. Field name is misspelled, this is not an error in documentation. Also sent as SubCardTypeDisplay. |
SubCardTypeDisplay | string | null | Human-readable sub card type. Same value as SubtCardTypeDisplay. |
ProcessingDateTime | string | UTC ISO-8601 datetime (yyyy-MM-ddTHH:mm:ss). |
SettlementDate | string | null | UTC ISO-8601 date (yyyy-MM-dd), or null. |
ProcessorReference | string | Reference from the processor/gateway. |
IsPaymentSettledToMerchant | boolean | Indicates if the payment has been settled. |
FailureCode | string | Failure code; an empty string when there is none. Not on every webhook. |
FailureReason | string | Failure reason; an empty string when there is none. Not on every webhook. |
MerchantUniquePaymentId | string | null | Unique payment ID from the merchant; null when there is none. |
MerchantCode | string | Merchant identifier. |
AdditionalReference | string | null | Additional reference; null when there is none. |
PaymentSource | number | Numeric source identifier. |
PaymentSourceDispaly | string | Human-readable payment source. Field name is misspelled, this is not an error in documentation. Also sent as PaymentSourceDisplay. |
PaymentSourceDisplay | string | Human-readable payment source. Same value as PaymentSourceDispaly. |
IsPaymentRecalled | boolean | Indicates if the payment has been recalled. |
IsPaymentRetryScheduled | boolean | Indicates if a retry of the payment is scheduled. Not on every webhook. |
IsPaymentRefunded | boolean | Indicates if the payment has been refunded. |
Sku1 | string | null | null when empty. |
Sku2 | string | null | null when empty. |
AdditionalData | object | Processor details: AuthCode, RRN and STAN. Not on every webhook. |
CardTypeValue | number | Numeric code for the card type. |
CardTypeString | string | Name of the card type, for example MasterCard. |
SubCardTypeValue | number | null | Numeric code for the sub card type; null when there is none. |
SubCardTypeString | string | null | Name of the sub card type; null when there is none. |
SettlementType | string | Settlement type, for example Net or Gross. |
SettlementFrequencyValue | number | Numeric code for the settlement frequency (1 Daily, 2 Monthly). |
SettlementFrequencyString | string | Settlement frequency, for example Daily or Monthly. |
Webhook Examples
These are example webhooks from sandbox payments, grouped by checkout mode. Each entry is one payment, and its buttons select the messages in the order they arrived. Select a mode and payment to see the webhook as one JSON object: headers holds the three headers ZenPay sets (x-signature, x-version, x-platform), and body holds the JSON that ZenPay sends. On the wire the headers travel beside the body, not inside it, and only the body is signed. Signature verification uses the original received body, including its whitespace.
Webhook reference
{
"headers": {
"x-platform": "zenpay",
"x-signature": "53e842e7fe4392ca6813f35bc12ed2da00179aa8c64d1a5cfa946d1fd146d3b8",
"x-version": "1"
},
"body": {
"Version": 1,
"Event": "New",
"PayloadType": "Payment",
"Payload": {
"PaymentReference": "250905",
"CustomerName": "Jaina Proudmoore",
"CustomerReference": "CUST-523YU4BE",
"PaymentStatus": 3,
"PaymentStatusDisplay": "Successful",
"BaseAmount": 214.18,
"FundsToMerchant": 214.18,
"CustomerFee": 0,
"MerchantFee": 0,
"PaymentAmount": 214.18,
"AccountOrCardNo": "625094XXXXXX0016",
"PaymentMethod": 0,
"PaymentMethodDisplay": "Credit / Debit Card",
"PaymentCardType": 21,
"PaymentCardTypeDisplay": "UnionPay - International Cards",
"SubCardType": null,
"SubtCardTypeDisplay": null,
"SubCardTypeDisplay": null,
"ProcessingDateTime": "2026-11-03T20:33:18",
"SettlementDate": "2026-11-05",
"ProcessorReference": "1456-P-BVFV6A4PZBSBIMWE",
"IsPaymentSettledToMerchant": false,
"MerchantUniquePaymentId": "OOLrdYj3SNVXY9uQBfM4Vw",
"MerchantCode": "1337",
"AdditionalReference": "ADD-QQ8KDNW3",
"PaymentSource": 36,
"PaymentSourceDispaly": "Pub.Online Payment - Customer",
"PaymentSourceDisplay": "Pub.Online Payment - Customer",
"IsPaymentRecalled": false,
"IsPaymentRefunded": false,
"Sku1": null,
"Sku2": null,
"CardTypeValue": 21,
"CardTypeString": "UnionPay",
"SubCardTypeValue": null,
"SubCardTypeString": null,
"SettlementType": "Gross",
"SettlementFrequencyValue": 2,
"SettlementFrequencyString": "Monthly"
}
}
}