STK Push
STK Push API for your own paybill or till
One POST sends the M-PESA PIN prompt to your customer's phone. You keep your shortcode and your settlement account; we handle the Daraja tokens, passwords, timestamps and callbacks.
Every prompt is confirmed with Safaricom's STK Query before we call it paid.
curl -X POST https://api.mypayments.co.ke/api/v1/stk \
-H "Authorization: Bearer $MYPAYMENTS_KEY" \
-H "Content-Type: application/json" \
-d '{"account":"<your paybill uuid>","phone":"0712345678",
"amount":"1500","reference":"INV-2041"}'How stk push works
Your reference, your tracking id
Send your own order reference and tracking id with the prompt. They come back on the webhook and on the transaction lookup, so you match payments to orders without a mapping table.
A callback is a claim, not a payment
Safaricom's callback can be late, repeated or forged. We treat it as a hint, query the result server to server, compare the amount with what you asked for, and only then settle.
Per-request callback URLs
Point a single payment at a different endpoint when you need to. The signing secret stays the one on your account, so verification code does not change.
Questions about stk push
Do I need my own paybill or till?
Yes. You bring the shortcode and its Daraja credentials; money settles to your account, not ours.
What happens if the customer cancels?
The transaction is marked failed with Safaricom's result code and you receive a webhook saying so.