🚀 MPay v2 API Integration Guide

This document guides frontend/UI developers on how to integrate with the MPay v2 backend API.

🌐 Base URL

https://api.mpay.africa/api

🔐 Authentication

All protected routes require Bearer Token:

Authorization: Bearer {token}
Accept: application/json

1️⃣ Authentication & Onboarding

Register

POST /auth/register

{
  "account_type": "personal",
  "name": "John Doe",
  "email": "john@example.com",
  "phone": "254712345678",
  "password": "password123"
}

Verify Email OTP

POST /auth/verify-email

{
  "email": "john@example.com",
  "otp": "123456"
}

Login

POST /auth/login

{
  "email": "john@example.com",
  "password": "password123"
}

Set Transaction PIN

POST /auth/set-pin

{
  "pin": "1234"
}

Complete KYC

POST /auth/complete-kyc

Use multipart/form-data:

Onboarding Status

GET /auth/onboarding-status


2️⃣ Dashboard

Dashboard Summary

GET /auth/dashboard/summary

{
  "user": {
    "name": "skysoft",
    "email": "dennisdeveloper3@gmail.com",
    "vendor_id": 231
  },
  "wallets": {
    "service_wallet": 0,
    "payments_wallet": 4870,
    "currency": "KES"
  },
  "payment_channels": [],
  "recent_transactions": [],
  "payment_link": {
    "url": "https://api.mpay.africa/payme/231",
  }
}

3️⃣ Transactions

Payins (Inbound Payments)

POST /transactions/payins

{
  "amount": 500,
  "phone": "254712345678",
  "country": "KE",
  "network": "MPESA"
}

Payouts (Transfers / Withdrawals)

POST /transactions/payouts

{
  "amount": 1000,
  "phone": "254712345678",
  "country": "KE",
  "network": "MPESA",
  "reference": "INV-1001"
}
Unified transaction model handles both local and global transfers.

4️⃣ Reports & Analytics

Overview

GET /reports/overview

{
  "total_inbound": 7897765.92,
  "total_outbound": 7760997.42,
  "total_transactions": 67033,
  "total_customers": 5196
}

5️⃣ Clientele (Beneficiaries)

Sync Clientele

POST /clientele/sync

Generates unique customers from transaction history.

Fetch Clientele List

GET /clientele


6️⃣ Payment Channels

List Channels

GET /payment-channels

Create Channel

POST /payment-channels

{
  "channel_type": "paybill",
  "channel_id": "4124297",
  "account": "Customer"
}

Toggle Channel

PATCH /payment-channels/{id}/toggle


7️⃣ Payment Links (Lipwa)

List Links

GET /payment-links

Create Payment Link

POST /payment-links

{
  "title": "Website Payment",
  "amount": 2500
}

Public Payment Page

GET /payme/{vendor_id}

No authentication required.


8️⃣ Logout

POST /auth/logout


⚠️ Frontend Integration Rules