Skip to contentSkip to Content

Webhooks

Waka sends one POST to your callback URL when a payout or collection reaches a final status. For the full handling flow see the Webhooks guide.

Callback URL

Waka picks the destination in this order:

  1. The callbackUrl in the payout or collection request (that transaction only)
  2. Your business account’s saved default URL, set up by Waka
  3. No webhook if neither is set. Poll the status endpoint instead

callbackUrl must be an absolute URL. Use HTTPS in production.

Events

ProductEventFinal statuses
Payoutsbusiness.payout.updatedtermination_success, termination_failure
Collectionsbusiness.collection.updatedcollection_success, collection_failure, cancelled

Each webhook is sent once. There are no automatic retries.

Payout payload

{ "event": "business.payout.updated", "status": "termination_success", "wakapayReference": "a82a7489-3c2f-780d-a083-d1940f49f721", "partnerReference": "INV-1001", "fxRate": 2580.46, "feeAmount": 0.15, "debitAmount": 10.00, "totalDebit": 10.15, "signature": "abc123..." }
FieldDescription
eventAlways business.payout.updated for payouts
statustermination_success or termination_failure
wakapayReferenceWaka’s transaction ID. Use it to skip duplicates
partnerReferenceThe businessReference you sent
fxRateReceiver-currency units per 1 sender unit. Left out for same-currency payouts
debitAmountPrincipal taken from your wallet
feeAmountFee charged. Can be 0.00
totalDebitdebitAmount plus feeAmount
signatureSee Verify a payout webhook

On termination_failure the funds return to your available balance.

Collection payload

{ "event": "business.collection.updated", "collectionId": "019abc...", "businessId": "biz_abc123", "status": "collection_success", "amount": 5000, "currency": "TZS", "mobile": "+2557XXXXXXXX", "reference": "INV-1001", "provider": "airtel", "mnoPaymentReference": "AIRTEL123456", "occurredAt": "2024-08-08T07:54:12Z" }

Webhook security

Verify a payout webhook

The signature field is the SHA-256 hash of apiKey:apiSecret:wakapayReference, hex-encoded. Rebuild it with your credentials and the wakapayReference from the payload, then compare ignoring case. For example, the input string is wk_live_xxx:secret_yyy:a82a7489-3c2f-780d-a083-d1940f49f721.

const crypto = require("crypto") function isValidPayoutWebhook(apiKey, apiSecret, payload) { const raw = `${apiKey}:${apiSecret}:${payload.wakapayReference}` const expected = crypto.createHash("sha256").update(raw).digest("hex") return expected.toLowerCase() === (payload.signature || "").toLowerCase() }
import hashlib def is_valid_payout_webhook(api_key, api_secret, payload): raw = f"{api_key}:{api_secret}:{payload['wakapayReference']}" expected = hashlib.sha256(raw.encode()).hexdigest() return expected.lower() == (payload.get("signature") or "").lower()

Verify a collection webhook

The X-Wakapay-Signature header is the HMAC-SHA256 of the raw request body, keyed with your apiSecret, hex-encoded. Compute it on the raw bytes before parsing the JSON.

const crypto = require("crypto") function isValidCollectionWebhook(apiSecret, rawBody, header) { const expected = crypto.createHmac("sha256", apiSecret).update(rawBody).digest("hex") return expected.toLowerCase() === (header || "").toLowerCase() }
import hashlib, hmac def is_valid_collection_webhook(api_secret, raw_body: bytes, header): expected = hmac.new(api_secret.encode(), raw_body, hashlib.sha256).hexdigest() return hmac.compare_digest(expected.lower(), (header or "").lower())

Reject any webhook whose signature doesn’t match.

Status endpoints

The status endpoints are the source of truth. Poll them for anything still pending, or when a webhook doesn’t arrive.

ProductEndpoint
PayoutsGET /business/transactions/{businessReference}
CollectionsGET /business/collections/{collectionId}
cURL
curl https://api.test.wakapay.io/business/transactions/EXT-INV-2026-0001 \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
404Not found
{ "code": 0, "error": "transaction not found" }

A 404 means the payout was never created. Retry with the same reference.

Troubleshooting

ProblemCheck
Signature doesn’t matchPayouts: the string is exactly apiKey:apiSecret:wakapayReference. Collections: hash the raw body, not parsed JSON
Webhook never arrivesThe URL is public, has a valid HTTPS certificate, and is the one Waka has on file
Your handler times outReturn 200 first and move slow work to a background queue