Integration guide
The programmatic API is for backend systems only. A typical collection integration looks like this:
- Obtain a collections access token via
POST /v1/oauth/collections/token(cache until shortly before expiry). - Call
POST /v1/collectwithAuthorization: Bearer,X-Idempotency-Key, and a publicly reachable HTTPSwebhookUrlwhere your service accepts POSTs from SwarmByte. - Save the returned
data.transactionIdand correlate it with your order or reference. - Wait for asynchronous callbacks on
webhookUrl, and/or pollGET /v1/collect/transactions/:transactionIdusing the same collections token. - Acknowledge webhooks with any 2xx response. Implement handlers so the same
transactionIdcan be delivered more than once without breaking your ledger (idempotent updates).
Webhook URL must match where you listen
The hostname in webhookUrl must be the same public endpoint that actually exposes your HTTPS route (for example, if callbacks are served on a dedicated notifications or USSD gateway host, register that origin — not an unrelated API hostname that returns 404). Use TLS with a valid certificate.
Phone number (MSISDN) format
Collect and disburse accept Ugandan mobile numbers in national form (07XXXXXXXX, 10 digits) or international form (2567XXXXXXXX, 12 digits). Normalize consistently in your codebase.
Disbursements
Use POST /v1/oauth/disbursements/token with the same API key and secret as collections, then POST /v1/disburse with the required pin (set in the merchant dashboard). Flow mirrors collections: webhook callbacks + optional status polling with the disbursements token.
Disbursement amounts (fee-on-top)
amount is the exact UGX the recipient receives. The platform withdrawal fee is charged on top from your wallet (total debit = amount + fee). In API responses, netAmount equals amount for disbursements — it is not reduced by the fee. Your wallet must have enough available balance to cover amount + fee before the request succeeds.
Exact headers and JSON keys: Field reference. Shared errors: Errors overview.