Webhooks
The Business Webhook System lets business clients receive real‑time notifications when transactions complete (for example CAD‑INTERAC deposits and withdrawals).
Webhook delivery is tightly integrated with business API keys and uses HMAC signatures for verification.
High-level flow
- Quote / transaction creation
- A business user initiates a transaction (typically via the Quote APIs).
- Internal webhook handling
- Transfaar receives provider webhooks, updates quotes, transactions and ledger entries.
- Business webhook fan‑out
- If the user is a business client with a configured webhook URL on their API key, Transfaar enqueues a webhook job and delivers a business webhook to the URL you configured.
Payload schema
Business webhooks use a unified payload for deposits and withdrawals, distinguished by transaction_type:
{
"event_type": "deposit_completed",
"sender": {
"email": "sender@example.com",
"first_name": "John",
"last_name": "Doe"
},
"recipient": {
"email": "recipient@example.com",
"first_name": "Jane",
"last_name": "Smith",
"account_id": "beneficiary-uuid"
},
"amount_with_fees": "105.00",
"amount": "100.00",
"currency": "CAD",
"status": "COMPLETED",
"timestamp": "2024-01-01T00:00:00Z",
"reference": "transaction-reference",
"transaction_type": "deposit",
"transaction_id": "transaction-uuid"
}Key fields:
event_type:"{transaction_type}_{status}", e.g."deposit_completed","withdrawal_failed".transaction_type:DEPOSIT,WITHDRAWAL, orEXCHANGE.status: current transaction status (for exampleCOMPLETED).reference: the Transfaar transaction reference you can use to reconcile.transaction_id: unique internal transaction identifier.
Webhook security
Webhooks are signed with the same secret key associated with your business API key.
Headers:
Content-Type: application/jsonUser-Agent: Transfaar-Business-API/1.0X-Transfaar-Signature: <hmac_signature>
Verification:
- Read the raw request body as a string.
- Recompute
HMAC-SHA256over the body (and any additional fields described in the Business Webhook design) using your stored secret key. - Compare the hex‑encoded result with
X-Transfaar-Signatureusing a constant‑time comparison.
If the signatures don’t match, you must reject the webhook.
Delivery semantics and retries
Internally, webhooks are processed by a background WebhookService that:
- Pushes webhook jobs to a queue for non‑blocking delivery.
- Implements retries with exponential backoff (up to 3 attempts) on network or 5xx failures.
- Logs all failed deliveries for later inspection, without blocking the main transaction flow.
Manual testing
For sandbox/testing environments, Transfaar exposes external endpoints that can be used to re‑send or simulate webhook delivery for a given transaction reference.
When you use these endpoints, standard business authentication (HMAC headers) applies, and your webhook URL must already be configured on a /business API key.