Developer portal · REST API

Effortless M-Pesa
STK Push API integration.

$

Send M-Pesa STK Push payment requests directly to our API endpoint using the programming language of your choice. Save and manage transaction results via your callback URL to monitor successful or failed payments, and query the status of any transaction at any time through our status check endpoint.

Any language Callbacks & status checks REST, JSON in / JSON out
curl -X POST https://api.bosmi.org/stk-push \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "2547XXXXXXXX",
    "amount": 150,
    "callback_url": "https://yoursite.com/callback"
  }'

# response
{ "status": "success", "checkout_id": "bsm_x91..." }
<?php
$ch = curl_init('https://api.bosmi.org/stk-push');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'Authorization: Bearer YOUR_API_KEY',
  'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
  'phone' => '2547XXXXXXXX',
  'amount' => 150,
  'callback_url' => 'https://yoursite.com/callback'
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
import requests

r = requests.post(
    'https://api.bosmi.org/stk-push',
    headers={'Authorization': 'Bearer YOUR_API_KEY'},
    json={
        'phone': '2547XXXXXXXX',
        'amount': 150,
        'callback_url': 'https://yoursite.com/callback'
    }
)
print(r.json())  # { "status": "success", ... }
const res = await fetch('https://api.bosmi.org/stk-push', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    phone: '2547XXXXXXXX',
    amount: 150,
    callback_url: 'https://yoursite.com/callback'
  })
});
const data = await res.json();
Quickstart

Integrate in three steps

From zero to your first STK Push in minutes.

Get your API key

Register an account, link the account you want to receive funds to, and grab your API key from the dashboard.

Send an STK Push

POST the customer's phone number and amount to the STK Push endpoint in the language of your choice — the payment prompt appears on their phone instantly.

Handle the result

Receive success or failure results on your callback URL, or query any transaction at any time through the status check endpoint.

API Surface

Everything you need, nothing you don't

A small, focused API. Full request and response schemas live in the documentation.

POST

STK Push

Initiate an M-Pesa payment prompt on your customer's phone with a phone number and amount.

WEBHOOK

Callback URL

Successful or failed transaction results are delivered to your callback URL so you can save and manage them.

GET

Status Check

Query the status of any transaction at any time — perfect for reconciliation and retries.

Need help?

Talk to a human, fast

Stuck on integration or have a question about callbacks, settlements, or anything else? We're quick to respond.

Copied!