2.5 Transaction Status Query
Transaction Status Query
The Transaction Status feature allows you to query Safaricom's systems for the real-time status of any M-Pesa transaction using its receipt number. This is useful when a customer claims to have paid but the payment has not appeared in ERPNext.
Transaction Status Flow
When to Use This Feature
Use the Transaction Status query in the following situations:
- A customer provides an M-Pesa receipt number but no corresponding payment appears in the Mpesa C2B Payment Register.
- A C2B callback was not received due to a network interruption or webhook failure.
- A payment is showing as pending and you need to confirm whether it succeeded or failed on Safaricom's end.
- You need to add a missing successful transaction to ERPNext for reconciliation.
How It Works
The system sends a Transaction Status request to the Daraja API using the provided receipt number. Safaricom responds with the transaction details and status. Based on the response:
- If the transaction is successful and no record exists, a new entry is created in the Mpesa C2B Payment Register.
- If the transaction is successful and a record already exists, the system displays the current status and informs you of the existing entry.
- If the transaction failed, the system notifies you of the failure.
Step-by-Step Guide
Step 1: Open Mpesa C2B Payment Register
Navigate to Mpesa C2B Payment Register via the Mpesa workspace or Awesome Bar.
Step 2: Click Check Transaction Status
At the top of the page, click the Check Transaction Status button.
Step 3: Fill in the Query Fields
| Field | Description |
|---|---|
| Mpesa Settings | Select the Mpesa Settings record associated with the Business Shortcode to query against. |
| Transaction ID | Enter the M-Pesa receipt number provided by the customer (e.g., RKJ9XXXXX). |
| Remarks | Optional. Add notes for your own reference. |
Step 4: Submit
Click Submit and wait for the response. The result will be displayed on screen and, if the transaction was successful and new, a record will be created automatically in the C2B Payment Register.
After a Successful Query
If a new payment record was created, proceed to reconcile it against the relevant invoice using either:
- Auto-reconciliation: if enabled in Mpesa Settings.
- Mpesa Payment Reconciliation: for manual matching.