Skip to content

How do I automate M-Pesa payments?

CiraIQ works with M-Pesa through your own Safaricom Daraja app, so money goes straight to your Paybill or Till and CiraIQ never holds it.

StepUse it to
M-Pesa Payment (trigger)Start a workflow when someone pays your Paybill or Till. See payment triggers.
M-PesaSend a payment prompt (STK push) to a customer’s phone
M-Pesa PayoutSend money to phones: refunds, salaries, commissions (B2C)
M-Pesa TransactionCheck a payment by receipt number, or reverse one

From the Safaricom Daraja portal, add a connection with your app’s consumer key and consumer secret, your shortcode (Paybill or Till) and passkey. Start in the sandbox if you want to test, then switch to production keys.

Payouts, status checks and reversals also need an M-Pesa initiator connection: the initiator name and security credential Safaricom gives you for B2C.

CiraIQ sets up the callback addresses for you. There’s nothing to configure on your server.

OperationDoes
Request paymentSends the “Enter your M-Pesa PIN” prompt to the customer’s phone
Check statusChecks whether an earlier prompt was paid
SettingWhat it does
PhoneThe customer’s number, 07… or 2547…
AmountIn KES
Account referenceWhat the customer sees, for example the invoice number
DescriptionA short note
Transaction typePaybill or Buy Goods (Till)
Wait for resultWait (up to a set number of seconds) for the customer to pay, then carry on with the result
Maximum amountRefuse anything larger, as a safety check

The result says whether the customer paid, cancelled or didn’t answer, with the M-Pesa receipt number when paid. Follow with an If / Else to thank them or chase them.

Sends money from your B2C account to phones.

SettingWhat it does
ModeOne payout, or one per item (for example a payroll sheet)
Phone, Amount, Reference, RemarksWho, how much and why
Payment typeBusiness payment, salary or promotion
Pay each reference onceNever pays the same reference twice, even if the workflow re-runs
Maximum per payout, Maximum per run, Most recipients, Daily limitHard limits that stop a mistake from becoming expensive
Delay between payoutsSpace out bulk payouts
Dry runShows exactly what would be paid, without paying
OperationDoes
StatusLook up a transaction by its M-Pesa receipt number
ReverseReverse a payment you received, for example a customer who paid the wrong number

Reversals are off until you allow them, and have a maximum amount and a daily limit. Dry run is available here too.

See every M-Pesa template on the M-Pesa integration page.

Questions

Does CiraIQ hold my M-Pesa money?

No. CiraIQ uses your own Daraja app, so money goes straight to your Paybill or Till.

Can I send an STK push automatically?

Yes. The M-Pesa step's Request payment sends the PIN prompt to the customer's phone and can wait for the result.

How do I stop a payout mistake?

Use Dry run first, keep the per-payout, per-run and daily limits on, and turn on Pay each reference once.