Setting up M-Pesa
Set it up in test mode first where M-Pesa offers one, and switch to live when a test has worked. Allow an hour, plus any time that M-Pesa needs to approve your account.
2 min read
What you need first
- A Safaricom till or paybill number, and an app on the Safaricom Daraja developer portal with the Lipa na M-Pesa products on it.
Your keys and where to find them
| Field | Where it comes from |
|---|---|
| Consumer Key and Consumer Secret | On the Daraja portal open your app; both are on its page. |
| Passkey | Safaricom gives you the Lipa na M-Pesa Online passkey when your number goes live. The sandbox has its own. |
| Business Shortcode (auth) and Shortcode Type | The head office or paybill number your app works under, and whether you take money on a Buy Goods till or a paybill. |
| Till Number (PartyB) and Store Number (C2B) | The number customers pay. Leave them empty if it is the same as the shortcode. |
| Business Name | The name shown on the customer's prompt. |


Set it up
- Open Settings›Apps & Features, find M-Pesa and click Activate.
- Open Settings›M-Pesa, start in Sandbox, fill in the Daraja details and save. Click Test connection: it tells you whether Safaricom accepted them.
- Click Register C2B URLs once. Payments customers make straight to your number only reach this system after that.
- Open Point of Sale›Configuration›Payment Methods and click New. Set Payment Method Type to Payment Terminal and Integrate with to M-Pesa, and pick the M-Pesa configuration.
- Under Point of Sale, click the registers that should offer this method, then Save.
- Ring up a small sale and try it. When it works, switch Settings›M-Pesa to Production with your live details, and click Register C2B URLs again.
Test and live
In Sandbox nothing is real: Safaricom sends the prompts from its test system and no money moves. In Production every prompt asks a real customer for real money.