Skip to Content
Pesa VoucherDeveloper Documentation

Deposits

Accept instant user deposits via M-Pesa Direct (STK Push) or Voucher Redemption using the Prepaid Float.


STK Push (Accept Payments from Customers)

Trigger an instant M-Pesa payment prompt on your customer’s phone. The customer enters their PIN, and funds are transferred directly to our account for float updates.

Endpoint

POST /stk_push

Production
https://payments.pesavoucher.com/api/v1/stk_push

Sandbox
https://sandbox.payments.pesavoucher.com/api/v1/stk_push

Request Example

curl -X POST https://payments.pesavoucher.com/api/v1/stk_push \
-H "Content-Type: application/json" \
-H "X-API-Key: pk_live_xxxxxxxxxxxxxxxxxxxx" \
-H "X-API-Secret: sk_live_xxxxxxxxxxxxxxxxxxxx" \
-d '{
"phone_number": "254708374149",
"amount": 1250.00,
"account_reference": "INV-2025-0891",
"transaction_desc": "Premium Plan – Annual Subscription",
"metadata": {
"customer_id": "CUST-8871",
"plan": "premium-annual"
}
}'

Request Parameters

ParameterTypeRequiredDescription
phone_numberstringYesCustomer phone in 254XXXXXXXXX format (auto-converts 07xx / +254)
amountfloatYesExact amount with 2 decimal places
account_referencestringYesYour internal invoice/order ID (max 12 chars recommended)
transaction_descstringYesMessage shown to customer on their phone
metadataobjectNoAny custom data you want attached to the transaction

Amount Rules

RuleValue
Minimum amount10.00 KES
Maximum per transaction150,000.00 KES
Decimal placesExactly 2
Examples250.00, 1099.50

Phone Number Handling

Automatically accepted & converted:

  • 254708374149 → recommended
  • 0708374149
  • +254708374149
  • 0718 374 149 (spaces ignored)

Invalid formats will return an error.

Success Response (Push Initiated)

{
"success": true,
"message": "STK push initiated successfully",
"data": {
"payment_id": "550e8400-e29b-41d4-a716-446655440000",
"merchant_request_id": "MERCHANT-20251120-001",
"checkout_request_id": "ws_CO_20112025143022123",
"customer_message": "Please check your phone and enter your PIN to complete payment",
"amount": 1250.00,
"phone_number": "254708374149"
}
}

The final result is delivered via your webhook.

STK Push Webhook Callback (Final Result)

{
"payment_id": "550e8400-e29b-41d4-a716-446655440000",
"merchant_request_id": "MERCHANT-20251120-001",
"checkout_request_id": "ws_CO_20112025143022123",
"status": "Success",
"result_code": "0",
"result_description": "The service request is processed successfully.",
"initial_amount": 1250.00,
"actual_amount": 1250.00,
"mpesa_receipt_number": "SKL9P2M4XQ",
"transaction_date": "20251120143245",
"phone_number": "254708374149",
"payer_phone": "254708374149",
"payer_name": "JOHN DOE",
"account_reference": "INV-2025-0891",
"timestamp": "2025-11-20 14:32:50"
}

Status Values & Actions

StatusMeaningRecommended Action
SuccessPayment completedCredit user account / fulfill order
FailedPayment rejectedShow error, allow retry
CancelledUser pressed CancelAllow retry
TimeoutUser didn’t respond in timeAllow retry (common result_code: 1037)

Common Result Codes

CodeDescription
0Success
1Insufficient balance
1032Cancelled by user
1037Timeout – no response
2001Invalid credentials / account issue

Sandbox Test Phone Numbers

Phone NumberBehavior
254708374149Always succeeds instantly
254711223344Always fails (insufficient funds)
254722334455User cancels
254733445566Timeout (no response)

Rate Limits

  • 60 requests per minute (default)
  • Burst up to 100/min
  • Higher limits available on request

You’re now ready to accept real-time mobile money payments though MPESA from customers!