If you want to accept M-Pesa payments directly from Safaricom's Daraja API — without going through an aggregator like PayHero — you can. This is more work but gives you direct control. For most sellers, PayHero is much easier.
When to use direct Daraja vs PayHero
- Direct Daraja — you have your own M-Pesa Till, Paybill, or Buy Goods number, and you've been approved for Daraja API access by Safaricom. Best for established businesses.
- PayHero — you don't want to deal with Safaricom's approval process. PayHero handles all of that for you and works for new sellers.
If both are configured, your shop hides direct M-Pesa and only shows PayHero at checkout — fewer points of failure for customers.
Before you start (direct Daraja)
You need:
- A registered M-Pesa Till, Paybill, or Buy Goods shortcode
- An approved Daraja application at developer.safaricom.co.ke
- Three credentials from Safaricom: Shortcode, Consumer Key, Consumer Secret, and Passkey (for STK Push)
Getting Daraja approval can take weeks. Plan accordingly.
Step 1 — Get your credentials from Safaricom
- Log in to developer.safaricom.co.ke
- Open your approved app
- Note the Consumer Key and Consumer Secret
- Under STK Push, generate a Passkey tied to your shortcode
Step 2 — Connect M-Pesa in your shop
- Go to Dashboard → Shop and scroll to the Accept Payments section
- Tap M-Pesa
- Enter your Shortcode, Consumer Key, Consumer Secret, and Passkey
- Save
Test before going live
The Daraja sandbox uses a test shortcode (174379) and a default test passkey. Use these first to confirm the flow works, then switch to your live credentials.
Common issues
- "Invalid credentials" — Daraja keys regenerate when you reset your app. Re-copy from the Safaricom portal.
- "Shortcode not found" — Your shortcode isn't linked to your Daraja app yet. Contact Safaricom support to link them.
- STK push works in sandbox but not live — your live shortcode/passkey wasn't enabled for STK Push. Most common cause: still pending Safaricom approval.
Direct M-Pesa fees
You pay Safaricom's standard M-Pesa transaction fees (these vary by transaction size and shortcode type). No additional fee from us.