PayTabs Laravel Package makes integration with the PayTabs payment gateway very easy by providing a ready-made payment class that handles the card entry and, billing & shipping information and completes the missing details.


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:


   

->queryTransaction($tran_ref)


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


Through out the article we will use the transaction types clarified in our What is "tran_type"? solution article.


Transaction Reference


The Parameter Tag/Nametran_ref
Data TypeSTRING
Required

PurposeIndicates the transaction reference you want to query it.
Validation RulesAccept only valid transaction references.




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": "TST2105900091468",
  "tran_type": "Sale",
  "cart_id": "Sample Payment",
  "cart_description": "Sample Payment",
  "cart_currency": "EGP",
  "cart_amount": "1",
  "customer_details": {
    "name": "ALiaa Ahmed",
    "email": "[email protected]",
    "phone": "01005417901",
    "street1": "Alexandria",
    "city": "Alexandria",
    "state": "ALX",
    "country": "EG",
    "ip": "40.123.210.168"
  },
  "payment_result": {
    "response_status": "A",
    "response_code": "G15046",
    "response_message": "Authorised",
    "transaction_time": "2021-02-28T12:24:06Z"
  },
  "payment_info": {
    "card_type": "Credit",
    "card_scheme": "Visa",
    "payment_description": "4111 11## #### 1111"
  }
}







⌂ To get familiar with the whole process and the other steps, kindly navigate to our "The Laravel Packge Integration Manual" solution article. 

 And to get familiar with the rest of the steps regarding the current step "Step 7 - Manage Transactions" kindly click here.

 And to navigate to the previous step in the integration process "Step 6 - Handle the post payment responses" kindly click here.