daraja-openapi

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

PieceWhat it's for
The specAn OpenAPI 3.1 description of eleven Daraja operations and every callback they send
Five SDKsTypeScript, Python, PHP, Kotlin and Swift clients that handle tokens, passwords, timestamps and phone formats
The mockA local Daraja that sends real callbacks, so you can test every failure without the sandbox
The GitHub ActionThe 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.

View the source of this page

Built by ByteGigs Labs. Apache 2.0. M-PESA, Daraja and Safaricom are trademarks of Safaricom PLC; this project is independent and not endorsed by Safaricom.