GET: Transaction Status
Fetch Transaction Status
This endpoint enables you to fetch the transaction status of any given payment that you initiated
Fetch transaction status
GET
https://backend.payhero.co.ke/api/v2/transaction-status
Query Parameters
Name
Type
Description
reference*
String
The reference that was returned in the original transaction request
Headers
Name
Type
Description
Authorization:*
String
Basic authToken
{
{
"transaction_date": "2024-11-26T08:41:14.160604Z",
"provider": "m-pesa",
"success": true,
"merchant": "Ron Doe",
"payment_reference": "",
"third_party_reference": "SKQ96C7K7H",
"status": "SUCCESS",
"reference": "6b71cb8b-638d-4b6e-9c7c-b0334a641e3a",
"CheckoutRequestID": "",
"provider_reference": "SKQ96C7K7H"
}
From the response you can pick the status parameter to determine if the transaction was successful or not when successful the value will be SUCCESS any other value means the transaction has not been processed
Possible values for status
QUEUED- Payment has been queued and we have not received callback
SUCCESS- Payment has been successfully
FAILED- Payment Failed
Sample Code
This represents PHP Curl example of how to make the request, you can implement this in your specific language of choice
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://backend.payhero.co.ke/api/v2/transaction-status?reference=9c1c61dd-2085-4137-9b01-8f7fde01c567',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Basic MWo5TjVkZTFwSGc2Rm03TXJ2YldKbjg4dXFhMHF6ZDMzUHlvNjJNUg=='
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Last updated
Was this helpful?