Send an M-Pesa payment prompt to a customer’s phone.
07XXXXXXXX, 01XXXXXXXX, +254XXXXXXXXX, or 254XXXXXXXXX format and normalised internally.accountReference must be 12 characters or fewer — it appears on the customer’s M-Pesa statement.transactionDesc must be 13 characters or fewer — it appears on the customer’s PIN prompt.transactionId — use it to poll status or match incoming webhooks.PENDING means the STK prompt was sent. The final result arrives via your callbackUrl.transactionFee in the response shows the service wallet amount deducted for this request. It is 0 when no pricing rule is configured.credential_id)credential_id field lets you route the STK Push through your own M-Pesa Daraja credentials (BYOC — Bring Your Own Credentials) instead of the platform default.
When credential_id is provided:
consumerKey, consumerSecret, passkey, and shortcode.channelId) — the channel type determines the transaction type (PAYBILL → CustomerPayBillOnline, TILL → CustomerBuyGoodsOnline). The channel’s shortcode is used as PartyB.transactionType (set when creating the profile) determines the transaction type. The profile’s shortcode is used as PartyB. Falls back to the platform DARAJA_TRANSACTION_TYPE setting if the profile has no transactionType set.MERCHANT_BYOC profile and copy its UUID to use here.| Field | Type | Description |
|---|---|---|
transactionId | string | UUID of the created transaction |
type | string | Always "STK" |
status | string | Always "PENDING" on initiation |
amount | number | Payment amount in KES |
currency | string | Always "KES" |
phone | string | Normalised phone number (254XXXXXXXXX) |
accountReference | string | Reference shown on customer’s M-Pesa statement |
transactionDesc | string | Description shown on customer’s PIN prompt |
transactionFee | number | Service wallet fee charged for this request. 0 if no fee applies. |
providerRequestId | string | null | Safaricom MerchantRequestID |
providerCheckoutId | string | null | Safaricom CheckoutRequestID |
resultCode | string | null | Provider result code ("0" = accepted) |
resultDescription | string | null | Provider result message |
createdAt | string | ISO 8601 timestamp |
updatedAt | string | ISO 8601 timestamp |
429 STK_TEMP_BANNED. The ban lasts 1 hour. Check details.retryAfterSeconds for the exact wait time.Use your API key as the username. Leave the password field empty.
Authorization: Basic <base64(apikey:)>You can also pass the raw API key:
Authorization: Basic <apikey>Amount to charge in KES.
x >= 11000
Customer phone number. Accepted formats: 0712345678, 254712345678,
+254712345678. Normalised to 254XXXXXXXXX internally.
"0712345678"
Your reference — invoice number, order ID, etc.
12"INV-2024-001"
Short description shown on the customer's PIN prompt.
13"Payment"
HTTPS URL where PalPluss will POST the transaction result after the customer confirms or cancels payment.
"https://yourserver.com/webhooks/mpesa"
Optional. Route the STK Push through a specific payment channel (shortcode). If omitted, the default channel is used.
Optional. Use a specific MERCHANT_BYOC credential profile for this request.
When provided, Daraja OAuth and STK initiation use that profile's credentials
(consumerKey, consumerSecret, passkey, shortcode).
Transaction type (commandId) resolution when credential_id is set:
PAYBILL = CustomerPayBillOnline, TILL = CustomerBuyGoodsOnline)transactionType is used when set; falls back to platform defaultPartyB resolution when no channel is configured:
the credential profile's shortcode is used instead of the platform default shortcode.