Retrieve Invoice Details
An invoice is a document you provide to your client after they purchase goods or services from you. It serves to both record the sale and request payment. For detailed information about PayTabs invoices, please refer to our articleWhat is PayTabs Invoice?
After your invoice is initiated and exist, and regardless of it statuses: "paid," "pending," or "canceled." For more information on invoice statuses, please refer to our invoice status manual. This article specifically outlines the proper method for retrieving complete invoice details using the designated API endpoint. Prior to proceeding with this integration, it is strongly recommended that you and your technical team review the Invoices | Payment Workflowmanual first to grasp the business logic behind this integration type.
The Endpoint and Related Postman Collectionβ
In this tutorial, we will rely on the PayTabs retrieve invoice details Transaction API Endpoint, mentioned on the PayTabs API endpoints postman collection, which you can access fromhere.The endpoint will need to be accessed with the mentioned HTTP request via the below URL endpoint:
- Via GET Request
- Via POST Request
GET | {{domain}}/payment/invoice/{invoice_id}/details |
---|
Please note that not using the proper endpoint URL {domain} will lead to authentication issues within your responses. To find the your proper domain you can read ourWhat is my (Region)/(endpoint URL)?tutorial article.
- KSA
- UAE
- Egypt
- Oman
- Jordan
- Kuwait
- Global
https://secure.paytabs.sa/payment/invoice/{invoice_id}/details
https://secure.paytabs.com/payment/invoice/{invoice_id}/details
https://secure-egypt.paytabs.com/payment/invoice/{invoice_id}/details
https://secure-oman.paytabs.com/payment/invoice/{invoice_id}/details
https://secure-jordan.paytabs.com/payment/invoice/{invoice_id}/details
https://secure-kuwait.paytabs.com/payment/invoice/{invoice_id}/details
https://secure-global.paytabs.com/payment/invoice/{invoice_id}/details
POST | {{domain}}/payment/invoice/details |
---|
Please note that not using the proper endpoint URL {domain} will lead to authentication issues within your responses. To find the your proper domain you can read ourWhat is my (Region)/(endpoint URL)?tutorial article.
- KSA
- UAE
- Egypt
- Oman
- Jordan
- Kuwait
- Global
https://secure.paytabs.sa/payment/invoice/details
https://secure.paytabs.com/payment/invoice/details
https://secure-egypt.paytabs.com/payment/invoice/details
https://secure-oman.paytabs.com/payment/invoice/details
https://secure-jordan.paytabs.com/payment/invoice/details
https://secure-kuwait.paytabs.com/payment/invoice/details
https://secure-global.paytabs.com/payment/invoice/details
Required Parametersβ
To make a retrieve invoice details request, there are required parameter/s that need to be passed with valid information. The specification of these required parameters is clarified below according to the request type:
- Via GET Request
- Via Post Request
In the GET request type, you can fetch the full invoice details by sending a GET request with only the { invoice_id } as a parameter in the URL. Below is a sample request that demonstrates how to retrieve an invoice's details with the ID "3248035".
Parameter | Data Type | Min | Max | Required |
---|---|---|---|---|
| INT | 1 | 9999999999 | β |
invoice_id is one of the parameters that received from our side in the payload. | ||||
|
In the POST request type, you simply use a POST request with only the invoice_id
and profile_id
as payload parameters to retrieve the invoice details. As shown below
Parameter | Data Type | Min | Max | Required |
---|---|---|---|---|
| INT | Accept only valid profile number. | β | |
The merchant Profile ID you can get from your PayTabs dashboard. For more information please check our How to get your account information from PT Dashboard? solution article. To know more about this parameter please click here. | ||||
|
Parameter | Data Type | Min | Max | Required |
---|---|---|---|---|
| INT | 1 | 9999999999 | β |
invoice_id is one of the parameters that received from our side in the payload. | ||||
|
Sample Request Payloadsβ
- Via GET Request
- Via Post Request
As we mentioned before, you can retrieve the invoice details by sending a GET request with only the { invoice_id } as a parameter in the URL. Below is a sample request that demonstrates how to fetch an invoice with the ID "3248035."
- Via Postman
- Via cURL

curl --location --request GET 'https://secure.paytabs.com/payment/invoice/3248035/details'
--header 'Authorization: SGJNBXXXXX-J6RNNXXXXX-2ZGWLXXXXX'
For post request, you need to set as usual the Invoice ID and the profile ID in the request as shown below:
{
"profile_id": {{profile_id}},
"invoice_id": {{invoice_id}}
}
Sample Response Payloadsβ
Retrieves the complete details associated with the specified invoice_id. If the invoice status is paid, the response payload will include an additional parameters transaction-specific metadata: tran_ref (transaction reference), tran_status (transaction status code), and tran_status_msg (transaction status message), providing further context about the completed payment.
{
"invoice_details": {
"id": 3248030,
"lang": "en",
"shipping_charges": "0.00",
"extra_charges": "0.00",
"extra_discount": "0.00",
"total": "109.50",
"activation_date": 0,
"expiry_date": 1758965580,
"due_date": 1758875760,
"issue_date": 1750851435,
"line_items": [
{
"sku": "sku",
"description": "product/service description",
"url": "https://www.your-store-domain.com/product-path",
"unit_cost": "109.50",
"quantity": "1",
"net_total": "109.50",
"discount_rate": "0",
"discount_amount": "0.00",
"tax_rate": "0",
"tax_total": "0.00",
"total": "109.50"
}
]
},
"invoice_status": "pending", // "cancelled" or "paid"
// if the status is "paid" the following parameters will return within the payload
"tran_ref": "TST2517602100955",
"tran_status": "A",
"tran_status_msg": "Authorised"
}
When interacting with our API, you may occasionally encounter HTTP error responses. These errors are returned when a request cannot be successfully processed due to client-side constraints. Understanding these responses is essential for effective error handling and debugging.
- 404 Not Found
- 429 Too Many Requests
- 401 Unauthorized
If an invalid or not existing invoice ID has been provided, the API will respond with a 404 Not Found, indicating that this invoice ID not exist.
{
"code": 2,
"message": "Invoice not found",
"trace": "PMNT0401.685BF3BB.0000B10E"
}
If you sent 60 request per minute trying to retrieve an invoice details, the error 429 Too Many Requests will occurs.
{
"code": 5,
"message": "Too many requests, try again later.",
"trace": "PMNT0401.685BEC48.0000A2E6"
}
If an invalid profile_id or incorrect authorization server key is provided in the request header, the API will respond with a 401 Unauthorized, indicating authentication failure.
{
"code": 1,
"message": "Authentication failed. Check authentication header.",
"trace": "PMNT0402.685BF22C.0000AD86"
}
Expected Flow Behaviorβ
To retrieve the details of a specific invoice, follow the steps below. This flow assumes that you have already initiated an invoice and received a valid invoice_id
.:
Begin by calling the API endpoint responsible for invoice creation. Upon successful creation, the response will include a unique invoice_id. This ID is essential for all subsequent operations related to the invoice.
{
.
"invoice_id": "3251338",
.
}ImportantStore the
invoice_id
securely in your system. It serves as the primary reference for managing the invoice via API like retrieving or updating the invoice.Once you have the
invoice_id
, you can retrieve the full details of the invoice at any time, regardless of its current status Pending, Paid, Expired, Overdue, or cancelled:{
"invoice_details": {
"id": 3251338,
"lang": "en",
"shipping_charges": "0.00",
"extra_charges": "0.00",
"extra_discount": "0.00",
"total": "9.50",
"activation_date": 0,
"expiry_date": 1758965580,
"due_date": 1758875760,
"issue_date": 1751375603,
"line_items": [
{
"sku": "sku",
"description": "Product/Service description.",
"url": "https://www.your-company-domain.ae/whats-new/flat-white",
"unit_cost": "9.50",
"quantity": "1",
"net_total": "9.50",
"discount_rate": "0",
"discount_amount": "0.00",
"tax_rate": "0",
"tax_total": "0.00",
"total": "9.50"
}
]
},
"invoice_status": "pending"
}Additionally, if the invoice status is paid you will get the transaction details associated to this invoice.
{
"invoice_details": {
......
},
"invoice_status": "paid",
"tran_ref": "TST2508202038004",
"tran_status": "A",
"tran_status_msg": "Authorised"
}