The payment flow
1
Your app creates a payment
Your backend calls Moflay with the amount, phone number, description, and
optional customer details.
2
Moflay talks to Safaricom
Moflay uses the Daraja credentials saved for the current environment to send
the STK push request.
3
The customer approves the prompt
The payer confirms the payment on their phone.
4
Moflay processes the result
Safaricom sends its callback to Moflay. Moflay records the outcome and
updates the transaction state.
5
Your systems receive the final status
You can read the transaction in the dashboard or API (
GET /v1/payments/{id}),
and you can subscribe to signed Moflay webhooks such as payment.completed,
payment.failed, and payment.canceled.What Moflay adds around Daraja
- API and SDK endpoints for creating M-Pesa Express payments
- Daraja authentication using your saved credentials
- Payment request validation before Safaricom receives the request
- Safaricom callback processing and status updates
- Reconciliation-friendly payment and transaction records
- Signed webhook events for your backend
What you still need
- A Moflay account and organization
- An API key for the environment you are using
- A valid till or paybill before you move to production
- Production Daraja credentials if you want to accept real money
Where the money goes
Moflay is the developer infrastructure layer, not the settlement destination. Successful payments go to your configured M-Pesa till or paybill. Moflay does not hold customer funds.Why it works this way
Daraja is the access layer for M-Pesa. Production applications also need credential handling, request validation, state tracking, webhooks, retries, reconciliation records, and operational visibility. Moflay centralizes that production layer so your application can use one predictable interface while still settling into your own till or paybill.Callbacks vs webhooks
This distinction matters:- Safaricom callback: Sent by Daraja to Moflay so Moflay can finalize the transaction
- Moflay webhook: Sent by Moflay to your app so your system can react to payment or customer events