Requesting M-Pesa and Airtel Money payments from an invoice
Send a payment prompt to your customer's phone from a Sales Invoice, and have the payment recorded automatically.
Overview
You can ask a customer to pay a Sales Invoice by M-Pesa or Airtel Money without leaving the invoice. Hesabu ERP sends a prompt to the customer's phone. The customer enters their PIN, and the payment is recorded against the invoice for you, with the receipt number.
This feature is set up for your workspace by Hesabu ERP support. Ask us to switch it on. After that, an administrator adds your payment provider details, as described below.
How the money reaches you
Hesabu ERP never holds your money. The payment goes to your own account with the provider you choose.
| Provider | Where the customer's money goes | When you see it |
|---|---|---|
| Paystack (M-Pesa or Airtel Money) | Paystack first, then paid out to the bank account or M-Pesa number you added in your Paystack account | Usually the next business day. Paystack deducts its fee. |
| Safaricom Daraja (M-Pesa direct) | Your own paybill or till | Straight away. No Paystack fee. Needs Safaricom approval for your shortcode. |
| Airtel Money Open API (Airtel direct) | Your own Airtel Money merchant account | Straight away. Needs Airtel approval. |
Hesabu ERP records the payment on the invoice as soon as the customer confirms, whichever provider you use. With Paystack, your till or bank statement shows the money only after Paystack pays out.
You can use a different provider for each network. For example, M-Pesa direct and Airtel Money through Paystack.
Prerequisites
- An approved account with your chosen provider, and its keys. Keep test keys for testing.
- A bank or cash account in your chart of accounts to record received money, one for M-Pesa and one for Airtel Money if you use both. See The chart of accounts.
- The invoice is submitted, in KES, and has an outstanding balance.
- Permission to create Payment Entries (for example Accounts User).
Steps
Set up (administrator, once)
- Search for Mobile Money Settings.
- For M-Pesa via and Airtel Money via, choose the provider for each network.
- Enter the provider's keys. Secrets are hidden after you save.
- Choose the M-Pesa receiving account and the Airtel Money receiving account.
- Tick Enabled and save.
- Click Test > Test M-Pesa connection and Test Airtel Money connection. Each should confirm your keys are accepted.
- Copy the callback addresses shown at the bottom of the page. Register the Paystack address in your Paystack dashboard (Settings, API Keys & Webhooks) and the Airtel address in the Airtel developer portal. Safaricom needs nothing to be registered.
Send a prompt (everyday use)
- Open a submitted Sales Invoice with a balance.
- Click Create > Request Mobile Money.
- Choose the network the customer will pay with, check the phone number (for example 0712 345 678) and the amount, then click Send prompt.
- Ask the customer to enter their PIN. The window shows Payment received when it is confirmed, and the invoice updates.
To see every prompt for an invoice, click View > Mobile Money Requests.
Practical example
A clinic invoices a patient KES 3,500 for a consultation. At the desk, the receptionist opens the invoice, chooses M-Pesa, confirms the patient's number and sends the prompt. The patient approves on their phone. The invoice turns Paid and a Payment Entry appears with the M-Pesa receipt number, so the receipt is already attached when the day is reconciled.
Statuses
| Status | Meaning |
|---|---|
| Pending | Waiting for the customer to enter their PIN |
| Success | Paid. A Payment Entry was created |
| Failed or Cancelled | The customer cancelled, entered a wrong PIN, or had too little money. Send a new prompt |
| Timeout | No answer within about 10 minutes |
| Needs Review | Money was received but something did not match, or the Payment Entry could not be created. See troubleshooting |
Important notes
- Prompts are in whole shillings and KES only. If an invoice has cents, the cents stay outstanding.
- You can ask for less than the full balance. The invoice then shows Partly Paid.
- You cannot send a second prompt for the same invoice for about two minutes. Wait for the first to finish.
- Never share your provider's secret keys.
- Provider fees are charged by the provider. Ask your accountant how to book them.
- Ask the customer to check the amount on their phone before entering the PIN. Customers cannot undo a payment from the invoice.
- Keep the provider's statement and reconcile it with your bank. See Bank accounts and bank reconciliation.
Common mistakes
- Using live keys while testing, which takes real money.
- Forgetting to choose the receiving account, so prompts will not send.
- Registering the Paystack address while Paystack is in the wrong mode. Test and live have separate addresses.
- Expecting Paystack payments to appear in your till straight away. They arrive after Paystack pays out.
Troubleshooting
- No prompt reached the phone. Check the number and network. Open Mobile Money Request, find the request and read the note.
- The invoice did not update after the customer paid. Wait a minute, then reopen the invoice. If the request is still Pending, check that the callback address is registered with the provider.
- Needs Review. Open the request and read the note. If the money was received but the Payment Entry failed (for example, the invoice was paid in the meantime), fix the cause and click Retry posting. If the amount did not match, check the provider's statement.
- Test connection fails. Re-enter the keys. Check that the Environment is Sandbox for test keys and Production for live keys.
Next steps
Read Payment gateways and Recording customer and supplier payments.