/
WebsiteSupport

DocsM-PesaM-Pesa

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

FieldWhere it comes from
Consumer Key and Consumer SecretOn the Daraja portal open your app; both are on its page.
PasskeySafaricom gives you the Lipa na M-Pesa Online passkey when your number goes live. The sandbox has its own.
Business Shortcode (auth) and Shortcode TypeThe 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 NameThe name shown on the customer's prompt.
The product carries its own help page for M-Pesa, with these steps beside the Add button.
The product carries its own help page for M-Pesa, with these steps beside the Add button.

Set it up

  1. Open SettingsApps & Features, find M-Pesa and click Activate.
  2. Open SettingsM-Pesa, start in Sandbox, fill in the Daraja details and save. Click Test connection: it tells you whether Safaricom accepted them.
  3. Click Register C2B URLs once. Payments customers make straight to your number only reach this system after that.
  4. Open Point of SaleConfigurationPayment Methods and click New. Set Payment Method Type to Payment Terminal and Integrate with to M-Pesa, and pick the M-Pesa configuration.
  5. Under Point of Sale, click the registers that should offer this method, then Save.
  6. Ring up a small sale and try it. When it works, switch SettingsM-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.

See also