profile_id — creating a merchant account, generating keys, and setting up connectors are covered elsewhere.
Base URL for these examples:
https://api.sandbox.pesaswap.io. Authenticate every request with the api-key: {{api_key}} header. Swap the base URL for https://api.pesaswap.io in production.Start here
Accept your first payment
The shortest path to a real M-Pesa payment: create, let the customer approve on their phone, poll until it settles. Start here if you are new.
Collecting money
Wallet payments
M-Pesa Express, Airtel Money, and MTN MoMo. One request shape, three wallets.
Card payments and 3DS
Cards with 3D Secure — the redirect flow and how to confirm the real outcome.
Mandates and recurring
Save a payment method once, then charge the customer again when they are away.
Refunds
Return money to a payer against a payment that has already succeeded.
Paying money out
Payouts
Send money to a recipient over M-Pesa, Airtel, MTN MoMo, PesaLink, Paybill, or Paytill.
How a payment completes
Most flows in this guide share one shape. You create a payment, the customer approves it out of band (an STK prompt on their phone, or a bank 3DS challenge), and then you poll for the result:1
Create and confirm
POST /payments with confirm: true. The response comes back with a non-final status — the money has not moved yet.2
The customer approves
They enter their M-Pesa PIN, or complete the bank challenge. This happens on their device, outside your API calls.
3
Poll for the outcome
GET /payments/{payment_id}?force_sync=true until the status settles to succeeded or failed.