Getting Started with M-Pesa STK Push¶
M-Pesa STK Push (Lipa na M-Pesa Online) triggers an instant PIN prompt on your customer's phone to complete checkout payments or settle invoices. Here is how to configure Safaricom Daraja API access for your JengaStack instance.
1. Safaricom Daraja Prerequisites¶
Because payments are routed directly to your business Till or Paybill number, you must register your shortcode with Safaricom.
- Go to the Safaricom Daraja Developer Portal and sign up.
- Create a new App in your developer account.
- Once approved, copy your App credentials:
- Consumer Key: Used to authenticate your Odoo server with Safaricom.
- Consumer Secret: Private credential used for the OAuth handshake.
- Lipa Na M-Pesa Passkey: Key used specifically to initiate STK Push prompts.
- Business Shortcode: Your Paybill or Till number.
2. Configuration Options¶
You can configure M-Pesa integration either from the JengaStack Dashboard or directly inside your Odoo instance.
Option A: JengaStack Control Panel (Recommended)¶
- Log into the JengaStack Dashboard.
- Choose your instance and click Update Compliance.
- Fill in your M-Pesa Till/Paybill number and Daraja Passkey.
- Save the form. The platform automatically triggers a Celery task to register the credentials and configure callback routing in Odoo.
Option B: Direct Configuration in Odoo¶
- Log into your tenant Odoo instance.
- Go to Accounting > Configuration > M-Pesa Daraja Config.
- Create a configuration record and enter your Business Shortcode, Consumer Key, Consumer Secret, and Passkey.
- Select the environment (Sandbox for testing, Production for live payments).
- The Callback URL will automatically configure to your Odoo instance domain (e.g.,
https://yourdomain.jengastack.app/jenga/mpesa/stk/callback).
3. Testing in Sandbox Mode¶
To test M-Pesa payments before going live:
* Safaricom provides default developer test credentials (Shortcode 174379, public sandbox Consumer Key/Secret, and a test Passkey).
* Select Sandbox mode in your Odoo M-Pesa configuration.
* Test by triggering an invoice payment using a Safaricom sandbox test number to simulate successful payments, cancellations, or timeout scenarios.