POST/v1/collect

Initiate collection

Start an STK-style collection to a Ugandan MSISDN from one of your wallets. Requires a collections-scoped Bearer token.

Headers

Authorization: Bearer <collections_access_token>
Content-Type: application/json
X-Idempotency-Key: <required, non-empty>

See Field reference for what each header means.

Body

{
  "walletAddress": "main",
  "msisdn": "256701234567",
  "amount": 50000,
  "reference": "ORDER-12345",
  "webhookUrl": "https://your-server.example/webhooks/swarmbyte"
}

Field meanings: Field reference → POST /v1/collect.

  • msisdn — Uganda national format: 256 + 9 digits starting with 7, or 0 prefix form (validated server-side).
  • webhookUrl — HTTPS URL for asynchronous lifecycle callbacks for this transaction (e.g. collection.initiated, collection.success; see Webhooks (incoming). Validated per environment.

Responses

  • 202 Accepted — Payload includes status: "success", a human-readable message (depends on immediate provider outcome), and data with transactionId, amount, fee, netAmount, status, provider, createdAt.
  • 400 — Missing idempotency key, validation errors, invalid webhook URL, amount outside bounds, inactive wallet, etc.
  • 401 / 403 — Invalid or expired token; wrong scope; IP allowlist; ineligible merchant. See Errors overview for shared auth errors.

HTTP status codes (API reference)

HTTPWhen
202Request accepted. Response includes transactionId and current data.status (PENDING, SUCCESS, or FAILED depending on the provider).
400Validation or business rule failure — e.g. missing X-Idempotency-Key, invalid walletAddress, amount below 500 UGX or above the per-transaction maximum, inactive wallet, invalid webhookUrl (HTTPS required in production), invalid Ugandan MSISDN, unsupported provider prefix, or MSISDN not eligible for collection.
403Account not allowed to move money: Your account has been disabled.; Your account is in view-only mode. This action is not allowed.; Your account is not verified. Please complete KYC.
404Wallet with address "…" not found for merchant
409Idempotency wait timeout: The same Idempotency-Key is still being processed. Retry after a few seconds with the same key, or wait for the in-flight request to finish.
429Rate limit exceeded.
500Unexpected server error — An unexpected error occurred. Retry or contact support with the requestId from the response.