Architectural Overview & Integration Principles
In high-volume payment integration, relying on backend polling to verify transaction outcomes creates unnecessary system latency and network overhead. OneKhusa’s Collection Webhooks implement an event-driven, push-based model designed to deliver real-time transaction settlement notifications directly to your application infrastructure the moment funds are verified.1. Core Event-Driven Flow
When a transaction occurs, whether through a hosted checkout page or a direct payment API prompt, OneKhusa decouples payment initiation from transaction confirmation.Event Lifecycle
1.1. Initiation & Pending State : Your client receives an initial response (e.g.,200-OK) indicating the payment prompt/TAN or checkout session has started.
1.2. Asynchronous Processing : The payment moves through carrier pathways (MNO mobile wallets, card networks, or bank transfers).
1.3. Event Dispatch : Once a transaction reaches a final state as verified, the OneKhusa Webhook Engine constructs a notification and pushes it to your registered event callback URL.
1.4. Local Handshake & Queueing : Your system validates the authenticity of the transaction payload, immediately acknowledges receipt with an HTTP 200 OK, and hands the event off to your local background service for fulfillment.
2. Event Lifecycle Categories
You can configure endpoint listeners inside the OneKhusa Developer (Merchant) Portal based on the specific lifecycle stages your platform needs to handle either through standard checkout or direct API push payment:| Category | Description |
|---|---|
| Successful Collections | Dispatched as soon as funds clear from an MNO wallet or bank account or payment card, confirming that the money is safely credited to your merchant account. |
| Collection Reversals | Triggered in the event of an authorized chargeback, customer dispute, or network-level settlement reversal requiring a debit entry in your internal accounting. |
3. Integration Standards & Security Architecture
To ensure high availability and prevent unauthorized access, your webhook receiver should adhere to three core security and reliability principles:3.1 Cryptographic Identity Verification
Every incoming transmission contains a secure HMAC-SHA512 signature header (X-OneKhusa-Webhook-Signature) and X-OneKhusa-Webhook-Event (this header indicates the event type such as payment.success, payrequest.success etc.). Your endpoint must calculate an identical HMAC hash using your raw request payload string and merchant webhook secret before accepting the transaction. This guarantees that the notification truly originated from OneKhusa and guards against spoofing attacks.
3.2 Non-Blocking Acknowledgment
To maintain gateway health and prevent callback timeouts, your HTTP handler must remain lightweight. Avoid running synchronous database locks, complex transaction/account updates, or third-party email notifications within the incoming HTTP request thread. Verify the signature, queue the event internally, and respond immediately with200 OK. Remember that our webhook engine waits for your system response within 30 seconds otherwise it will retry to deliver webhook notification.
3.3 Idempotent Event Handling
Network interruptions can occasionally cause duplicate event deliveries due to webhook engine retries. Your receiving service should track incoming unique event reference (transactionReferenceNumber) from transaction payload. If a duplicate message arrives, your system should acknowledge it with a 200 OK without re-processing the order or double-crediting system account balances.
4. Delivery Guarantees & Retry Circuit Breaker
If your endpoint is temporarily offline, undergoing maintenance, or returns anything other than an explicit success status (such as a 5xx error or connection timeout), OneKhusa’s webhook delivery engine automatically activates an exponential backoff retry schedule (e.g., 1 minute, 2 minutes, 4 minutes). This ensures that temporary infrastructure blips do not lead to dropped payment records or unfulfilled orders.Field Descriptions
This section describes the common properties/fields for collection webhook payloads.| Field | Type | Description | Example |
|---|---|---|---|
ConnectorId | integer | Unique 6-digit identifier for the connector | 247482 |
SourceAccountNumber | string | The account number from which the payment originates | 74629183 |
SourceAccountName | string | The name registered on the payer’s account | OneKhusa Suppliers Ltd |
SourceInstitution | string | The financial institution or bank that holds the payer’s account | National Bank of Malawi |
SourceReferenceNumber | string | A unique reference identifier provided by the payer’s bank for this transaction | SRC4K8L2M9Q1Z |
BeneficiaryAccountNumber | string | The account number of the receiving merchant or beneficiary | 102345678901 |
TransactionReferenceNumber | string | A unique transaction reference generated by the system to identify the transaction | TXN7D3P8L5Q2X |
TransactionDescription | string | A short description or purpose of the transaction | Payment for invoice INV-2025-1010 |
TransactionAmount | decimal | The total monetary value of the transaction | 320500.75 |
TransactionFee | decimal | The fee charged for processing the transaction | 1000.00 |
TransactionDate | datetime | The exact date and time when the transaction was processed (ISO 8601 format) | 2025-10-10T14:50:00Z |
TransactionStatusCode | string | Indicates the current status of the transaction | S (Success), F (Failed) |
TransactionCode | string | An internal transaction code used for classification or processing | BAM, MWM |
ResponseCode | String | The code set after the collection transaction is processed. Refer to Transaction Responses for more details. | S100 |
TimedAccountNumber | String | The generated unique temporary (short-lived) account number tied to a request-to-pay transaction | 11005533 |
ReferenceNumber | String | The unique reference number generated by the merchant system tied to a request-to-pay transaction | 1020XDFS76GS777 |
SourceDescription | String | The transaction description generated by the merchant system for the service/product(s) purchased by the customer tied to a request-to-pay transaction | Samsung 85inch TV purchase |