Initiate STK Push
Send an M-Pesa payment prompt to a customer’s phone.
Trigger a payment. The customer receives a PIN prompt on their phone within seconds.Documentation Index
Fetch the complete documentation index at: https://docs.palpluss.com/llms.txt
Use this file to discover all available pages before exploring further.
Key notes
- Phone numbers are accepted in
07XXXXXXXX,01XXXXXXXX,+254XXXXXXXXX, or254XXXXXXXXXformat and normalised internally. accountReferencemust be 12 characters or fewer — it appears on the customer’s M-Pesa statement.transactionDescmust be 13 characters or fewer — it appears on the customer’s PIN prompt.- Save the returned
transactionId— use it to poll status or match incoming webhooks. PENDINGmeans the STK prompt was sent. The final result arrives via yourcallbackUrl.transactionFeein the response shows the service wallet amount deducted for this request. It is0when no pricing rule is configured.
Using a credential profile (credential_id)
The optional 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:
- Daraja OAuth and the STK Push initiation use that profile’s
consumerKey,consumerSecret,passkey, andshortcode. - With a channel (
channelId) — the channel type determines the transaction type (PAYBILL→CustomerPayBillOnline,TILL→CustomerBuyGoodsOnline). The channel’s shortcode is used asPartyB. - Without a channel — the credential profile’s
transactionType(set when creating the profile) determines the transaction type. The profile’s shortcode is used asPartyB. Falls back to the platformDARAJA_TRANSACTION_TYPEsetting if the profile has notransactionTypeset.
MERCHANT_BYOC profile and copy its UUID to use here.Response fields
| 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 |
STK abuse protection
If your API key initiates too many STK Pushes with a low success rate in a short window, further requests return429 STK_TEMP_BANNED. The ban lasts 1 hour. Check details.retryAfterSeconds for the exact wait time.Authorizations
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>Body
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:
- Channel present → channel type drives it (
PAYBILL= CustomerPayBillOnline,TILL= CustomerBuyGoodsOnline) - No channel → profile's
transactionTypeis used when set; falls back to platform default
PartyB resolution when no channel is configured:
the credential profile's shortcode is used instead of the platform default shortcode.