Skip to contentSkip to Content
GuidesWebhooks

Webhooks

Waka sends an HTTP POST to your callback URL when a transaction reaches a final status. Pending updates are not sent.

Events and destination

ProductEventSent when the status becomes
Payoutsbusiness.payout.updatedtermination_success, termination_failure
Collectionsbusiness.collection.updatedcollection_success, collection_failure, cancelled

Waka uses the request’s callbackUrl first, then your business default URL (set up by Waka). With neither, no webhook is sent, so poll the status endpoint. Use an absolute HTTPS URL.

Payloads

Payout: business.payout.updated
{ "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..." }
Collection: business.collection.updated
{ "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" }

partnerReference is the businessReference you sent. fxRate is left out for same-currency payouts. totalDebit is debitAmount plus feeAmount.

Handling a webhook

1Verify the signature

Collections: header X-Wakapay-Signature is the HMAC-SHA256 of the raw request body, key = your apiSecret, hex-encoded. Compute it on the raw bytes before parsing JSON.

Payouts: payload field signature is the SHA-256 of apiKey:apiSecret:wakapayReference, hex-encoded, e.g. the hash of wk_live_xxx:secret_yyy:a82a7489-3c2f-780d-a083-d1940f49f721. Compare ignoring case.

Reject any request whose signature doesn’t match.

2Expect one attempt

Each webhook is sent once. There are no automatic retries. Make your handler idempotent: skip a wakapayReference (payouts) or collectionId (collections) you’ve already processed.

3Update by your reference

Find your record by partnerReference (payouts) or reference (collections). If it is already final, keep it. Webhooks only carry final statuses, so a record is never moved back to pending.

4Return 200 OK quickly

Respond with HTTP 200 within a few seconds and move slow work to a background queue. A missed delivery isn’t resent. Poll the status endpoint to catch up.

Signature code samples are on the Webhooks reference.

If a webhook doesn’t arrive

The status endpoints are the source of truth. Poll them for anything still pending:

  • Payouts: GET /business/transactions/{businessReference}
  • Collections: GET /business/collections/{collectionId}
cURL
curl https://api.test.wakapay.io/business/collections/019abc... \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
200OK
{ "id": "019abc...", "status": "collection_success", "statusMessage": "Success", "amount": 1000, "currency": "TZS", "reference": "INV-1001", "mnoPaymentReference": "AIRTEL123456", "updatedAt": "2024-08-08T07:54:12Z" }