REST API - Payments#
M-Pesa (STK push) and Snippe (mobile money + hosted checkout).
| Endpoint | Method | Description |
|---|---|---|
/projects/{id}/payments/settings | GET / PUT | Payment provider settings |
/projects/{id}/payments/mpesa/stk-push | POST | M-Pesa STK push |
/projects/{id}/payments/snippe/initiate | POST | Snippe direct payment |
/projects/{id}/payments/snippe/session | POST | Snippe hosted checkout |
/projects/{id}/payments/snippe/status/{reference} | GET | Payment status |
/projects/{id}/payments/transactions | GET | List transactions |
/projects/{id}/payments/transactions/{transactionID} | GET | One transaction |
M-Pesa STK push#
POST /projects/{id}/payments/mpesa/stk-push
Text{
"phone": "+255712345678",
"amount": 5000,
"description": "Order #123"
}
JSONThe customer authorizes on their phone; RafikiDB receives the callback and records the transaction.
Snippe#
Initiate a direct payment:
{
"amount": 5000,
"phone": "+255712345678",
"first_name": "Asha",
"last_name": "Mwinyi",
"email": "asha@example.com",
"order_id": "ORD-123"
}
TextHosted checkout session:
{
"amount": 25000,
"description": "Checkout",
"redirect_url": "https://myapp.com/thanks",
"customer_name": "Asha Mwinyi",
"customer_phone": "+255712345678",
"expires_in": 3600
}
JSONStatus#
GET /projects/{id}/payments/snippe/status/{reference}
TextReturns the payment state (pending / completed / failed / ...).
Callbacks#
Snippe and M-Pesa send callbacks to RafikiDB; you receive them as payment webhook deliveries (HMAC-signed like webhooks).
Security#
- Accepts the project API key (or a project-user session)
- Scoped keys:
payments:read,payments:write