M-Pesa Daraja Integration: A Practical Guide
Accepting M-Pesa online is essential for Kenyan businesses. The Daraja API powers STK Push, paybill, and B2C flows — but production integrations need careful handling of callbacks, idempotency, and reconciliation.
STK Push flow
- Your server requests payment from Safaricom with amount and phone number.
- The customer approves on their handset.
- Safaricom sends a callback to your registered URL with the result.
- You update order status only after verifying the callback signature and amount.
Common pitfalls
- Duplicate callbacks — Safaricom may retry; use idempotent order IDs.
- Missing reconciliation — Match Daraja reports with your database nightly.
- Sandbox vs production — Test credentials and URLs differ; plan a clear go-live checklist.
How Sierlab helps
We implement Daraja for e-commerce, SaaS billing, and custom apps — including admin dashboards for finance teams to track payments in real time.
Ready to add M-Pesa? Contact us for a scoped quote.
