Base URL
Core concepts
STK Push
Prompt a customer’s phone with an M-Pesa payment request and get a transaction back in
milliseconds.
Transaction status
Every transaction has a UUID and moves through a simple lifecycle to a terminal state.
Webhooks
Receive an HMAC-signed POST when a payment succeeds, fails, or expires — then confirm
with a status read.
Service wallet balance
Platform fees are prepaid from your service wallet. Check your balance and top up at
any time.
Integrations
Fortpesa for WooCommerce
Accept M-Pesa at checkout on your WordPress store — install the plugin, connect an
API key, and test a live order.
Fortpesa for Easy Digital Downloads
Accept M-Pesa at checkout on your EDD store — install the plugin, enable the
gateway, and sell digital downloads paid by STK push.
FormPesa form builder
Collect M-Pesa with free online forms — tickets, donations, school fees, orders,
and bookings. Powered by Fortpesa.
Payment link widget
Embed a payment link on any website — a modal button or inline iframe with prefilled
amount and phone. Two lines of code, any stack.
Libraries & SDKs
PHP SDK
Official PHP client — STK Push, transaction status, wallet balance and signed
webhooks, with safe retries and typed exceptions.
AI agents
Integrate with an AI agent
Let ChatGPT, Claude Code, opencode or Cursor build your M-Pesa integration —
paste one prompt, the agent fetches the skill file and writes the code.
Conventions
Amounts are whole KES integers (no cents).
150 means KES 150. M-Pesa moves whole
shillings only, so every amount, fee, and balance in the API is a plain integer of
shillings.- Currency is always
KES. - Timestamps are ISO 8601 (for example
2026-09-25T14:03:22+00:00). - Errors for API-level failures use a single envelope:
{ "error": { "code": "...", "message": "..." } }— see Errors. - Versioning happens in the URL (
/v1). Breaking changes will ship under a new version.