Daraja Local product poster showing API request, sandbox engine, callback card, and STK Push phone mockup
Unofficial • Local-first • Developer sandbox

Daraja Local

Unofficial local sandbox for M-Pesa Daraja API integrations. Build, test, and debug STK Push flows, callbacks, transaction states, and payment edge cases locally before going live.

local test flow
daraja-local start
curl http://127.0.0.1:8080/health
# Create STK Push → save CheckoutRequestID → approve/fail/timeout → receive callback

Test the parts that usually break.

Daraja Local gives developers a repeatable payment sandbox that behaves like the Daraja integration surface without touching Safaricom or moving real money.

Simulate STK Push

Create pending local transactions and move them into success, failure, or timeout states.

Test Callbacks

Send Daraja-style webhook payloads to your app and confirm callback handling.

Replay Edge Cases

Reproduce failed callbacks, insufficient funds, timeouts, and final-state transitions.

Inspect Transactions

Debug the in-memory transaction store, raw requests, state, and callback attempts.

Local payment workflow.

The immediate STK Push response is only an acknowledgement. Your app should wait for callbacks or query status before finalizing payments.

1

Create request

Your app sends a Daraja-style STK Push request to /mpesa/stkpush/v1/processrequest.

2

Store pending state

Daraja Local returns IDs and stores the transaction as PENDING in memory.

3

Simulate outcome

Approve, fail, timeout, or replay the callback to validate your application logic.

Docs + GitHub

Ship local M-Pesa integrations with confidence.

Use the guides to install the CLI, start the emulator, test OAuth, create STK Push requests, simulate outcomes, replay callbacks, and inspect transactions.