M-pesa Reversal
reversal

This M-PESA Reversal Request API allows customers to initiate a request for a reversal of a transaction made through M-PESA mobile payment system.

This is only available for M-PESA.

BODY PARAMS

Parameter Data Type Description Required
customer_code alphanumeric Business code assigned by Pokea Pay Y
account_no string Account number assigned by Pokea Pay Y
channel numeric Channel unique code. use 475946 for M-PESA Reversals Y
reference string Unique reference generate from client side. Y
mpesa_txn_id string This is the Mpesa Transaction ID of the transaction which you wish to reverse. Y
currency string Reversal amount currency. Use KES. Y
amount numeric The amount transacted in the transaction to be reversed (DO NOT PASS any commas as a thousands separator). e.g. amt=1234 and NOT amt=1,234 Y
remarks alphanumeric Your reversal remarks. 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: customer_code,account_no,amount,mpesa_txn_id. 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.

Example Request

                                    
curl --location --request POST 'https://here-prod-api-url.com/payment/refund' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'signature: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ '
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9' \
--data-raw '{
     "customer_code": "XXXXXXXXXX",
     "account_no": "XXXXXXXXXX",
     "reference":"1232211",
     "channel":"475946",
     "mpesa_txn_id":"RBF8PXEO66",
     "currency":"KES",
     "amount": 1,
     "remarks":"Payment reversal",
     "result_url":"https://webhook.site/55822fab-6cdf-49b0-b19f-0a67e537ad09"
}'
                                    
                                

Example Response

                                    
{
    "code": 0,
    "success": true,
    "message": "Accept the service request successfully."
}