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, to know more about its status, type, etc... you can use this function as it will return the details of the requested transaction, using the transaction ref. In this article, we walk you through how to use and manage the below function:
In this article, we will walk you through the following:
let queryRequested = function ($results){ console.log($results); } paytabs.validatePayment('TST2229801363947', queryRequested);
For the best practice , we highly recomment you to rely on the IPNs and callback 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/Name | tran_ref |
Data Type | STRING |
Required | ✔ |
Purpose | Indicates the transaction reference you want to query it. |
Validation Rules | Accept only valid transaction references. |
Sample Request
Here's a sample of how you can query a specific transaction according to your business needs:
let queryRequested = function ($results){ console.log($results); } paytabs.validatePayment('TST2105900091468', queryRequested);
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: 'TST2229801363947', tran_type: 'Auth', cart_id: '100001', cart_description: 'dummy description', cart_currency: 'EGP', cart_amount: '550.00', customer_details: { name: 'Mohammed ELRayes', email: 'elrayes@paytabs.com', phone: '+201234567890', street1: 'dummy street', city: 'Port Fouad', state: 'PTS', country: 'EG', zip: '42121', ip: '15*.***.***.*61' }, shipping_details: { name: 'Mohammed ELRayes', email: 'elrayes@paytabs.com', phone: '+201234567890', street1: 'dummy street', city: 'Port Fouad', state: 'PTS', country: 'EG', zip: '42121' }, payment_result: { response_status: 'A', response_code: 'G09125', response_message: 'Authorised', transaction_time: '2022-10-25T14:45:25Z' }, payment_info: { payment_method: 'Visa', card_type: 'Credit', card_scheme: 'Visa', payment_description: '4111 11## #### 1111', expiryMonth: 12, expiryYear: 2022 }, serviceId: 2, profileId: 81784, merchantId: 31237, trace: 'PMN****3.63****9F.00****E8' }
⌂ To get familiar with the whole process and the other steps, kindly navigate to our "The Node.js 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.