M-Pesa Daraja Integration
Full guide to connecting your Safaricom Daraja Paybill to Jasiyo — credentials, callback registration, C2B, STK Push, and troubleshooting.
The Daraja integration connects your Safaricom Paybill directly to Jasiyo. When customers pay using their unique account number, Safaricom sends a real-time notification to Jasiyo which automatically renews their subscription and re-enables them on the router.
Getting your Daraja credentials
You need four things from Safaricom:
| Credential | Where to find it |
|---|---|
| Consumer Key | developer.safaricom.co.ke → My Apps → your app → Consumer Key |
| Consumer Secret | developer.safaricom.co.ke → My Apps → your app → Consumer Secret |
| Shortcode (Paybill) | Your Safaricom business account — the 5-7 digit Paybill number |
| Passkey | Provided by Safaricom when they activate C2B on your Paybill. Contact your Safaricom account manager if you don't have it. |
Setup in Jasiyo
Go to Payments
In your ISP dashboard, click Payments in the sidebar.
Click Connect M-Pesa (Daraja)
Find the Daraja card and click Connect or Configure.
Enter your credentials
Fill in Consumer Key, Consumer Secret, Shortcode (Paybill number), and Passkey.
Leave Sandbox mode OFF for live payments. Only enable sandbox when testing with Safaricom's test credentials.
Set your Account Reference
The Account Reference is the label customers see when they initiate STK Push. Set this to your business name (e.g. FastNet Internet). For C2B payments, customers use their unique JSY-XXXXXX account code as the reference.
Save
Click Save. Your credentials are encrypted and stored securely.
Register the callback URL
After saving credentials, click Register Callback. This makes an API call to Safaricom to register Jasiyo's webhook URL with your Paybill. Without this step, Safaricom won't know where to send payment notifications.
Jasiyo registers the following callback URL with Safaricom:
https://www.jasiyo.com/api/admin/mpesa/callback
Customer account numbers
Every customer in Jasiyo has a unique account number (e.g. JSY-A1B2C3). When customers pay to your Paybill, they enter this as the account reference.
Jasiyo uses this reference to match the incoming M-Pesa payment to the right customer. You can find a customer's account number on their profile page.
STK Push
STK Push sends a payment prompt directly to a customer's phone. To use it:
- Open the customer's detail panel in Jasiyo
- Click Request Payment (STK Push)
- Enter the amount (defaults to their plan price)
- The customer receives an M-Pesa prompt on their phone
- They enter their PIN and approve
- Jasiyo receives the callback and renews their subscription
STK Push also works from the hotspot captive portal — customers can pay directly on the portal without you being involved.
Troubleshooting
⚠ Callback registration fails
Ensure C2B v2 is activated on your Daraja app. Check Consumer Key and Secret are correct (no extra spaces). Try switching to sandbox, registering, then switching back to production.
⚠ Payments are not showing up in Transactions
Check the callback is registered (green status in Payments page). Verify customers are paying to the correct Paybill using their exact JSY-XXXXXX account code. Check Jasiyo's Alerts page for any webhook error notifications.
⚠ STK Push times out or fails
Ensure the customer's phone number is correctly formatted (2547XXXXXXXX). STK Push requires the phone to be on and have M-Pesa active. Check your Daraja app has STK Push (Lipa Na M-Pesa Online) activated.
⚠ Customer paid but wasn't renewed
Check Transactions — does the payment appear? If yes, check if the account reference matches a valid customer account number. Unmatched payments (wrong account code) appear in Transactions with 'Unmatched' status.