M-pesa Push

The Request is an initiator for an STK push yet to be paid transaction i.e. it Triggers the wallet user's SIM ToolKit for authorization of payment on their handset.

This is only available for MPESA.

BODY PARAMS

Parameter Data Type Description Required
customer_code alphanumeric Business code assigned by Pokea Pay Y
order_reference alphanumeric Order reference Y
firstname string Customer first name Y
surname string Customer surname Y
phone numeric Customer M-Pesa registered phone number. Format 2547XXXXXXXX /2541XXXXXXXX Y
amount numeric Order amount to be paid (DO NOT PASS any commas as a thousands separator). e.g. amt=1234 and NOT amt=1,234 Y
currency string Currency Type (USD or KES) * KES By Default. Y
description alphanumeric Your order descriptions. Y
channel numeric Channel unique code. use 549319 for M-PESA Y
result_url alphanumeric This parameter holds the URL to your server to which callback response will be sent. Y

HEADER PARAMS

Parameter Data Type Description Required
Authorization alphanumeric bearer token used to access the API Y
signature alphanumeric A SHA-256 signature to proof that this request is coming from the merchant. Build a String of concatenated values of the request fields with the following order: order_reference,amount,currency,phone,customer_code. The resulting text is then signed with Private Key and Base64 encoded. Y

200 Success Response Schema

Parameter Data Type Description
code numeric Response code
message string Response message.
transaction_id alphanumeric transactions id

Example Request

                                    
curl --location --request POST 'https://here-prod-api-url.com/collect/mpesa'
--header 'Accept: application/json'
--header 'Content-Type: application/json'
--header 'signature: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ '
--header 'Authorization: Bearer 5oZ1crzJHGp3JEhRU8S8XTyIqFFVi4k2Ul1ChogCKlg'
--data-raw '{
    "customer_code": "XXXXXXXXXX",
    "order_reference": "35",
    "firstname": "John",
    "surname": "Doe",
    "phone": "2547XXXXXXXXX",
    "amount": 10,
    "currency": "KES",
    "description":"Test Order description",
    "channel":"549319",
    "result_url":"http://domain.com/cbk"
}'
                                    
                                

Example Response

                                    
{
    "code": 0,
    "success": true,
    "message": "Success. Request accepted for processing",
    "transaction_id": "PFF8LL9JD9"
}