Developers

Partner API

Developer APIs and sandbox environments on compliance-first, cloud-native infrastructure. Build world-class financial services without rebuilding the switch.

Production

https://api.mojaswitch.com/v1

Sandbox

https://api.sandbox.mojaswitch.com/v1

Quickstart

Integrate in three steps

01

Get API keys

Contact us for sandbox credentials. Production keys issued after partner onboarding.

02

Create a payment

POST /v1/payments with Idempotency-Key. Receive payment ID and initial status.

03

Handle webhooks

Verify Moja-Switch-Signature header. Update your system on payment.completed events.

Reference

API endpoints (v1)

POST/v1/paymentsCreate payment
GET/v1/payments/{id}Get payment status
POST/v1/payments/{id}/cancelCancel (pre-collection)
POST/v1/quotesFX quote (optional)

Example

Create a payment

All POST requests require Authorization and Idempotency-Key headers.

Request
POST /v1/payments HTTP/1.1
Host: api.mojaswitch.com
Authorization: Bearer sk_live_••••••••
Idempotency-Key: 7f3c8a2e-9b1d-4e5f-a6c7-8d9e0f1a2b3c
Content-Type: application/json

{
  "amount": { "value": "250.00", "currency": "CAD" },
  "recipient": {
    "type": "mobile_money",
    "phone": "+255712345678",
    "name": "Jane Doe"
  },
  "corridor": "ca-tz",
  "metadata": { "partner_ref": "inv_9281" }
}
Response
{
  "id": "pay_a1b2c3d4",
  "status": "processing",
  "amount": { "value": "250.00", "currency": "CAD" },
  "payout_amount": { "value": "412500.00", "currency": "TZS" },
  "fx_rate": "1650.00",
  "corridor": "ca-tz",
  "created_at": "2026-06-09T14:32:00Z"
}

Webhooks

Signed outbound callbacks

signature verification
// Verify webhook signature
const crypto = require('crypto');

function verifyWebhook(payload, signature, secret) {
  const [t, v1] = signature.split(',').map(p => p.split('=')[1]);
  const expected = crypto
    .createHmac('sha256', secret)
    .update(`${t}.${payload}`)
    .digest('hex');
  return crypto.timingSafeEqual(
    Buffer.from(v1),
    Buffer.from(expected)
  );
}