API Documentation

Seamless M-Pesa integration for modern businesses. All responses are JSON formatted.

Authentication

Every request must include your secret_key, passkey, and shortcode — found in your dashboard.

{
  "secret_key": "sk_live_abc123xyz",
  "passkey": "b9f2c8a7d3e1f4h5j6k7",
  "shortcode": "1234567"
}
All requests are encrypted via TLS 1.2+

Initiate STK Push

POST   https://api.liparo.co.ke/v1/initiatestk

Parameters

ParameterTypeRequiredDescription
secret_keystringYesAccount secret key
passkeystringYes20-character passkey
shortcodestringYes7-digit Till/Paybill
amountnumberYesKES amount (min 1)
phonestringYes2547XXXXXXXX or 07XXXXXXXX
referencestringNoRequired for Paybill

Example

curl -X POST https://api.liparo.co.ke/v1/initiatestk \
  -H "Content-Type: application/json" \
  -d '{
    "secret_key": "sk_live_abc123",
    "passkey": "xyz789passkey123",
    "shortcode": "1234567",
    "amount": 100,
    "phone": "254712345678"
  }'

Response

{
  "success": true,
  "transaction_id": "LIP202401011200001234",
  "message": "STK Push initiated",
  "merchant_request_id": "12345-67890",
  "checkout_request_id": "ws_CO_123456789"
}
Save the transaction_id for status checks.

Transaction Status

POST   https://api.liparo.co.ke/v1/checktransaction

Parameters

ParameterTypeRequiredDescription
secret_keystringYesAccount secret key
passkeystringYesAccount passkey
shortcodestringYes7-digit shortcode
transaction_idstringYesFrom initiatestk response

Response

{
  "success": true,
  "transaction_id": "LIP202401011200001234",
  "status": "Completed",
  "amount": 100,
  "phone": "254712345678",
  "reference": "INV001",
  "mpesa_receipt": "MPESA123456789",
  "result_desc": "Payment successful"
}

Webhooks

Liparo sends a POST request to your webhook URL when a transaction completes. Respond with HTTP 200 OK within 5 seconds.

Payload

{
  "transaction_id": "LIP202401011200001234",
  "status": "Completed",
  "amount": 100,
  "phone": "254712345678",
  "reference": "INV001",
  "mpesa_receipt": "MPESA987654321",
  "result_desc": "Payment successful"
}
Configure webhooks in your dashboard. Idempotency keys recommended.

Error Codes

CodeErrorDescription
400Bad RequestMissing parameters or invalid format
401UnauthorizedInvalid credentials
404Not FoundTransaction not found
405Method Not AllowedHTTP method not supported
429Too Many RequestsRate limit exceeded
500Internal ErrorServer error — retry later
{
  "success": false,
  "error_code": 401,
  "message": "Invalid credentials"
}

Rate Limits

100 requests per minute per account. Exceed the limit and receive a 429 response.

Monitor usage via the dashboard.

Support

Need help? We're here for you.

Hours: 24/7 — We respond within 1 hour