Skip to content
NOSTREL
Collections

Five ways to get paid.
One place they all land.

A till payment, a paybill payment, an STK prompt, a link sent on WhatsApp and an invoice are five different conversations with Safaricom. They become one row in one ledger, with one shape of event, before they reach you.

Which matters more than it sounds. The businesses that struggle with M-Pesa are rarely the ones that cannot take a payment. They are the ones taking payments four different ways and reconciling the four by hand on the last Friday of the month.

one prompt, one callbash
curl https://api.nostrel.com/v1/api/collections \  -H "Authorization: Bearer sk_live_••••••••" \  -H "Idempotency-Key: order-1042" \  -d phone=254712345678 \  -d amount=1850 \  -d reference=SC-1042
and then, when the payer is done
what we send youhttp
POST https://your-server.test/hooks/nostrelNOSTREL-Signature: t=1790000000,v1=5f2a...9cContent-Type: application/json

The rails

Pick by how much work it is, not by how clever it sounds

Four of the five need no engineering at all.

Read the seven states

STK push

Lipa na M-Pesa Online

Send an amount and a number. A prompt appears, they enter their PIN, you get a webhook.

One API call

Anything where your software already knows who is paying and how much.

Payment link

A URL you send

A link with an amount, or an open one. Send it on WhatsApp. No app, no account.

No code at all

Invoicing by message, and every business that will never write an integration.

Invoice

Line items and a due date

A payment link with line items, totals and a due date, that can also be filed.

No code at all

Business to business, where somebody needs a document for their own books.

Paybill

C2B, account-reference routed

They pay a paybill and type a reference. We match it and raise the same webhook.

Configure once

Customers who already know your paybill, and anyone who prints it on a receipt.

Till

Buy Goods

The counter case. No reference to mistype, which is why it suits a queue.

Configure once

Shops, restaurants, anywhere a person is standing in front of you.

State

Seven states, and one of them is the whole argument

This is the table your integration is really written against, so it is on the marketing page rather than three clicks into a reference.

  1. initiated

    We have accepted your request and are asking Safaricom to raise a prompt. Nothing has reached a handset yet.

    nothing movedpending, failed
  2. pending

    On the payer's phone. The slowest part, and the part you cannot speed up.

    nothing movedawaiting_confirmation, failed, timed_out
  3. awaiting_confirmation

    A callback claims success. We have not confirmed it. Your balance has not moved. Most platforms do not have this state, which is why most platforms can be made to credit a payment that never happened.

    nothing movedsuccess, failed
  4. success

    Confirmed independently, posted to the ledger, fee taken, webhook sent. Safe to ship the goods. This is a terminal state.

    balance changedfinal
  5. failed

    Cancelled, wrong PIN, no balance, or refused. The provider code is on the record. This is a terminal state.

    nothing movedfinal
  6. timed_out

    Nobody answered and the window closed. Worth retrying, unlike a failure. This is a terminal state.

    nothing movedfinal
  7. reversed

    Reversed at the provider. The ledger posts the reversal, so both stay visible. This is a terminal state.

    funds releasedfinal
Every state a collection can hold. A filled square is terminal: once a record is there it will not change again, which is what makes it safe to act on. A hollow one means something is still owed, by Safaricom, by the payer, or by us.

The event

The same shape, whichever rail it came in on

A till payment and an API payment differ by one field.

  • Amounts are integers

    Minor units, always. No float ever touches a money column, from the request through the ledger to the statement.

  • The fee is on the event

    Gross, fee and net, at the time it happened. Not derivable later from a rate card that has changed since.

  • The payer is masked

    You get enough to recognise a customer and not enough to be a liability if your logs leak.

  • The provider receipt is included

    The code the payer sees on their own phone, so a support conversation can start from the same string the customer is reading out.

collection.succeededjson
{  "id": "evt_8sk2mq04nf",  "type": "collection.succeeded",  "created_at": "2026-10-02T09:14:22Z",  "data": {    "id": "col_7dj4a2zeialj",    "state": "success",    "amount": 1850,    "currency": "KES",    "fee": 25,    "net": 1825,    "reference": "SC-1042",    "channel": "stk_push",    "payer_masked": "2547XXXXX678",    "provider_receipt": "SKL4H8T2QD"  }}

Signed with HMAC over exactly these bytes. The webhooks page works through verifying it, including the mistake nearly everyone makes once.

Where it lands

Collections and payouts in one list, because two lists is how the discrepancy starts

Search, filter and export, in one list.

app.nostrel.com/transactions
The NOSTREL transactions list, showing collections and payouts together with status, counterparty, reference and amount.
Every collection and every payout in one ledger view. Demonstration data from a development environment.

Not your problem

The parts nobody budgets for

Every one of these is a week somebody has lost to it, usually after launch, usually in public.

The double charge

Your HTTP client timed out and retried. The payer got two prompts. An Idempotency-Key is required here, so the second call returns the first result instead of taking more money.

The lost callback

Safaricom sent it, your server was restarting, it is gone. A scheduled sweeper asks the provider for the real outcome rather than waiting for a message that is not coming.

The month-end reconciliation

A daily job matches our ledger against the provider record for the same window and opens an exception for anything that does not line up, with a state so a person closes it.

The fee arithmetic

Percentage, fixed part, floor, ceiling, dated so a change is not retroactive. Computed once, posted to the ledger, visible on the transaction and in the statement.

The statement

Opening balance, in, out, fees, closing balance, for any date range, drawn from the same postings as the transaction list rather than computed a second way.

The 2am question

Which record do I believe. There is one ledger, it balances, and every movement has two sides. That is the answer and it is the reason the rest of this exists.

Try it against the real sandbox

Not a mock we wrote. Safaricom's own, where a cancelled prompt and an insufficient balance behave the way they will on the day it matters.