API reference
Every Devbox service is one POST to /transactions/initiate. Name the service with its handle, send its fields in payload, and read the same envelope back, whichever service you call.
- Base URL
https://api.devbox.africa/api/v1- Endpoint
POST /transactions/initiate- Authentication
X-Api-Keyheader- Format
- JSON over HTTPS
Services
17 handles, grouped by what they doVerify
name_validationQuickstart#
From a new product to a working Sandbox request. Two steps happen in your dashboard, one on your server.
- Dashboard · ServicesEnable a service
Add it to your product and fill in its configuration.
- Dashboard · API keysCreate an API key
Scope it to the services you need. You'll see it once.
- Your serverSend your first request
This section's request, with your key. It uses Sandbox test values, so it passes validation.
Authentication#
Create a key on your product's API Keys page and send it in the X-Api-Key header with every request.
- Belongs to
- One product, and one environment
- Can call
- Only the services you scope it to
- Shown
- Once, when you create it
- Expires
- After 1 to 365 days, or never
- Revoke
- Any time, from the product's API Keys page
Keep keys on your server. Never put them in browser code, mobile apps, source control or logs.
Environments#
Every API key belongs to one environment. Don't send Live traffic with a Sandbox key, or test with a Live one.
Test requests without processing real transactions. Requests are checked against allow-listed test values.
Live transactions within limits. Ask for it from your product's Go live page in the dashboard.
Compliance approves your go-live request and your product's limits are removed.
Initiate a transaction#
Starts any operation. The service handle picks it; the payload carries its fields.
https://api.devbox.africa/api/v1/transactions/initiateHeaders
| Field | Description |
|---|---|
X-Api-KeystringRequired | API key for the environment you are calling. |
Content-TypestringRequired | Always application/json. |
Acceptstring | application/json. |
Body
| Field | Description |
|---|---|
servicestringRequired | Handle of the operation to run, such as wallet_debit. One of the 17 below. |
payloadobjectRequired | That service's fields. Include a unique reference wherever the service takes one. |
Responses#
Every service answers with the same envelope. What's specific to the operation is in data.
| Field | Description |
|---|---|
codestring | Result code. "00" means the operation succeeded. |
messagestring | Readable summary of the result. |
systemCodestring | Platform code for the result, such as I000 or E400. Useful when you contact support. |
systemMessagestring | Extra detail about the result, when there is any. |
dataobject or null | The operation's output. null when the request failed. |
Errors#
The HTTP status tells you whether the request got through; code and message tell you what happened to the operation.
- DoUse a unique reference for every operation.
- DoRetry only transient failures, with exponential backoff.
- Don'tRetry validation or authentication errors automatically.
- Don'tLog API keys or sensitive customer data.
Services#
Set service to one of these handles and send its fields in payload. Each sample uses Sandbox test values.
Mobile money and bank
Collect and pay out
Collects money from a mobile money wallet.
| Payload field | In the Sandbox sample |
|---|---|
referencestring | "YOUR_UNIQUE_REFERENCE" |
msisdnstring | "0241234567" |
networkstring | "MTN" |
amountnumber | 1 |
narrationstring | "Wallet debit" |
Pays money out to a mobile money wallet.
| Payload field | In the Sandbox sample |
|---|---|
referencestring | "YOUR_UNIQUE_REFERENCE" |
msisdnstring | "0241234567" |
networkstring | "MTN" |
amountnumber | 1 |
narrationstring | "Wallet credit" |
Collects money from a bank account.
| Payload field | In the Sandbox sample |
|---|---|
accountstring | "0012345678" |
shortnamestring | "GCB" |
amountnumber | 1 |
narrationstring | "Account debit" |
Pays money out to a bank account.
| Payload field | In the Sandbox sample |
|---|---|
accountstring | "0012345678" |
shortnamestring | "GCB" |
amountnumber | 1 |
narrationstring | "Account credit" |
Checkout and links
Get paid without building a form
Takes a payment through Manilla, the hosted checkout.
| Payload field | In the Sandbox sample |
|---|---|
referencestring | "YOUR_UNIQUE_REFERENCE" |
msisdnstring | "0241234567" |
networkstring | "MTN" |
amountnumber | 1 |
narrationstring | "Manilla payment" |
paymentMethodstring | "momo" |
Creates a payment link for a customer.
| Payload field | In the Sandbox sample |
|---|---|
referencestring | "YOUR_UNIQUE_REFERENCE" |
amountnumber | 1 |
customerEmailstring | "customer@example.com" |
narrationstring | "Pay by link" |
Airtime and bills
Airtime, power, water and TV
Airtime for a phone number. Takes the same payload as airtime_purchase.
| Payload field | In the Sandbox sample |
|---|---|
msisdnstring | "0241234567" |
networkstring | "MTN" |
amountnumber | 1 |
narrationstring | "Airtime purchase" |
Airtime for a phone number. Takes the same payload as airtime_topup.
| Payload field | In the Sandbox sample |
|---|---|
msisdnstring | "0241234567" |
networkstring | "MTN" |
amountnumber | 1 |
narrationstring | "Airtime purchase" |
Buys ECG prepaid electricity for a meter number.
| Payload field | In the Sandbox sample |
|---|---|
customerNumberstring | "54321098765" |
isMonthlyboolean | false |
amountnumber | 10 |
Pays a Ghana Water bill for a customer number.
| Payload field | In the Sandbox sample |
|---|---|
customerNumberstring | "GW123456789" |
isMonthlyboolean | false |
amountnumber | 10 |
Pays for a DStv subscription on a smartcard number.
| Payload field | In the Sandbox sample |
|---|---|
customerNumberstring | "7025123456" |
isMonthlyboolean | true |
amountnumber | 10 |
Pays for a GOtv subscription on a customer number.
| Payload field | In the Sandbox sample |
|---|---|
customerNumberstring | "2012345678" |
isMonthlyboolean | true |
amountnumber | 10 |
Messages and menus
SMS and USSD
Sends one message to one phone number.
| Payload field | In the Sandbox sample |
|---|---|
recipientstring | "0241234567" |
senderstring | "DevBox" |
messagestring | "Hello from the DevBox Sandbox" |
Sends one message to many phone numbers.
| Payload field | In the Sandbox sample |
|---|---|
recipientsarray of strings | ["0241234567","0551234567"] |
senderstring | "DevBox" |
messagestring | "Hello from the DevBox Sandbox" |
Sends one message to many phone numbers at the time in runAt.
| Payload field | In the Sandbox sample |
|---|---|
recipientsarray of strings | ["0241234567","0551234567"] |
senderstring | "DevBox" |
messagestring | "Hello from the DevBox Sandbox" |
runAtstring | "YYYY-MM-DDTHH:mm:ss" |
Starts a USSD session with a phone number.
| Payload field | In the Sandbox sample |
|---|---|
msisdnstring | "0241234567" |
referencestring | "YOUR_UNIQUE_REFERENCE" |
narrationstring | "USSD session" |
Verify
Before you pay
Looks up the name on a mobile money wallet before you pay it.
| Payload field | In the Sandbox sample |
|---|---|
accountNumberstring | "0241234567" |
networkstring | "MTN" |
Something here unclear or out of date? Tell us.
Try it#
Send a real Sandbox request from this page. Paste a Sandbox key, pick a service and send. The key stays in this page and is never written to browser storage.
/transactions/initiateSandbox onlySend the request to see the status and the response here.