M-Pesa Accounts
A record describes one shop number at Safaricom — Till ("Buy Goods") or Paybill: which till payment method the payments to this number fall on, which Daraja keys ERPJS uses to talk to Safaricom, and which address Safaricom notifies about payments. The register exists only in the Kenya version of ERPJS.
A till recognises itself by the payment method: if the codes of the till's third payment method include the payment method of an open M-Pesa account, that method's button opens the choice of a payment from M-Pesa Payments instead of amount entry.
Where to find it: Modules → M-Pesa → Registers → M-Pesa Accounts
Worked example
Account VIC-MALL:
| Field | Value | Why |
|---|---|---|
| Code | VIC-MALL |
the Safaricom notification writes it into the payment |
| M-Pesa number (Till / Paybill) | 512345 |
the number customers pay to — 5–7 digits |
| Number type | Till (Buy Goods) | Paybill — when the customer also types an account number |
| Payment Method | MPESA |
the third payment method of the tills that take this number |
| Daraja environment | Sandbox (test) | where the keys go: Safaricom's test or live environment |
| Daraja consumer key, Daraja consumer secret | mask | the Daraja app keys; stored encrypted |
| Closed | — | a closed account switches M-Pesa off for its payment method |
Keys. After saving the field shows a mask. Leave it as is — the key stays; type a new one — it replaces the old one; clear the field — the key is erased on saving. If you change the environment, enter the keys again: the system will not send the old keys to another environment. Without keys the account is saved and receives notifications — the keys are needed only to register the address with Safaricom.
One open account per number and per payment method. The till finds the account by the code of its third payment method, a payment — by the number it was paid to. Two open accounts on one number or one payment method are not saved.
The notification address secret is created by the server on the first save; the window neither shows nor changes it.
Window menu
- "Notification address" — the addresses Safaricom calls about payments (Confirmation URL and Validation URL). They carry the account's secret: whoever knows the address can post a payment. Shown only to those who may change M-Pesa accounts.
- "Register the address with Safaricom" — pass these addresses to Safaricom with the account's keys. The ERPJS address is
the one the window is open at: it must start with
https://and must not contain words Safaricom refuses in an address (M-Pesa, Safaricom, exe, cmd, sql, query). Save the account first: the saved record is registered; the Daraja keys are required. The rights are the same as for "Notification address".
Closing an account
The "Closed" box: notifications to the account's address are no longer accepted, and the till takes the third-method amount from the keyboard again, with no check. Payments already in the register stay.
Payments an open receipt took before the closing stay with that receipt, and after closing the till no longer lets you choose or remove a payment. So first close or delete such receipts, then close the account.
Connecting step by step — in the M-Pesa instruction.