Initiate express payment
Initiate an M-Pesa Express (STK Push) payment.
Permissions: express.pay
Authorizations
The API key to use for authentication
Headers
Optional idempotency key used to safely retry the same Express payment request without creating duplicate payment attempts.
1 - 256"express_order_12345"
Body
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:
- Must be a string
- Maximum length of 40 characters
Value Types:
- String (maximum 500 characters)
- Integer
- Floating-point number
- Boolean
Limits:
- Maximum of 50 key-value pairs
{
"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:
- Must be a string
- Maximum length of 40 characters
Value Types:
- String (maximum 500 characters)
- Integer
- Floating-point number
- Boolean
Limits:
- Maximum of 50 key-value pairs
{
"user_preference": "dark_mode",
"last_login": 1640995200,
"is_premium": true,
"account_balance": 1250.75,
"notifications_enabled": false
}Response
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"