Skip to main content

Query Transaction

PayTabs provides you with the backend packages that make the integrating with PayTabs payment gateway very easy by providing ready-made classes that handle the payment process.

If you have a transaction that you want to fetch its details and know more about its status, type, etc... you can use the query transaction endpoint, as it will return the details of the requested transaction. In this article, we walk you through how to use and manage the below function:



Method Specification


Description

This method retrieves comprehensive transaction details using the transaction reference as an identifier.

Since1.0.0
Required

Signature

queryTransaction(string $tran_ref)

Sample

$tran_ref = "TST2016700000692";
$transaction = Paypage::queryTransaction($tran_ref);
var_dump($transaction);

Recommended

For the best practice , we highly recommend you to rely on the IPNs and callback to get the status of your transactions.

Note

Through out the article we will use the transaction types clarified in ourWhat is the "tran_type" (transaction type)?solution article.




Method Parameters:

Tran Ref

Name$tran_ref
Type

STRING

Description

A unique transaction reference identifier for querying transaction details.

Default

-

Required




Sample Request:

Here's a sample of how you can query a specific transaction according to your business needs:

$tran_ref = "TST2016700000692";
$transaction = Paypage::queryTransaction($tran_ref);
var_dump($transaction);


Sample Response Payload:

The response PayTabs will send to you will be a JSON object that contains the full details regarding the inquired transaction, as shown below. Otherwise, it will be a null object:

{
"tran_ref": "TST2016700000692",
"merchant_id": 31000,
"profile_id": 81000,
"cart_id": "cart_11111",
"cart_description": "Description of the items/services",
"cart_currency": "SAR",
"cart_amount": "500.00",
"tran_currency": "SAR",
"tran_total": "500.00",
"tran_type": "Sale",
"tran_class": "ECom",
"customer_details": {
"name": "Technical Support Team",
"email": "[email protected]",
"phone": "+966 55 xxxxxx6",
"street1": "address street",
"city": "Jeddah",
"state": "Makkah",
"country": "SA",
"zip": "12345"
"ip": "156.221.244.35"
},
"shipping_details": {
"name": "Technical Support Team",
"email": "[email protected]",
"phone": "+966 55 xxxxxx6",
"street1": "address street",
"city": "Jeddah",
"state": "Makkah",
"country": "SA",
"zip": "12345"
"ip": "156.221.244.35"
},
"shipping_details": {
"name": "Technical Support Team",
"email": "[email protected]",
"phone": "+966 55 xxxxxx6",
"street1": "address street",
"city": "Jeddah",
"state": "Makkah",
"country": "SA",
"zip": "12345"
"ip": "156.221.244.35"
},
"payment_result": {
"response_status": "D",
"response_code": "344",
"response_message": "Acquirer is unable to process this request",
"acquirer_message": "ERR_00:Technical Failure",
"cvv_result": " ",
"avs_result": " ",
"transaction_time": "2022-12-14T15:53:58Z"
},
"payment_info": {
"payment_method": "Visa",
"card_type": "Credit",
"card_scheme": "Visa",
"payment_description": "4111 11## #### 1111",
"expiryMonth": 12,
"expiryYear": 2022
},
"ipn_trace": "IPNS0004.6399F196.00000FD3"
}

We are glad to be always in help. We aim to serve you better each time. As such, please spare a minute to share feedback about your recent experience with PayTabs Developers , on Trustpilot, or Google Reviews.