Initiating The Payment
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.
PayLinks integration type is suitable for merchants with PCI SAQ A or merchants does not have any PCI levels. To customize the UI of the PayPage, check thisHow to customize the PayPage (Hosted Payment Page) UI?, and to know more about the Hosted Payment Page PCI DSS merchant requirements, please check this article.
In this manual, we will walk you through how to initiate a payment request via this integration type. You will be introduced to the required parameters that need to be passed to initiate the request, along with all the possible optional parameters as well. We highly recommend that you and your team check our PayLinks | Payment Workflow manual first to understand the business/logic this integration type relay on.
The Endpoint and Related Postman Collectionβ
In this tutorial, we will rely on the PayTabs Hosted Payment Page API Endpoint, mentioned on PayTabs API endpoints postman collection, which you can access from PayTabs Postman APIs Collection. The endpoint will need to be accessed with a POST request on the below-mentioned URL
POST | {{domain}}/payment/link/create |
---|
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/link/create
https://secure.paytabs.com/payment/link/create
https://secure-egypt.paytabs.com/payment/link/create
https://secure-oman.paytabs.com/payment/link/create
https://secure-jordan.paytabs.com/payment/link/create
https://secure-kuwait.paytabs.com/payment/link/create
https://secure-global.paytabs.com/payment/link/create
Request 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:
- The Minimum Required Parameters
- The Available Optional Parameters
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 PT2 Dashboard? solution article. To know more about this parameter please click here. | ||||
| ||||
| INT | Valid string from this enum list: sale auth void release capture refund register | β | |
The identification of the type of the transaction. To know more about these types please check our What is the "tran_type" (transaction type)? solution article. To know more about this parameter please click 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 our What is the "tran_class" (transaction class)? solution article. To know more about this parameter please click here. | ||||
| ||||
| STRING | 1 | 64 | β |
Indicates the cart/order id at the merchant end, to easily relate the PayTabs transaction to. To know more about this parameter please click here. | ||||
| ||||
| STRING | 1 | 128 | β |
Indicates the cart/order description at the merchant end, to easily relate the PayTabs transaction to. To know more about this parameter please click here. | ||||
| ||||
| STRING | 1 | 128 | β |
Indicates the transaction currency, which the customer will be charged with. To know more about this parameter please click here. | ||||
| ||||
| DECIMAL | 0.01 | 9999999999.99 | β |
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 please click here. | ||||
|
Parameter | Data Type | Min | Max | Required |
---|---|---|---|---|
| STRING | N/A | 255 Characters (Valid URL) | β |
The return URL is the URL that PayTabs will redirect the customer to after he finishes the payment process (whether it's authenticated or not). It will redirect the customer with a POST response that is sent with the client/cardholder redirection through his browser containing the basic transaction information once the payment process ends (whether the customer cancels, paid, or failed to pay). It depends on the customer's actions, which means if the customer closes the browser right after the payment without waiting to be redirected back to your system, you will not receive this response. What is the Return URL vs the Callback URL? To know more about this parameter please click here. | ||||
| ||||
| STRING | N/A | 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 please click here. | ||||
| ||||
| BOOLEAN | β | ||
Indicates whether to hide shipping and billing information or not from the payment page. Note: The customer details are still required and must be passed in case any of the details are missing or passed with invalid values; the hide_shipping option will be ignored, and the cardholder will be required to enter any of the missing details on the payment page. To know more about this parameter please click here. | ||||
| ||||
| Object | β | ||
Indicates the customer details for this payment. If provided, the payment page will be prefilled with the provided data. To know more about this parameter please click here. | ||||
| ||||
Nested Parameter | Data Type | Min | Max | Required |
| STRING | 3 | 128 | β |
| STRING | N/A | N/A | β |
| STRING | N/A | N/A | β |
| STRING | 3 | 128 | β |
| STRING | 3 | 128 | β |
| STRING | 2 | 2 | β |
| STRING | N/A | N/A | β |
| STRING | N/A | N/A | β |
| Object | β | ||
Indicates the customer shipping details for this payment. If provided, the payment page will be prefilled with the provided data.. | ||||
| ||||
Nested Parameter | Data Type | Min | Max | Required |
| STRING | 3 | 128 | β |
| STRING | N/A | N/A | β |
| STRING | N/A | N/A | β |
| STRING | 3 | 128 | β |
| STRING | 3 | 128 | β |
| STRING | 2 | 2 | β |
| STRING | N/A | N/A | β |
| STRING | N/A | N/A | β |
| STRING | Either en or ar | β | |
Indicates the payment page displaying language. To know more about this parameter please click here. | ||||
| ||||
| DECIMAL | 0.01 | 9999999999.99 | β |
This parameter is required only if donation_mode property is present to represent the minimum amount that the customer can enter | ||||
| ||||
| DECIMAL | 0.01 | 9999999999.99 | β |
This parameter is required only if donation_mode property is present to represent the maximum amount that the customer can enter. | ||||
| ||||
| BOOLEAN | β | ||
This parameter will define whether this payment has a predefined amount or the customer will be entering the amount based on the passed cart_min and cart_max. | ||||
| ||||
| STRING | Pass one or more of the following list: click here | β | |
To know more about this parameter please click here. | ||||
| ||||
| STRING | β | ||
Indicates the Transaction Reference on the PayTabs side check details on [Response Parameters | tran_ref] | ||||
|
Request & Response Payload Samplesβ
This section is dedicated give you a sample API request payload using both the above mentioned required and optional parameters, along with showing you the response payload received upon using each request payload.
- 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": 109XXX,
"link_title": "AK-Test Title",
"cart_amount": "400",
"cart_currency": "SAR"
}
{
"link_id": 147XXX,
"profile_id": 109XXX,
"link_url": "https://secure.paytabs.com/payment/link/109XXX/1474XXX",
"link_title": "AK-Test Title",
"cart_currency": "SAR",
"cart_amount": "400",
"cart_min": "0",
"cart_max": "0",
"shipping_required": false,
"link_status": true,
"donation_mode": false,
"created_at": "2024-10-02T09:39:41Z",
"updated_at": "2024-10-02T09:39:41Z"
}
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": 109XXX,
"link_title": "AK-Test Title",
"cart_amount": "200",
"cart_currency": "SAR",
"shipping_required": true,
"return_url": "https://example.com/order/10001",
"cart_min": "100",
"cart_max": "500",
"donation_mode": true,
"discount_cards": "44444,400000",
"discount_amount": "120",
"discount_percent": "12",
"discount_title": "120 SAR discount on cards start with 44444,400000",
"opengraph": {
"status": true,
"title": "PayLink OpenGraph Title",
"desc": "PayLink OpenGraph Description",
"type": "testtype",
"filename": "thumbnail.png",
"img": "iVBORw0KGgoAAAANCYII="
}
}
{
"link_id": 147XXX,
"profile_id": 109XXX,
"link_url": "https://secure.paytabs.com/payment/link/109XXX/1474XX7",
"link_title": "AK-Test Title",
"cart_currency": "SAR",
"cart_amount": "0",
"cart_min": "100",
"cart_max": "500",
"return_url": "https://example.com/order/10001",
"shipping_required": true,
"link_status": true,
"donation_mode": true,
"created_at": "2024-10-02T14:09:22Z",
"updated_at": "2024-10-02T14:09:22Z"
"opengraph":
{
"status": true,
"title": "PayLink OpenGraph Title",
"desc": "PayLink OpenGraph Description",
"imgPath": "paylink/1804/47122/82045/opengraph.png",
"imgExt": "png",
"imgW": 640,
"imgH": 640,
"type": "website"
}
}
}
The Payment Page Experienceβ
Reaching this point, you are now able to initiate a PayLinke 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 link URL. This URL is crucial for guiding your customer through the payment process.
"link_url": "https://secure.paytabs.com/payment/link/109XXX/1474XX7",
In the meantime, your PayLink would be already created on your dashboard, which you can access from your merchant dashboard.
- 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.