Pesatrotal
Karibupesa.thetrotal.com

Collect Tanzania mobile money with a small, boring API.

Create a collection, wait for the AzamPay callback on pesa.thetrotal.com, and reconcile. Pay by Link is the hosted checkout on a separate host so customer pages never see merchant cookies.

01 · Start here

Getting started

Karibu is the public site. Register on me.thetrotal.com, complete KYC, then collect from your server against https://pesa.thetrotal.com. Checkout pages live only on pay-by-link.thetrotal.com.

Sandbox first

AzamPay sandbox credentials. No live money until KYC is APPROVED.

Server-side keys

Bearer keys never go in a browser or on a Pay by Link page.

02 · Security

Authentication

Server integrations use a merchant API key as a bearer token. Console login uses httpOnly cookies on me.thetrotal.com only. Never put a secret key in a browser or on pay-by-link.

Authorization header
Authorization: Bearer pk_live_…
POST/v1/collections

Create a collection

Amount is TZS major units (same as minor for TZS). Send an Idempotency-Key. Network must be canonical: MPESA_TZ, AIRTEL_MONEY_TZ, MIXX_BY_YAS_TZ, HALOPESA_TZ.

cURL request
curl https://pesa.thetrotal.com/v1/collections \
  -H "Authorization: Bearer pk_live_..." \
  -H "Idempotency-Key: inv_48291" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 137000,
    "currency": "TZS",
    "msisdn": "255712345678",
    "network": "MPESA_TZ",
    "merchant_reference": "inv_48291"
  }'
202 response
{
  "id": "pay_01J57R9",
  "status": "ACCEPTED",
  "amount": 137000,
  "currency": "TZS",
  "msisdn": "255712345678",
  "network": "MPESA_TZ"
}

04 · Events

Webhooks

AzamPay posts collection and disbursement callbacks to https://pesa.thetrotal.com/azampay/callback (alias payments.thetrotal.com). Register that URL in the AzamPay portal. Merchant application webhooks are a separate HTTPS URL you set on the console.

Callback URL
https://pesa.thetrotal.com/azampay/callback?token=YOUR_CALLBACK_TOKEN

05 · SMS

RafikiSMS

Optional. Vendor API from developers.rafikisms.com. We POST to https://api.rafikisms.com/v1/vendor/send-sms with header X-API-Key. Phone format 255XXXXXXXXX, 160 characters. Set RAFIKISMS_ENABLED=true and the key from Profile → Integration. Collection still succeeds if SMS fails.

06 · Reliability

Errors

Errors use stable codes. Pay by Link double-pay returns 409 checkout_in_progress. Expired links return 410.

StatusMeaning
400Invalid request
401Missing session or API key
403Merchant not ACTIVE
409Checkout already in progress
410Link expired or used
429Too many requests