mobile wrapper API
# AfriPay — Unified Mobile Money API
**One API. M-Pesa, MTN MoMo, Airtel Money. 7 African countries.**
AfriPay wraps Safaricom Daraja, MTN MoMo, and Airtel Money into a single,
clean REST API. Pass a phone number and amount — AfriPay auto-detects the
network and routes the payment. No more juggling three different SDKs,
auth flows, and callback formats.
## What makes it different
- **Rust-powered core** — network detection, phone normalisation, HMAC
signing, and token management run in compiled Rust (~50× faster than JS
for these hot-path operations).
- **Auto network detection** — detects M-Pesa/MTN/Airtel from the phone
number prefix. No `network` field required.
- **Unified response format** — every provider returns the same JSON shape.
- **7 countries** — Kenya, Uganda, Ghana, Tanzania, Rwanda, Zambia, Nigeria.
- **Production-ready** — rate limiting, request IDs, structured logging,
webhook signature verification, Docker-ready.
---
## Project Structure
```
afripay/
├── rust-core/ Rust library: phone detection, signing, validation
│ ├── Cargo.toml
│ └── src/lib.rs
├── node-api/ Express API server
│ ├── src/
│ │ ├── server.js
│ │ ├── routes/ pay, status, disburse, balance, webhooks, keys, health
│ │ ├── services/ mpesa.js, mtnMomo.js, airtel.js
│ │ ├── middleware/ authenticate, rateLimiter, errorHandler, requestId
│ │ └── utils/ networkDetector, transactionStore, logger
│ ├── .env.example
│ ├── Dockerfile
│ └── package.json
├── dashboard/ Developer portal (HTML/CSS/JS — no framework needed)
│ └── index.html
└── docker-compose.yml
```
---
## Quick Start
### 1. Clone and install
```bash
git clone
github.com
cd afripay/node-api
npm install
cp .env.example .env
# Fill in your Daraja / MTN MoMo / Airtel credentials
```
### 2. Run in development
```bash
npm run dev
# API running at
localhost
```
### 3. Run tests
```bash
npm test
```
### 4. Deploy …