Skip to main content
Webhooks provide real-time notifications about payment events, allowing your application to respond immediately to payment completions, failures, and status changes. This guide covers implementing secure webhook endpoints.

Why Use Webhooks

  • Real-time updates: Immediate notification when payouts and orders complete
  • Reliable delivery: Built-in retry mechanisms for failed deliveries
  • Reduced polling: No need to constantly check payout status
  • Better UX: Instant confirmation and account updates

Webhook Events

Zuba sends webhooks for the following events:

Payout Events

  • payout.processing - Payout is being processed by the payment provider
  • payout.paid - Payout completed successfully
  • payout.failed - Payout failed before settlement
  • payout.reverted - A payout that had already settled (payout.paid) was later rejected by the provider’s downstream bank; an operator manually refunded the merchant and the amount was credited back. The payout fee may not come back with the amount: the payment was executed on the details given, as with any bank transfer the receiving bank bounces, so feeRefunded on the payout (GET /v1/payouts/{id}) says whether the fee was refunded. Unlike payout.failed (a pre-settlement failure, which refunds amount and fee), this payout did originally succeed: do not automatically re-issue it.
  • payout.cancelled - Payout was cancelled, whether you cancelled it via POST /v1/payouts/{id}/cancel or it was cancelled downstream. The debited balance is returned to your account as part of the cancellation; confirm it from your balance rather than from this event
A status Zuba’s operations team sets on your payout through its operations tools, for example marking it paid once the provider confirms a payment it could not report, is announced with the same events as any other change. That includes moving a failed payout to paid (payout.paid) or to cancelled (payout.cancelled). A cancellation that follows a failure completes a balance return the failure did not finish and returns nothing the failure already returned; a fee kept on a returned payout stays kept. Confirm it from your balance.

Payout Lifecycle

Where each event fires in a payout’s life. created and queued are internal pre-processing states and fire no webhook. The first delivery you receive is normally payout.processing, but a payout that fails after it is created and before processing emits payout.failed as its first and only event. A payout funded from your own account at the bank holding a managed deposit account can also fail early. For a cross-currency payout, and for a USD-to-USD SWIFT wire sent without a quote, those funds are checked and drawn when the payout is created. If the bank declines to release them, the call returns 201 with the payout failed. If the account is frozen, unreachable or held at more than one institution, the payout is refused: sent without a quote it returns 201 with the payout failed, and sent with a quoteId it is refused with a 422 before any payout is created. A USD-to-USD SWIFT wire that the bank holding your managed deposit account delivers itself (to a receiving bank outside the US, on a corridor that bank serves) is not refused at creation when its funds are at that bank or at more than one institution. Any other same-currency payout from such an account is created as usual and, if its funds cannot be drawn, fails before it is sent, with its funds returned. A request refused before a payout is created, such as a submit-time validation error or a payout your balance cannot cover (a 400 whose code is INSUFFICIENT_BALANCE), emits no webhook:
payout.failed carries the reason in failureCategory and failureReason, and payout.reverted says in failureReason that the payout was returned (see Event-specific data fields). An event recorded before those fields existed does not carry them; fetch GET /v1/payouts/{id} for its failureReason.

Order Events

Orders (POST /v1/orders) are executed manually by Zuba’s trade desk; webhooks are how you learn the outcome. See Trade Desk Orders for the full lifecycle.
  • order.created - The order was created. Fires together with order.funds_received (balance-funded) or order.awaiting_funds (settlement-funded)
  • order.awaiting_funds - Funding instructions were issued; the payload’s settlement block carries the account or address, amount, and reference to fund the order
  • order.funds_received - The source amount is held and the order is queued for desk execution
  • order.completed - The desk delivered to your beneficiary; uetr is present for wire deliveries, txHash for deliveries to a crypto wallet
  • order.failed - The order failed (failureReason set) and the held funds were returned to your balance
  • order.expired - The funding window closed before the order was funded; a transfer arriving later credits the balance instead
There is no order.cancelled event (cancellation is answered synchronously by POST /v1/orders/{id}/cancel) and no event for the executing status (desk review is internal).

Account Events

  • account.created - An account record was created via POST /v1/accounts

Application Events

Your onboarding application moves through review out of band, so these events report where it stands.
  • application.under_review - The application was submitted and is being reviewed
  • application.more_info_requested - Review needs more from you; the payload adds moreInfoReason and the editableSections to complete
  • application.approved - The application was approved
  • application.rejected - The application was rejected
  • application.identity_verification_updated - A director’s or shareholder’s own identity verification moved (to pending on a reopened attempt as well as to a decision), or the applicant’s own was verified or rejected (an expired attempt is rejected); the payload adds personId, null for the applicant, and identityVerificationStatus (pending, verified or rejected)

Information Request Events

After your application is approved, Zuba may need more from you, often because our banking partner asked. An information request carries the questions; it does not change your application or your ability to make payments. Read and answer it with the information requests API. accountId tells you which sub-account was asked; send it as Zuba-Account-Id on those calls. GET /v1/information-requests/all-accounts lists your master account’s requests and every sub-account’s in one list.
  • information_request.opened - Zuba asked you, or one of your sub-accounts, some questions; the payload carries the questions and any due date
  • information_request.closed - The request is finished; resolution is fulfilled when you answered it and withdrawn when Zuba closed it before you did
Each fires once per request. data is the request when the event was processed, so it can already show a later status; read GET /v1/information-requests/{id} for the current state. In the sandbox you can open and close a sample request yourself.

Virtual Account Events

Most currencies issue virtual accounts asynchronously: POST /v1/virtual-accounts returns status: "pending" and the account completes out of band, which can take far longer than a request cycle. These events are the completion signal, so use them rather than a polling loop. A failed delivery can be re-sent (see Redelivering a failed delivery), but no event exists for an account that has not completed, so if you have been waiting longer than you expect, repeat the POST: it is idempotent per owner and currency, and answers with the pending account, the active one, or the refusal that stands. GET /v1/virtual-accounts lists active accounts only, so a pending account and a refused one are both simply absent from it. A refusal answers on the POST itself when it can be settled inside the request. 409 KYB_INCOMPLETE means the account owner’s own approved application is not complete enough to open the account, and the message names what is outstanding — a document still to upload, or an acceptance of the terms the account would be opened under that the owner has not given at the version currently in force. GET /v1/virtual-accounts/requirements reports the same set before you request anything, and for acceptance it hands back the documents themselves. 409 VIRTUAL_ACCOUNT_VERIFICATION_REQUIRED is the other half: the provider requires verification material beyond the application’s fields. Complete the outstanding onboarding verification and repeat the POST — the request is refused with the same code until the verification passes. A repeat within ten minutes of the last refusal is answered from that refusal without consulting the provider, so allow that interval before retrying. Where the message says the account was taken out of service, there is nothing to complete: repeating the POST once the ten minutes have passed issues a new account. 409 VIRTUAL_ACCOUNT_DEACTIVATED is different: the account was deactivated, and only support can re-issue it.
  • virtual_account.active - The account was approved and now carries its issued details; fetch them with GET /v1/virtual-accounts
  • virtual_account.failed - The account was refused after issuance, or can never produce usable payment details. A repeat POST /v1/virtual-accounts for the same currency answers with the refusal that stands (409 VIRTUAL_ACCOUNT_VERIFICATION_REQUIRED for a provider verification refusal, 409 VIRTUAL_ACCOUNT_DEACTIVATED for a deactivation only support can lift). Where the refusal came from onboarding the account holder, the payload adds failureCode: account_holder_declined is final, so contact support rather than retrying; onboarding_error means the onboarding can be completed or corrected and the request repeated
Which events a currency can fire follows from where its approval step sits:
  • XOF/XAF/GHS accounts are approved after creation, so a refusal lands on an account you already hold as pending and fires virtual_account.failed.
  • ZAR accounts are opened by the bank partner, either inside the request (201 with status: "active" and the details filled in) or after it (201 with status: "pending"). A POST the partner answers with an account already out of service answers 409 VIRTUAL_ACCOUNT_VERIFICATION_REQUIRED; a POST that fails at the partner answers 502 and is safe to repeat. Once a POST has answered pending, virtual_account.active carries the issued details, and virtual_account.failed means the partner refused the account; a repeat request then answers 409 VIRTUAL_ACCOUNT_VERIFICATION_REQUIRED while the refusal stands. Where the refusal asks you to retry after ten minutes, repeating the request then opens the account again with a new paymentReference; otherwise contact support.
  • EUR/GBP accounts are approved before creation: a refusal surfaces as an error on POST /v1/virtual-accounts itself. Where the account holder’s onboarding is still under review, the POST answers pending and the account then fires virtual_account.active, or virtual_account.failed with a failureCode if the review refuses it. An account that stays pending far longer than usual needs support rather than a retry.
  • USD accounts are verified after creation, and part of the verification can also settle inside the request: a POST the provider refuses outright answers 409 VIRTUAL_ACCOUNT_VERIFICATION_REQUIRED with nothing created — complete the outstanding verification and repeat the request. A POST refused 409 KYB_INCOMPLETE never reached the bank at all: the named document or acceptance is still owed on the owner’s application, and supplying it makes the repeat succeed. Once the POST answers 201 with status: "pending", the remaining verification can run for days: virtual_account.active carries the issued wire details, and virtual_account.failed means the verification refused the account — a repeat request then answers 409 VIRTUAL_ACCOUNT_VERIFICATION_REQUIRED while the refusal stands; where the refusal names verification material you can supply, completing it and repeating the request is the recovery, otherwise contact support.
When accountId is not null the account belongs to that sub-account, and both follow-up calls are owner-scoped: send Zuba-Account-Id: <accountId> on the GET or the repeat POST, or the request addresses your master account’s accounts instead. The payload identifies the account but never carries bank details — always read those from the authenticated GET /v1/virtual-accounts. In production whether a sub-account can hold its own NGN account depends on which rail serves your workspace: POST /v1/virtual-accounts always issues one for the master, and a request naming a sub-account either issues one or answers 422 VIRTUAL_ACCOUNT_SELF_SERVE_UNSUPPORTED. Call GET /v1/virtual-accounts/requirements with the sub-account’s id to find out which: self_serve_unsupported means that workspace’s rail issues to the master only. The sandbox issues one for a sub-account. NG-incorporated workspaces also have one provisioned during onboarding review and read it from GET /v1/virtual-accounts once the application is approved. In production an NGN account that opens within the request emits no event; one that opens only after a review emits virtual_account.active when it opens, or virtual_account.failed if the review refuses it. In the sandbox, POST /v1/virtual-accounts returns the NGN account number directly, already active, and virtual_account.active follows as it does for every sandbox account.

Deposit Events

Incoming deposits notify on their terminal outcome, so you can credit your customer (or surface a failure) without polling GET /v1/deposits.
  • deposit.completed - Funds were received and credited to your Zuba balance. The balance moves by creditedAmount: amount less serviceFee. Credit your own customer from that figure, not from amount. Fires once when the deposit reaches completed, on any rail — a bank transfer or mobile-money/paybill credit into a virtual account, an M-Pesa STK-push collection, a USD/EUR/GBP account credit, or an on-chain crypto deposit. A deposit held for compliance review (in_review) fires this only once it clears.
  • deposit.failed - The deposit terminally failed — an M-Pesa STK push the payer declined or entered the wrong PIN for, an inbound transfer returned before it ever credited, or a deposit rejected during compliance review (in_review). Usually nothing was credited and creditedAmount and serviceFee are both null, but a deposit rejected in review after its credit had already landed carries the figures that credit moved. Read status before you credit anyone from them. A deposit that already completed and is later reversed is not a deposit.failed.
No webhook fires for pending or processing, and the refund lifecycle (refunding/refunded) is not yet delivered as a webhook. The payload identifies the deposit by id + clientRef, and carries the amount, plus the charge and the credit where the deposit credited; read full detail from GET /v1/deposits.
deposit.completed
deposit.failed

Other Events

  • webhook.test - Test event sent via the test endpoint

Event Payload

Every webhook delivery is a JSON POST request with this envelope:

Event-specific data fields

payout.* events Events recorded before failureCategory and failureReason were added do not carry either field, including when such an event is retried or redelivered. A redelivery of an event first delivered before developerFee and totalDebit were added does not carry them either. order.* events account.created application.* events information_request.* events virtual_account.* events deposit.* events Each request includes these headers:

Setting Up Webhook Endpoints

Webhook endpoint URLs must use HTTPS: registering an http:// URL is rejected with a 400.

Basic Webhook Handler

Create an endpoint to receive webhook notifications:

Processing Different Event Types

Handle specific webhook events:

Webhook Security

Verifying Signatures

Every webhook delivery includes a cryptographic signature so you can verify the request genuinely originated from Zuba and has not been tampered with. You should always verify signatures before processing webhook events. The signature is computed as:
Where:
  • signing_secret is the plaintext secret (the whsec_-prefixed value returned when you created the endpoint)
  • timestamp is the value from the X-Zuba-Timestamp header
  • raw_body is the raw HTTP request body (not parsed JSON)
  • The result is hex-encoded (64 characters)
Your signing secret is only shown once when you create a webhook endpoint or rotate the secret. Store it securely. If you lose it, use the rotate secret endpoint to generate a new one.

Verification Steps

  1. Extract the X-Zuba-Signature and X-Zuba-Timestamp headers
  2. Concatenate the timestamp, a literal ., and the raw request body
  3. Compute the HMAC-SHA256 of that string using your signing secret
  4. Compare your computed signature against the header value using a constant-time comparison
  5. Check that the timestamp is recent (within your tolerance window) to prevent replay attacks

Code Examples

Replay Protection

The timestamp is included in the signed content specifically to enable replay protection. An attacker who intercepts a valid webhook cannot replay it at a later time if you enforce a timestamp tolerance. We recommend rejecting any webhook where the X-Zuba-Timestamp is more than 5 minutes from your server’s current time. All the examples above implement this check.
Make sure your server’s clock is synchronized with NTP. A clock that drifts significantly could cause valid webhooks to be rejected.

IP Allowlisting

Zuba does not currently publish a static egress IP range for webhook deliveries. Signature verification (above) is the supported way to authenticate incoming webhooks: it proves both origin and integrity, which an IP check alone does not.

Handling Webhook Failures

Idempotency

Zuba delivers each event at least once, so the same event can reach you more than once. Every delivery of an event carries the same id: record the IDs you have processed and skip any you have seen.

Ordering

Deliveries can arrive out of order: a payout.paid can reach you before the payout.processing that preceded it. Each payout.* event’s data is the payout as it stood at that change, not when it was delivered, so apply a payout event only if its sequence is higher than the last one you applied for that payout, and ignore it otherwise. To read a payout’s current state, call GET /v1/payouts/{id}.

Retry Logic

Implement exponential backoff for webhook processing:

Delivery and Retries

Zuba retries failed deliveries up to 11 times (12 attempts in total) with exponential backoff, over roughly 40 to 75 minutes. A delivery is successful when your endpoint responds with a 2xx status code within 30 seconds. Redirects are not followed: a 3xx response counts as a failed attempt. Delays include random jitter and can be up to twice these values. Treat them as lower bounds. After all attempts are exhausted, the delivery is marked as failed. You can view delivery history via the API:
To inspect a single delivery, including the exact payload that was sent, fetch GET /v1/webhooks/{endpoint_id}/deliveries/{delivery_id}.

Redelivering a failed delivery

Once your endpoint is fixed, re-send a delivery whose status is failed:
The delivery is sent again exactly as stored: the same event id and, for payout events, the same sequence, so your deduplication and ordering treat it as the event you missed. The signature and X-Zuba-Timestamp are fresh. The response is the delivery, now pending; it is retried on the schedule above, and its attempt numbers continue from the earlier attempts. An API key needs the create:webhooks scope. A delivery that is pending (still being retried) or delivered cannot be re-sent, and the request returns 409 with WEBHOOK_DELIVERY_NOT_REDELIVERABLE. A redelivery that succeeded makes the delivery pending, so a retry of the same request returns this 409 too; read the delivery to see its status. A delivery to a disabled endpoint returns 409 with WEBHOOK_ENDPOINT_DISABLED; enable the endpoint first. An endpoint or delivery outside your workspace returns 404.
Your endpoint must respond within 30 seconds. If you need to do long-running processing, accept the webhook with a 200 response immediately and process the event asynchronously.

Testing Webhooks

Sending a Test Event

Trigger a webhook.test delivery to a registered endpoint:
The delivery carries "test": true in the envelope and is signed like any other event, so you can exercise your signature verification and processing end to end.

Local Testing with ngrok

Expose your local development server with ngrok:

Complete Example

Next Steps

  • Learn about error handling strategies for webhook failures
  • Explore the API reference for complete event schemas
  • Set up monitoring and alerting for production webhook endpoints
  • Implement webhook event replay for failed processing scenarios