Initiating The Payment
An invoice is a document you send to your client after purchasing goods or services from you, both as a means of recording the sale and requesting payment from them. You can catch everything you need about PayTabs invoices in our solutions article: What is PayTabs Invoice?
Invoices Payment Page integration type is suitable for merchants with PCI SAQ A or merchants does not have any PCI levels as it follows Hosted Payment page mechanism. To customize the UI of the Invoices payment page, check this article, and to know more about the Invoices Payment Page PCI DSS merchant requirements, please check this article.The Available Endpoints to Initiate an Invoiceβ
In this manual, we'll guide you through initiating a payment request using this integration type. You'll learn about the necessary parameters required for the request and all the optional parameters available. You can choose to initiate the payment in one of two ways: via Payment or via Invoices. We strongly recommend reviewing theInvoice Payment Page | Payment Workflowmanual first to understand the business logic behind this integration.
As mentioned above, there are two ways you can use in the endpoints for initiating the invoice as clarified below:
Each endpoint has a different flow and support different kind of parameters, you can choose one that suits your business needs best. In the upcoming section we will walk you through these 2 endpoints in detail.
Initiating an Invoice via Invoice Endpoint
Initiating an Invoice via Invoice Endpointβ
Here, we will walk you through the steps to initiate an invoice using the Invoice Endpoint. This dedicated interface simplifies the process of invoice creation and management, handling all aspects from generating new invoices to tracking payments and managing customer data. In this manual, we will provide a step-by-step guide to help you streamline your invoicing procedures and improve financial accuracy.
The Endpoint and Related Postman Collectionβ
In this section, we will rely on the PayTabs Invoice Payment Page API Endpoint, mentioned on PayTabs API endpoints postman collection, which you can access from po_link. The endpoint will need to be accessed with a POST request on the below-mentioned URL
POST | {{domain}}/payment/invoice/new |
---|
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/new
https://secure.paytabs.com/payment/invoice/new
https://secure-egypt.paytabs.com/payment/invoice/new
https://secure-oman.paytabs.com/payment/invoice/new
https://secure-jordan.paytabs.com/payment/invoice/new
https://secure-kuwait.paytabs.com/payment/invoice/new
https://secure-global.paytabs.com/payment/invoice/new
Request Parametersβ
- The Minimum Required Parameters
- The Available Optional Parameters
To initiate a payment request using this integration type, there are minimum 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 |
---|---|---|---|---|
| INT | Accept only valid profile number | β | |
The merchant Profile ID you can get from your PayTabs dashboard. For more information please check ourHow to get your account information from PT2 Dashboard?tutorial article. To know more about this parameter pleaseclick here. | ||||
| ||||
| STRING | Valid string from this enum list: sale auth refund register void | β | |
the identification of the type of the transaction. To know more about these types please check ourWhat is the "tran_type" (transaction type)?solution article. To know more about this parameter pleaseclick here. | ||||
| ||||
| STRING | Valid string from this list ecom recurring moto | β | |
the identification of the category/class this transaction will follow, such as eCommerce, Recurring, etc. To know more about these types please check ourWhat is the "tran_class" (transaction class)?solution article. To know more about this parameter pleaseclick here. | ||||
| ||||
| STRING | β | ||
Indicates the cart/order id at the merchant end to easily relate the transaction to. To know more about this parameter pleaseclick here. | ||||
| ||||
| STRING | β | ||
Indicates the cart/order description at the merchant end to easily relate the transaction to. To know more about this parameter pleaseclick here. | ||||
| ||||
| STRING | Valid string from the following list:SAR AED BHD EGP EUR GBP HKD IDR INR IQD JOD JPY KWD MAD OMR PKR QAR USD Accepts both upper- and lower-case characters | β | |
Indicates the transaction currency, which the customer will be charged with. To know more about this parameter pleaseclick here. | ||||
| ||||
| DECIMAL | β | ||
Indicates the amount of the transaction the customer is about to be charged Both min and max values are subjected to the merchant transaction limits. To know more about this parameter pleaseclick here. | ||||
|
Now in order to create a new invoice, you need - in addition to the general required above parameters - to include new parameters required specifically for the Invoices. Find below the Additional required parameters for the Invoice:
Parameter | Data Type | Min | Max | Required |
---|---|---|---|---|
| OBJECT | At least "line_items" must be included | β | |
This is the main object that holds other parameters related to invoice creation. Including this in your request is considered the main flag to be treated as an Invoice creation request, not a normal hosted payment page request. To know more about this parameter pleaseclick here. | ||||
| ||||
| OBJECT | β | ||
This is an array of the invoice objects/items that your customer purchased. Each item will be an object that holds its specific details. To know more about this parameter pleaseclick here. | ||||
| ||||
| DECIMAL | β | ||
This is an array of the invoice objects/items that your customer purchased. Each item will be an object that holds its specific details. To know more about this parameter pleaseclick here. | ||||
| ||||
| INT | β | ||
| ||||
| INT | β | ||
| ||||
| OBJECT | β | ||
Indicates the customer details for this payment. To know more about this parameter pleaseclick here. | ||||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
|
Besides the above-mentioned required parameters, PayTabs provides you with several optional parameters, each of which empowers you with a different feature and the ability to customize your invoice payment request as much as possible it could be. The specification of these optional parameters is clarified below:
Parameter | Data Type | Min | Max | Required |
---|---|---|---|---|
| STRING | 255 Characters (Valid URL) | β | |
The callback response is a server-to-server POST response that is sent (to a pre-defined HTTPS URL) with the full detailed transaction information once the payment process has ended (whether the customer cancels, paid, or failed to pay). It does not depend on the customer's actions; the response will be sent anyway.What is the Return URL vs the Callback URL? To know more about this parameter pleaseclick here. | ||||
| ||||
| OBJECT | β | ||
Indicates the shipping details for this payment. If provided, the payment page will be prefilled with the provided data. To know more about this parameter pleaseclick here. | ||||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | Pass one of the following list: 2 - Hex32 3 - AlphaNum20 4 - Digit22 5 - Digit16 6 - AlphaNum32 | β | |
The tokenization format the generated token should follow.Token Based Transactions (Recurring). To know more about this parameter pleaseclick here. | ||||
| ||||
| OBJECT | β | ||
For more customizations, you can pass to the Transaction API request your own "user-defined fields" up to 9 fields, and accordingly, you would receive those fields in the callback response. To know more about this parameter pleaseclick here. | ||||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
|
Request & Response Payload Samplesβ
- Required Parameters Sample Payloads
- Optional Parameters Sample Payloads
The below sample request payload will show you how you can pass the above-mentioned required parameters, which are needed to be passed with valid values to perform a request. Along with the response payload received after using this request payload.
- Sample Request Payload
- Sample Response Payload
{
"profile_id": **Your profile ID**,
"tran_type": "sale",
"tran_class": "ecom",
"cart_description": "Description of the items/services",
"cart_id": "Unique order reference00",
"cart_amount": 100,
"cart_currency": "SAR",
"invoice": {
"line_items": [
{
"unit_cost": 100,
"quantity":2,
}
]
}
}
{
"invoice_id": 2072841,
"invoice_link": "https://secure.PayTabs.sa/payment/request/invoice/2072841/A8C678206DB76382A"
}
The below sample request payload will show you how you can pass the above-mentioned optional parameters, which are needed to be passed with valid values to perform a request. Along with the response payload received after using this request payload.
- Sample Request Payload
- Sample Response Payload
{
"profile_id": **Your profile ID**,
"tran_type": "sale",
"tran_class": "ecom",
"cart_description": "Description of the items/services",
"cart_id": "Unique order reference00",
"cart_amount": 100,
"cart_currency": "SAR",
"invoice": {
"lang": "en",
"shipping_charges": 0,
"extra_charges": 0,
"extra_discount": 0,
"total": 0,
"activation_date": "",
"expiry_date": "2024-09-27T13:33:00+04:00",
"line_items": [
{
"sku": "sku",
"description": "desc",
"url": "https://www.costacoffee.ae/whats-new/flat-white",
"unit_cost": 9.5,
"quantity": 1,
"net_total": 9.5,
"discount_rate": 0,
"discount_amount": 0,
"tax_rate": 0,
"tax_total": 0,
"total": 9.5
},
]
},
"customer_details": {
"name": "first last",
"email": "email@domain.com",
"phone": "0522222222",
"street1": "address street",
"city": "dubai",
"state": "du",
"country": "AE",
"zip": "12345"
},
"shipping_details": {
"name": "name1 last1",
"email": "email1@domain.com",
"phone": "971555555555",
"street1": "street2",
"city": "dubai",
"state": "dubai",
"country": "AE",
"zip": "54321"
},
"user_defined": {
"test": "UDF1 Test",
"test2": "UDF2 Test",
"udf3": "UDF3 Test",
"udf4": "UDF4 Test",
"udf5": "UDF5 Test",
"udf6": "UDF6 Test",
"udf7": "UDF7 Test",
"udf8": "UDF8 Test",
"udf9": "UDF9 Test"
},
"callback": "{{callback_url}}",
"return": "{{return_url}}"
}
{
"invoice_id": 2072841,
"invoice_link": "https://secure.PayTabs.sa/payment/request/invoice/2072841/A8CB6A868206DB76382A"
}
The Payment Page Experienceβ
Reaching this point, you are now able to initiate an Invoice API request and as you now, the process involves several key steps that ensure a smooth payment and tracking experience for both you and customers. Hereβs how it works:
-
Initiating the Request: Once you initiate a payment request, you will receive a response that includes a redirect URL. This URL is crucial for guiding your customer through the payment process.
"invoice_link": "https://secure.PayTabs.sa/payment/request/invoice/2072841/A8CB6A4667A444E79E868206DB76382A",
-
Redirecting the Customer: You should redirect your customer to this URL as you normally would in a payment transaction. This step allows the customer to complete their payment securely and efficiently. Below are the resulted payment page that your customer will be redirected to:
-
Tracking in the Merchant Dashboard: After the payment is completed, the transaction will be displayed in your Merchant Dashboard. You can view the details of it in the transaction view.
This process ensures that you have full visibility and control over your split payouts, from initiating the transaction to tracking its completion in the dashboard.
Initiating an Invoice via Payment Endpoint
Initiating an Invoice via Payment Endpointβ
Here, we will walk you through the process of creating invoices efficiently using the Payment Endpoint. This endpoint offers a streamlined way to initiate invoices directly through your payment processing system. By leveraging this endpoint, businesses can automate the invoicing process, ensuring timely and accurate billing. This guide will highlight key features and best practices to optimize your workflow.
The Endpoint and Related Postman Collectionβ
In this section, we will rely on the PayTabs Invoice Payment Page API Endpoint, mentioned on PayTabs API endpoints postman collection, which you can access from po_link. The endpoint will need to be accessed with a POST request on the below-mentioned URL
POST | {{domain}}/payment/request |
---|
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/request
https://secure.paytabs.com/payment/request
https://secure-egypt.paytabs.com/payment/request
https://secure-oman.paytabs.com/payment/request
https://secure-jordan.paytabs.com/payment/request
https://secure-kuwait.paytabs.com/payment/request
https://secure-global.paytabs.com/payment/request
Request Parametersβ
- The Minimum Required Parameters
- The Available Optional Parameters
To initiate a payment request using this integration type, there are minimum 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 |
---|---|---|---|---|
| INT | Accept only valid profile number | β | |
The merchant Profile ID you can get from your PayTabs dashboard. For more information please check ourHow to get your account information from PT2 Dashboard?tutorial article. To know more about this parameter pleaseclick here. | ||||
| ||||
| STRING | Valid string from this enum list: sale auth refund register void | β | |
the identification of the type of the transaction. To know more about these types please check ourWhat is the "tran_type" (transaction type)?solution article. To know more about this parameter pleaseclick here. | ||||
| ||||
| STRING | Valid string from this list ecom recurring moto | β | |
the identification of the category/class this transaction will follow, such as eCommerce, Recurring, etc. To know more about these types please check ourWhat is the "tran_class" (transaction class)?solution article. To know more about this parameter pleaseclick here. | ||||
| ||||
| STRING | β | ||
Indicates the cart/order id at the merchant end to easily relate the transaction to. To know more about this parameter pleaseclick here. | ||||
| ||||
| STRING | β | ||
Indicates the cart/order description at the merchant end to easily relate the transaction to. To know more about this parameter pleaseclick here. | ||||
| ||||
| STRING | Valid string from the following list:SAR AED BHD EGP EUR GBP HKD IDR INR IQD JOD JPY KWD MAD OMR PKR QAR USD Accepts both upper- and lower-case characters | β | |
Indicates the transaction currency, which the customer will be charged with. To know more about this parameter pleaseclick here. | ||||
| ||||
| DECIMAL | β | ||
Indicates the amount of the transaction the customer is about to be charged Both min and max values are subjected to the merchant transaction limits. To know more about this parameter pleaseclick here. | ||||
|
Now in order to create a new invoice, you need - in addition to the general required above parameters - to include new parameters required specifically for the Invoices. Find below the Additional required parameters for the Invoice:
Parameter | Data Type | Min | Max | Required |
---|---|---|---|---|
| OBJECT | At least "line_items" must be included | β | |
This is the main object that holds other parameters related to invoice creation. Including this in your request is considered the main flag to be treated as an Invoice creation request, not a normal hosted payment page request. To know more about this parameter pleaseclick here. | ||||
| ||||
| OBJECT | β | ||
This is an array of the invoice objects/items that your customer purchased. Each item will be an object that holds its specific details. To know more about this parameter pleaseclick here. | ||||
| ||||
| DECIMAL | β | ||
This is an array of the invoice objects/items that your customer purchased. Each item will be an object that holds its specific details. To know more about this parameter pleaseclick here. | ||||
| ||||
| INT | β | ||
| ||||
| INT | β | ||
| ||||
| OBJECT | β | ||
Indicates the customer details for this payment. To know more about this parameter pleaseclick here. | ||||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
|
Besides the above-mentioned required parameters, PayTabs provides you with several optional parameters, each of which empowers you with a different feature and the ability to customize your invoice payment request as much as possible it could be. The specification of these optional parameters is clarified below:
Parameter | Data Type | Min | Max | Required |
---|---|---|---|---|
| STRING | 255 Characters (Valid URL) | β | |
The callback response is a server-to-server POST response that is sent (to a pre-defined HTTPS URL) with the full detailed transaction information once the payment process has ended (whether the customer cancels, paid, or failed to pay). It does not depend on the customer's actions; the response will be sent anyway.What is the Return URL vs the Callback URL? To know more about this parameter pleaseclick here. | ||||
| ||||
| OBJECT | β | ||
Indicates the shipping details for this payment. If provided, the payment page will be prefilled with the provided data. To know more about this parameter pleaseclick here. | ||||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | Pass one of the following list: 2 - Hex32 3 - AlphaNum20 4 - Digit22 5 - Digit16 6 - AlphaNum32 | β | |
The tokenization format the generated token should follow.Token Based Transactions (Recurring). To know more about this parameter pleaseclick here. | ||||
| ||||
| OBJECT | β | ||
For more customizations, you can pass to the Transaction API request your own "user-defined fields" up to 9 fields, and accordingly, you would receive those fields in the callback response. To know more about this parameter pleaseclick here. | ||||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
| ||||
| STRING | β | ||
|
Request & Response Payload Samplesβ
- Required Parameters Sample Payloads
- Optional Parameters Sample Payloads
The below sample request payload will show you how you can pass the above-mentioned required parameters, which are needed to be passed with valid values to perform a request. Along with the response payload received after using this request payload.
- Sample Request Payload
- Sample Response Payload
{
"profile_id": "987###",
"tran_type": "sale",
"tran_class": "ecom",
"cart_id": "CART#1001",
"cart_currency": "SAR",
"cart_amount": 500,
"cart_description": "Description of the items/services",
}
{
"tran_ref": "TST22********159",
"tran_type": "Sale",
"cart_id": "CART#1001",
"cart_description": "Description of the items/services",
"cart_currency": "SAR",
"cart_amount": "500.00",
"return": "none",
"redirect_url": "https://secure.paytabs.com/payment/page/5994585B6B*************B481739688688",
"serviceId": 2,
"profileId": 9*****4,
"merchantId": 1*****7,
"trace": "PMN****4.63****A8.00****C4"
}
The below sample request payload will show you how you can pass the above-mentioned optional parameters, which are needed to be passed with valid values to perform a request. Along with the response payload received after using this request payload.
- Sample Request Payload
- Sample Response Payload
{
"profile_id": **Your profile ID**,
"tran_type": "sale",
"tran_class": "ecom",
"cart_description": "Description of the items/services",
"cart_id": "Unique order reference00",
"cart_amount": 25000.2,
"cart_currency": "SAR",
"paypage_lang": "en",
"return":"** Valid Return URL **",
"callback":"** Valid callback URL **",
"customer_details": {
"name": "FirstName LastName",
"email": "demo@paytabs.com",
"phone": "0522222222",
"street1": "address street",
"city": "cc",
"state": "C",
"country": "AE",
"zip": "12345"
},
"shipping_details": {
"name": "FirstName LastName",
"email": "demo@paytabs.com",
"phone": "971555555555",
"street1": "street2",
"city": "dubai",
"state": "dubai",
"country": "AE",
"zip": "54321"
},
"user_defined": {
"test": "UDF1 Test",
"test2": "UDF2 Test",
"udf3": "UDF3 Test",
"udf4": "UDF4 Test",
"udf5": "UDF5 Test",
"udf6": "UDF6 Test",
"udf7": "UDF7 Test",
"udf8": "UDF8 Test",
"udf9": "UDF9 Test"
},
"card_discounts":[
{
"discount_cards" : "41111,520000",
"discount_amount" : "30.00",
"discount_percent" : "25",
"discount_title" : "30.00 SAR and 25% discount on cards starts with 41111, 520000",
}
],
"config_id": 2188,
"card_filter": "411111",
"card_filter_title": "Only accept cards start with 41111",
"tokenise": 2,
"show_save_card": true,
"hide_shipping":true,
"donation_mode":true,
"cart_min":5,
"cart_max":10,
"framed": true,
"framed_return_top": true,
"framed_return_parent": true
}
{
"tran_ref": "TST22********159",
"tran_type": "Sale",
"cart_id": "CART#1001",
"cart_description": "Description of the items/services",
"cart_currency": "SAR",
"cart_amount": "500.00",
"return": "none",
"redirect_url": "https://secure.paytabs.SA/payment/page/599455B6B************B4817FD44688",
"serviceId": 2,
"profileId": 9*****4,
"merchantId": 1*****7,
"trace": "PMN****4.63****A8.00****C4"
}
The Payment Page Experienceβ
Reaching this point, you are now able to initiate an Invoice through the payment endpoint API request and as you now, the process involves several key steps that ensure a smooth payment and tracking experience for both you and customers. Hereβs how it works:
-
Initiating the Request: Once you initiate a payment request, you will receive a response that includes a redirect URL. This URL is crucial for guiding your customer through the payment process.
"redirect_url": "https://secure.paytabs.com/payment/page/599458B182E5B6B********************B4817FD44318539688688",
-
Redirecting the Customer: You should redirect your customer to this URL as you normally would in a payment transaction. This step allows the customer to complete their payment securely and efficiently. Below are the resulted payment page that your customer will be redirected to:
-
Tracking in the Merchant Dashboard: After the payment is completed, the transaction will be displayed in your Merchant Dashboard. You can view the details of it in the transaction view.
This process ensures that you have full visibility and control over your split payouts, from initiating the transaction to tracking its completion in the dashboard.