Skip to Content
Pay HeroDocs

Payment Callback

Structure of the callback response received after a payment is processed.

Responses

200

This represents the JSON that will be sent to your request callback_url. NOTE: it contains the ExternalReference that you provided in the request and CheckoutRequestID that was returned in the request response. You can use those to track and update your payments in your system/app.

NameTypeRequiredDescription
forward_urlstringNoAn optional URL to which the user might be redirected after the callback is processed.
responseobjectYesAn object containing the detailed results of the payment transaction.
↳ AmountnumberYesThe amount of the transaction.
↳ CheckoutRequestIDstringYesA unique identifier for the checkout request. This can be used to track the payment status.
↳ ExternalReferencestringYesThe external reference provided by your system during the payment initiation. Use this to link the callback to your internal records.
↳ MerchantRequestIDstringYesA unique identifier for the merchant request.
↳ MpesaReceiptNumberstringYesThe M-Pesa receipt number for the successful transaction.
↳ PhonestringYesThe phone number associated with the transaction, typically the payer's number.
↳ ResultCodenumberYesA code indicating the result of the transaction. A value of 0 typically indicates success.
↳ ResultDescstringYesA human-readable description of the transaction result.
↳ StatusstringYesThe overall status of the transaction (e.g., "Success", "Failed").
statusbooleanYesIndicates the overall success or failure of the callback processing. true for success, false for failure.
{
  "forward_url": "",
  "response": {
    "Amount": 10,
    "CheckoutRequestID": "ws_CO_14012024103543427709099876",
    "ExternalReference": "INV-009",
    "MerchantRequestID": "3202-70921557-1",
    "MpesaReceiptNumber": "SAE3YULR0Y",
    "Phone": "+254709099876",
    "ResultCode": 0,
    "ResultDesc": "The service request is processed successfully.",
    "Status": "Success"
  },
  "status": true
}

On this page