GOING LIVE
After acquiring the paybill/till and admin account email sent to you, going live is as simple as ABC.
But before we can go through the going live process, let me make it clear that this process is for production till/paybills. If you are yet to acquire one, you can still develop on the sandbox.
For both live and testing development, you will need to have an account with Daraja. If you don't have one, create an account here (opens in a new tab).
Why Daraja Portal?
For us to integrate online Mpesa payments to our systems, we need to have the following credentials:
- Consumer Key
- Consumer Secret
- PassKey
We can get the three only from the Daraja portal. These will later help us authenticate our requests.
Getting Sandbox (Test) Credentials
Safaricom MPESA provides a sandbox environment to build and test your integrations.
Once logged in to the Daraja portal, on the "My Apps" tab, you select "Create New App".
Check all the checkboxes to avoid inconveniences.
Once the app is created, it will be listed under sandbox apps and you can copy the Consumer Key and Consumer Secret from there.
You will then click the "APIs" tab, it will take you to this page:
Click on "Simulate" and you will be taken to this page:
On your right-hand side, select your app from the dropdown and some credentials will show up as shown in the above image.
Copy the passkey and you should be done with the Daraja portal.
Getting Live Credentials
The process of acquiring credentials for a live paybill/till is quite simple and straightforward.
You won't need to create any app, just head over to the "Go Live" tab and follow the prompts.
Once you're done, an app will be created with the Consumer Key and Consumer Secret provided.
For live apps, the passkey will be sent via email immediately after going live.
Having gotten the three:
- Consumer Key
- Consumer Secret
- PassKey
We should be done with the Daraja portal.
Let's now dive into the actual code.