Daraja Local How-To Guides

Daraja Local

This folder contains practical guides for using Daraja Local during local M-Pesa Daraja development.

Guides

Default Server URL

Unless changed, Daraja Local listens on:

http://127.0.0.1:8080

CLI commands that talk to a running server use that same URL by default.

Main STK Push Flow

1. Your app -> Daraja Local
   POST /mpesa/stkpush/v1/processrequest

2. Daraja Local -> Your app
   Returns CheckoutRequestID immediately.

3. Your app
   Saves CheckoutRequestID and marks the payment PENDING.

4. Developer or automated test -> Daraja Local
   Calls approve, fail, or timeout for that CheckoutRequestID.

5. Daraja Local -> Your callback URL
   POSTs the final transaction result.

6. Your app
   Updates the payment status from the callback.