📃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

Headers

{
    "success": true,
    "status": "SUCCESS",
    "reference": "9c1c61dd-2085-4137-9b01-8f7fde01c567",
    "CheckoutRequestID": ""
}

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