The M‑Pesa API, with the hard parts already handled
Send an STK push and get a signed webhook when the customer pays. Noria Pay runs Daraja on your own shortcode, confirms every STK push result with Safaricom and recovers the callbacks Daraja drops.
One request sends the prompt. Pay confirms the result with Safaricom, then posts a signed webhook.
STK push without the Daraja paperwork
Add your consumer key, secret, passkey and shortcode once, in sandbox or live. Pay requests and caches OAuth tokens, builds the password and timestamp for every request and trims references to the lengths Daraja accepts.
Paybill (CustomerPayBillOnline) and till (CustomerBuyGoodsOnline)
Sandbox and live credentials kept apart
Tokens cached encrypted, refreshed before they expire
A callback is not proof of payment
Pay authenticates each callback with a per-transaction token, then checks the outcome with Safaricom before it settles a collection. A forged or replayed callback cannot mark an order paid.
Per-transaction callback tokens, stored as hashes
Duplicate and out-of-order callbacks settle a payment once
A unique receipt index stops double settlement
Callbacks that never arrive
If Safaricom has not called back within a grace period, Pay queries the transaction itself and applies the answer. A request that timed out is looked up, never sent again, so a customer is never charged twice.
B2C payouts and reversals
Upload Safaricom's certificate and your initiator credentials once. Pay builds the encrypted security credential for every B2C payment and reversal. Refunds go back through the method the customer paid with.
In code
Verify a webhook
HMAC-SHA256 over the timestamp, a dot and the raw body, compared in constant time.
Yes. Noria Pay calls Daraja with your own credentials, and Safaricom settles payments straight to your shortcode. Noria never holds your money.
Can I use a buy goods till instead of a paybill?
Yes. Each M-Pesa method is set to paybill or till, and STK push uses the matching Daraja transaction type.
What happens if the customer never enters their PIN?
The payment fails or expires once Safaricom says so. Pay never marks a payment succeeded or failed without Safaricom's answer, and a late answer is still applied.
Does Noria Pay accept fractions of a shilling?
No. M-Pesa settles whole shillings, so Pay rejects fractional KES amounts instead of rounding them and leaving your records out of step with your statement.