Initiate an M-Pesa Express (STK Push) payment.
Permissions: express.pay
Documentation Index
Fetch the complete documentation index at: https://docs.moflay.com/llms.txt
Use this file to discover all available pages before exploring further.
The API key to use for authentication
Optional idempotency key used to safely retry the same Express payment request without creating duplicate payment attempts.
1 - 256"express_order_12345"
x <= 2500001 - 13Safaricom phone number in local (e.g., 0712345678, 0110123456) or international (e.g., 254712345678, 254110123456) format, transformed to 254XXXXXXXXX for M-PESA STK Push. Supports all Safaricom prefixes (070X, 074X, 0757–0759, 0768–0769, 079X, 0110–0117).
"254712345678"
25511 - 255Key-value object allowing you to store additional information.
Key Requirements:
Value Types:
Limits:
{
"user_preference": "dark_mode",
"last_login": 1640995200,
"is_premium": true,
"account_balance": 1250.75,
"notifications_enabled": false
}Short alphanumeric reference shown by M-Pesa and stored with the payment, such as an order or invoice number. If omitted, Moflay uses your configured default account reference.
1 - 12^[a-zA-Z0-9]+$"ORDER123"
Key-value object allowing you to store additional information.
Key Requirements:
Value Types:
Limits:
{
"user_preference": "dark_mode",
"last_login": 1640995200,
"is_premium": true,
"account_balance": 1250.75,
"notifications_enabled": false
}Payment Response
Payment Response
Unique identifier for the payment, prefixed with 'pay_'
"pay_ABC123DEF456GHI"
Unique identifier for the related transaction, prefixed with 'trxn_'
"trxn_ABC123DEF456GHI"
Unique identifier for the customer attached to the payment, prefixed with 'cus_'
"cus_GqfKXLmg61LURZhB"
Customer Safaricom phone number that received the M-Pesa STK Push
"254712345678"
Payment amount in the smallest currency unit
1000
Three-letter ISO currency code for the payment
"KES"
Initial payment status after the STK Push request is accepted
pending "pending"
Short customer-facing payment description
"Premium plan"
Short alphanumeric reference that was sent to M-Pesa and stored with this payment, such as an order or invoice number.
"ORDER123"
Environment where the payment was created. Either 'sandbox' or 'production'
sandbox, production "sandbox"
Timestamp when the payment request was accepted (ISO 8601 format)
"2024-12-19T10:25:00.000Z"
Human-readable message describing the initiation result
"Payment request sent to customer"