Daraja is the set of M-Pesa APIs Safaricom offers to businesses. You do not need to write code to benefit from it, but you should understand the pieces.
The pieces
- An app on the Daraja portal, which gives you a consumer key and secret
- A shortcode: your paybill or till number
- A passkey for STK push
- A callback URL where results are delivered
Sandbox and production
Daraja has a sandbox for testing with fake money and a production environment for real payments. Always test in the sandbox first, then move to production once your shortcode is approved for it.
Security matters
Treat the consumer secret and passkey like passwords. Store them encrypted, never paste them into chats and rotate them if you suspect exposure. The callback URL should contain a secret token and your system should verify results with Safaricom rather than trust a bare request.
Where billing software fits
Billing software holds your Daraja details, sends the prompts, receives callbacks and links confirmed payments to invoices and subscriptions. You keep ownership of your shortcode and your money goes straight to you.
Setup checklist
- Create a Daraja account and an app
- Note the consumer key and secret
- Have your paybill or till and passkey ready
- Decide your public https callback address
- Test in sandbox, then request production access
How PixelBilling helps
PixelBilling stores your Daraja details encrypted, shows a per-ISP callback URL with a secret token, can test the credentials with one click and keeps a reconciliation list of every prompt.
Common questions
Is the sandbox money real?
No. The sandbox uses test credentials and fake transactions so you can try the flow safely.
Do I need a developer?
Not if your billing software supports Daraja. You still need to follow Safaricom's steps and keep your credentials safe.
What happens if my callback address is down?
Results may be missed. A good system lets you check a request's status with the provider and has timeouts for unanswered prompts.
See PixelBilling with your own data
Start a free trial, import your customers and watch a payment turn into a connection. Or send us your questions.