Payments & Billing8 min read

    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.

    This integration uses your own Daraja credentials — meaning all payments go directly to your Paybill. Jasiyo never holds your customers' money. This is the recommended setup for all ISPs with a Safaricom Paybill.

    Getting your Daraja credentials

    You need four things from Safaricom:

    CredentialWhere to find it
    Consumer Keydeveloper.safaricom.co.ke → My Apps → your app → Consumer Key
    Consumer Secretdeveloper.safaricom.co.ke → My Apps → your app → Consumer Secret
    Shortcode (Paybill)Your Safaricom business account — the 5-7 digit Paybill number
    PasskeyProvided by Safaricom when they activate C2B on your Paybill. Contact your Safaricom account manager if you don't have it.
    Make sure your Daraja app has the following products activated: C2B v2 and STK Push (Lipa Na M-Pesa Online). If not, contact Safaricom developer support to activate them on your app.

    Setup in Jasiyo

    1

    Go to Payments

    In your ISP dashboard, click Payments in the sidebar.

    2

    Click Connect M-Pesa (Daraja)

    Find the Daraja card and click Connect or Configure.

    3

    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.

    4

    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.

    5

    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
    The callback only needs to be registered once. If you later change your Daraja credentials (new Consumer Key/Secret), you'll need to re-register. The button will show the current registration status.

    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.

    Share each customer's account number with them when you onboard them. If SMS is configured, it's included automatically in the welcome SMS.

    STK Push

    STK Push sends a payment prompt directly to a customer's phone. To use it:

    1. Open the customer's detail panel in Jasiyo
    2. Click Request Payment (STK Push)
    3. Enter the amount (defaults to their plan price)
    4. The customer receives an M-Pesa prompt on their phone
    5. They enter their PIN and approve
    6. 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.