API Explorer
Receive Money
M-Pesa STK push
Wallet Based Settlement
Query Order Status

Merchant Query Order Status

Test URL

GEThttps://uat.finserve.africa/api-checkout/mpesa-stk-push/v3.0/status/order/{orderReference}

Live URL

GEThttps://api.finserve.africa/api-checkout/mpesa-stk-push/v3.0/status/order/{orderReference}

This web service allows merchants to query the real-time status of orders made through the Mpesa STK (Push) service.It allows an application to retrieve the status of an order.

Example Request

⚠️

In the example below, please replace {orderReference} with the actual order reference number.

URL Parameters
ParameterDescriptionFormatRequired
orderReferenceThe reference number of the orderstringYes
Example Request
curl -X GET \
	-H 'Authorization: Bearer {{token}}' \
	-L 'https://uat.finserve.africa/api-checkout/mpesa-stk-push/v3.0/status/order/OR28922980077'
 
200 Success Response Schema
Field NameTypeDescription
statusbooleanIndicates if the request was successful.
codenumberResponse code indicating status.
messagestringDescription of the response status.
data.order.orderAmountdoubleRequest amount.
data.order.amountPaiddoubleAmount paid by customer including service charge
data.order.orderReferencestringOrder Reference .
data.order.orderStatusstringThis is the status of an order. Paid, Pending
data.order.createdOnnumberCreation date of the order in EPOC time
data.invoices[0].amountdoubleInvoice Amount
data.invoices[0].amountDebiteddoubleAmount paid by the customer
data.invoices[0].chargedoubleService charge
data.invoices[0].invoiceStatusstringThis can be Pending, Paid, Cancelled or Expired
data.invoices[0].orderReferencestringOrder Reference
data.invoices[0].externalReferencestringMpesa Reference
data.invoices[0].createdOnstringDate invoice was generated
data.invoices[0].completedOnstringDate Payment was completed

Example Response

Example Sucessful Response
   {
    "status": true,
    "code": "0",
    "message": "Order found",
    "data": {
        "order": {
            "orderAmount": 2.0,
            "amountPaid": 2.0,
            "orderReference": "OR28922980077",
            "orderStatus": "Paid",
            "createdOn": 1723209757300
        },
        "invoices": [
            {
                "amount": 2.0,
                "amountDebited": 2.0,
                "charge": 1.0,
                "invoiceStatus": "Paid",
                "orderReference": "OR28922980077",
                "externalReference": "SH90HU7FO2",
                "createdOn": "2024-08-09 16:22:37.907",
                "completedOn": "2024-08-09 16:22:50.197"
            }
        ]
    }
}
Example Sucessful Response - Pending Order
```json filename="Example Sucessful Response" copy
{
    "status": true,
    "code": "0",
    "message": "Order found",
    "data": {
        "order": {
            "orderAmount": 2.0,
            "amountPaid": 0.0,
            "orderReference": "OR28922980079",
            "orderStatus": "Pending",
            "createdOn": 1723212145140
        },
        "invoices": [
            {
                "amount": 2.0,
                "amountDebited": 2.0,
                "charge": 1.0,
                "invoiceStatus": "Pending",
                "orderReference": "OR28922980079",
                "externalReference": null,
                "createdOn": "2024-08-09 17:02:25.847",
                "completedOn": null
            }
        ]
    }
}

## Error Responses

### 400 Bad Request
Missing or invalid parameters in the request body.

```json
{
  "status": false,
  "code": 400,
  "message": "Invalid request parameters",
  "error_code": "INVALID_REQUEST"
}

401 Unauthorized

Invalid or expired access token.

{
  "status": false,
  "code": 401,
  "message": "Invalid or expired access token",
  "error_code": "UNAUTHORIZED"
}

### 404 Not Found
Account not found or invalid account number.

```json
{
  "status": false,
  "code": 404,
  "message": "Source or destination account not found",
  "error_code": "ACCOUNT_NOT_FOUND"
}

Transaction Status Errors

Response StatusResponse CodeResponse Message
false111102Transaction with the passed reference cannot be found

📖 Step-by-Step Guide

Step 1: 🔑 Set Up Security Keys

Generate your private and public key pair and share your public key with Finserve. See the Security & Signatures Documentation (opens in a new tab) for detailed instructions.

Step 2: 🎫 Authenticate

Obtain an access token using the authentication endpoint. See the Authentication API documentation (opens in a new tab) for details.

Step 3: 📋 Prepare Transaction Details

Gather all required information:

  • Source account details (country code, name, account number)
  • Destination account details (country code, name, account number)
  • Transfer details (amount, currency, reference, date, description)

Sign this string using your private key, then Base64 encode the result.

Step 4: 📝 Set Up Headers

Include the following headers in your request:

  • Content-Type: application/json
  • Authorization: Bearer [your_access_token]

Step 5: 🔧 Construct Request Body

Create a JSON object with all required fields following the structure shown in the example request.

Step 6: 🚀 Send POST Request

Make a POST request to the internal bank transfer endpoint with your headers and body.


🌍 Supported Countries & Currencies

CountryCountry CodeCommon Currency Codes
KenyaKEKES
UgandaUGUGX
TanzaniaTZTZS
RwandaRWRWF
South SudanSSUSD
DRCDRCUSD

Best Practices

  1. ** Transaction Reference**

    • Use unique reference numbers for each transaction
    • Implement a reference generation system to avoid duplicates
    • Store reference numbers for reconciliation and audit purposes
    • Never reuse reference numbers, even for failed transactions
  2. Data Validation

    • Validate all account numbers match the expected format
    • Verify country codes are valid and supported
    • Ensure transfer dates are in the correct format (YYYY-MM-DD)
    • Validate currency codes match the destination country


Support

For questions or issues with this API: