EElaPay

ElaPay API

One integration for M-Pesa, Tigo Pesa, Airtel Money, MTN MoMo, Vodafone Cash and cards — across Tanzania, Ghana, Kenya, Uganda, Rwanda, Nigeria and more. Base URL: https://pay.ela.co.tz/

1. Get your keys

Admin → Merchants → add your system. You get an API key (identifies your system) and a webhook secret (signs events sent to you).

2. Create a checkout

POST /api/v1/checkout
X-Api-Key: ep_live_xxx
Content-Type: application/json

{
  "amount": 25000, "currency": "TZS", "reference": "INV-1042",
  "description": "School fees Term 1",
  "customer": {"name": "Asha Juma", "email": "asha@example.com", "phone": "+255712345678"},
  "return_url": "https://yourapp.co.tz/payments/return",
  "metadata": {"student_id": 55}
}

→ 201 {"ok": true, "checkout_url": "https://pay.ela.co.tz/pay/…", "payment": {"id": "EP260916AB12CDE", "status": "initiated", …}}

Redirect the customer to checkout_url. After paying they return to your return_url with ?elapay_id=EP…&reference=INV-1042&status=successful. Never trust the return URL alone — confirm with the webhook or GET /api/v1/payments/{id}.

3. Receive the webhook

ElaPay POSTs to your Webhook URL when a payment succeeds. Header X-ElaPay-Signature = HMAC-SHA256 of the raw body using your webhook secret.

{"event": "payment.successful", "payment": {"id": "EP…", "reference": "INV-1042", "amount": 25000, "currency": "TZS", "status": "successful", "channel": "mobilemoneytz", "paid_at": "2026-09-16 21:10:00", "metadata": {…}}, "sent_at": "…"}

Reply with HTTP 200. If your endpoint was down, re-send from Admin → Payments → Resend, or POST /api/v1/payments/{id}/resend.

4. PHP in 10 lines

require 'ElaPay.php';
$pay = new ElaPay('ep_live_xxx', 'ep_sec_xxx');
$r = $pay->checkout(['amount' => 25000, 'currency' => 'TZS', 'reference' => 'INV-1042',
    'customer' => ['name' => 'Asha', 'phone' => '+2557…'], 'return_url' => 'https://yourapp/return']);
header('Location: ' . $r['checkout_url']);

// webhook.php
$event = $pay->receiveWebhook();                 // 401 automatically if signature is wrong
if ($event['event'] === 'payment.successful') markPaid($event['payment']['reference']);

Download: ElaPay.php

Other endpoints

Sandbox

While sandbox mode is on, the checkout page shows "Simulate success / failure" buttons and no money moves — your webhooks and return URLs behave exactly like production. Currencies: TZS, GHS, KES, UGX, RWF, NGN, ZAR, USD, GBP, EUR.