Paytabs provides you with a collection of API endpoints which used to process all payments, regardless of if they are through either your own payment pages, the managed payment pages, or if you are using the hosted payment pages.


Tokenization is the process of protecting sensitive data by replacing it with an algorithmically generated number called a token. This can be used to allow returning customers to purchase without re-entering credit card details (recurring), such as monthly subscription fees.


Query Token is a rest API request that returns the payment details and customer details linked to the token along with the original transaction ID used to create the token. In this article, we will walk you through the way to query a specific token to get its details.


In this article, you will be going to know about:



The Endpoint and Related Postman Collection


In this tutorial, we will rely on the PayTabs invoices API Endpoint, mentioned on the PayTabs API endpoints postman collection, which you can access from hereThe endpoint will need to be accessed with a POST request on the below-mentioned URL


Post{{domain}}/payment/token 



Please note that not using the proper endpoint URI {{domain}} will lead to authentication issues within your responses. To find the your proper domain you can read our What Is My (Region)/(endpoint URL)? solution article.



The Required Parameters


To query about payment tokens, there are required parameters that need to be passed with valid information. The specification of these required parameters is clarified below:


Parameter

Data Type

Min

Max

Required

Purpose

profile_id 

INT

Accept only valid profile number

The merchant Profile ID you can get from your PayTavs dashboard. For more information please check our How to get your account information from PT2 Dashboard? solution article.

To know more about this parameter please click here.

token

STRING

Valid token only

Indicates the token you want to query

To know more about this parameter please click here.



Sample Request Payload


The below sample request payload will show you how you can pass the above-mentioned parameters, which are needed to be passed with valid values to perform a request.


{
  "profile_id": "profile_id",
  "token": "2C4651BF67A3EC34C6B691F8638B75BC"
}
Generic




Sample Response Payload


{
  "tran_ref": "TST2111000149684",
  "payment_info": {
    "card_type": "Credit",
    "card_scheme": "Visa",
    "payment_description": "4111 11## #### 1111"
  },
  "customer_details": {
    "name": "first last",
    "email": "email@domain.com",
    "phone": "0522222222",
    "street1": "address street",
    "city": "dubai",
    "state": "DU",
    "country": "AE",
    "ip": "196.219.145.121"
  }
}
Generic









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

And to get familiar with the rest of the steps regarding the previous step "Step 2 - Configure the integration method" kindly click here.

⇦ And to get familiar with the rest of the steps regarding the current step "Step 3 - Initiating the payment" click here

 And to navigate to the next step in the integration process "Step 4 - Accepting the payment" kindly click here.