Get started
Introduction
daraja-openapi describes Safaricom's Daraja (M-PESA) API precisely, checks that description against the real sandbox every night, and builds everything else from it.
What's included
| Piece | What it's for |
|---|---|
| The spec | An OpenAPI 3.1 description of eleven Daraja operations and every callback they send |
| Five SDKs | TypeScript, Python, PHP, Kotlin and Swift clients that handle tokens, passwords, timestamps and phone formats |
| The mock | A local Daraja that sends real callbacks, so you can test every failure without the sandbox |
| The GitHub Action | The mock in your CI, in one step |
How the pieces fit
The spec is the source of truth. The SDK types are generated from it, the mock is tested against its schemas, and a nightly run calls the real sandbox and compares each answer with it. When Daraja changes, the nightly run opens a spec-drift issue the same day.
Who it's for
Developers who take or send M-PESA payments from a server: an online shop, a school-fees portal, a lending app, a SACCO system. Daraja must always be called from your server, never from a mobile app, because the app would carry your consumer secret and passkey to every phone.
Where to go next
Start with the quick start: your first STK Push takes about five minutes. If you already use Daraja, handling callbacks and errors and rate limits cover the traps most integrations hit in production.