Skip to main content

Payments API Reference

Complete reference for the AfriRoute Payments APIs: mobile money, payouts, wallet, billing, invoicing, and fraud prevention.

Overview​

  • Base URL: https://api.afriroute.ai
  • Auth: Authorization: Bearer $AFRIROUTE_API_KEY
  • Content type: application/json
  • Rate limit: 100 requests/second per key
  • Currencies: ETB, KES, TZS, UGX, GHS, RWF, ZMW, NGN, and more

Mobile Money​

MethodPathDescription
POST/v1/payments/mobile/initiateStart a mobile money charge
GET/v1/payments/mobile/:payment_idGet payment status
curl -X POST https://api.afriroute.ai/api/v1/payments/mobile/initiate \
-H "Authorization: Bearer $AFRIROUTE_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "amount": 500, "currency": "ETB", "phone_number": "+251911234567", "provider": "telebirr" }'
const res = await fetch('https://api.afriroute.ai/api/v1/payments/mobile/initiate', {
method: 'POST',
headers: { 'Authorization': 'Bearer $AFRIROUTE_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({ amount: 1000, currency: 'KES', phone_number: '+254712345678', provider: 'mpesa' })
});
console.log((await res.json()).payment_id);
import requests

requests.post(
'https://api.afriroute.ai/api/v1/payments/mobile/initiate',
headers={'Authorization': 'Bearer $AFRIROUTE_API_KEY'},
json={'amount': 50, 'currency': 'GHS', 'phone_number': '+233241234567', 'provider': 'mtn_momo'}
)

Payouts​

MethodPathDescription
POST/v1/payments/payoutSend a single payout
POST/v1/payments/payout/bulkSend a batch of payouts
GET/v1/payments/payout/:payout_idGet payout status
{
"payout_id": "out_xyz789",
"status": "processing",
"amount": 1000,
"currency": "ETB",
"recipient": "+251911234567"
}

Wallet​

MethodPathDescription
GET/v1/wallet/balanceCurrent balance
POST/v1/wallet/topupAdd funds
GET/v1/wallet/transactionsLedger history
POST/v1/wallet/auto-rechargeConfigure auto-recharge

Billing & Subscriptions​

MethodPathDescription
POST/v1/billing/plansCreate a plan
POST/v1/billing/subscriptionsSubscribe a customer
DELETE/v1/billing/subscriptions/:idCancel a subscription

Invoicing​

MethodPathDescription
POST/v1/billing/invoicesCreate an invoice
POST/v1/billing/invoices/:id/sendSend/resend
GET/v1/billing/invoices/:idGet an invoice
POST/v1/billing/invoices/:id/voidVoid an invoice

Fraud Prevention​

MethodPathDescription
POST/v1/payments/risk-checkScore a transaction
POST/v1/payments/fraud/rulesCreate a rule
POST/v1/payments/fraud/blacklistAdd to blacklist

Transactions​

GET /v1/payments/transactions
ParamTypeDescription
start_datestringInclusive ISO date
end_datestringInclusive ISO date
statusstringcompleted, failed, etc.
limitintegerPage size, default 50

Webhooks​

AfriRoute posts events to your callback_url. Verify the X-AfriRoute-Signature HMAC-SHA256 header against your webhook secret.

EventDescription
payment.completedMobile money charge succeeded
payment.failedCharge declined/failed
payout.completedPayout delivered
invoice.payment_succeededInvoice paid
subscription.cancelledSubscription ended
const crypto = require('crypto');

function verify(payload, signature, secret) {
const hash = crypto.createHmac('sha256', secret)
.update(JSON.stringify(payload)).digest('hex');
return hash === signature;
}

Payment Statuses​

pending · processing · completed · failed · cancelled · expired

Error Codes​

CodeHTTPDescription
UNAUTHORIZED401Missing/invalid API key
INSUFFICIENT_FUNDS402Customer wallet too low
INSUFFICIENT_WALLET_BALANCE402Your wallet too low for payout
INVALID_PHONE422Bad phone number format
PROVIDER_UNAVAILABLE503Provider outage
RATE_LIMITED429Exceeded 100 req/s
DUPLICATE_REFERENCE409Idempotency key reused

Last Updated: May 2026