Getting Started
REST API Overview
The Infinity Africa API lets you accept mobile money collections, generate payment links and invoices, and send disbursements — from a website, a mobile app, an ecommerce platform, or your own backend. It's a predictable, versioned REST API: JSON in, JSON out, one response shape everywhere.
Base URL
Every endpoint in these docs is relative to your environment's base URL:
Production https://api.infinityafrica.net
Sandbox https://sandbox.infinityafrica.net
Local dev http://localhost:8000The response envelope
Every response — success or error, single object or paginated list — has the same top-level shape, so you only need to write one response parser:
{
"success": true,
"data": { "...": "..." },
"meta": null
}{
"success": true,
"data": [ { "...": "..." } ],
"meta": { "page": 1, "page_size": 20, "total": 42, "total_pages": 3 }
}{
"success": false,
"error": {
"code": "insufficient_balance",
"message": "Insufficient balance: available TZS 100,000, requested TZS 5,000,000",
"details": null
}
}List endpoints accept ?page=1&page_size=20 (page_size caps at 100). See Error Codes for the full list of error.code values.
Authentication
Server-to-server requests — from your backend, not a browser — authenticate with an API key generated in the Merchant Portal, sent as an Authorization: Bearer header (or the equivalent X-API-Key header). Full detail, including scopes, sandbox vs. live keys, and key rotation, is in API Key Authentication.
Authorization: Bearer inf_live_51HbXxxxxxxxxxxxxxxxxxxxxxxxIdempotency
Every endpoint that moves money — creating a payment link, initiating a collection, requesting a disbursement, or a customer completing a checkout — requires an Idempotency-Key header (any unique string, e.g. a UUID you generate per attempt). Retrying the same key with the same request body replays the original response instead of double-processing; reusing the key with a different body is rejected with 409 idempotency_key_reused.
Always generate a fresh key per user action, not per HTTP request
API resources
Collections API
Push USSD, STK Push, Selcom Pesa Push, and Dynamic QR collections.
Payment Links API
Generate shareable checkout links for any amount.
Invoices API
Itemized invoices with a built-in Pay Now link.
Disbursements API
Payouts to Selcom Pesa, mobile wallets, or bank accounts.
Webhooks
Real-time event notifications delivered to your server.
Error Codes
Every error code the API returns, and what to do about it.
Rate limits
Each merchant API key is limited to 120 requests per minute by default. Responses include no special rate-limit headers yet — if you need a higher limit for a high-volume integration, contact us.
Who this API is for
The same REST API powers every kind of integration — a checkout flow on a website, a native mobile app, an ecommerce plugin, or an internal web app calling Infinity Africa from your own backend. There's no platform-specific SDK required: any language or framework that can make an HTTPS request and parse JSON can integrate. See cURL, JavaScript, and Python examples to get started in your stack.
