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. | ||||
| ||||
| STRING | 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. | ||||
| ||||
| STRING | Valid PayLink title | β | |
this is a string field that contain PayLink title to identify between links | ||||
|
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] | ||||
| ||||
| STRING | β | ||
this field detect shows which channel of integration/dashboard makes this transaction, this field will be returned in the IPN, callback and query transaction | ||||
| ||||
| OBJECT | β | ||
This object will contain 3Ds details of the card | ||||
| ||||
Nested Parameter | Data Type | Min | Max | Required |
| INT | N/A | N/A | β |
This parameter indicates the agreement description which you can use to distinguish your agreements and you can also use it as a title for your agreement. | ||||
| STRING | N/A | N/A | β |
| STRING | N/A | N/A | β |
| STRING | N/A | N/A | β |
| STRING | N/A | N/A | β |
| STRING | N/A | N/A | β |
CAVV is a cryptographic value generated during a 3D Secure transaction (e.g., Visa Secure, Mastercard Identity Check, AMEX SafeKey). It proves that authentication was performed by the cardholder. | ||||
| STRING | N/A | N/A | β |
UCAF is a security field used to pass authentication data between merchants, payment processors, and card issuers. | ||||
| STRING | N/A | N/A | β |
This parameter shares 3Ds version which vary from card to another | ||||
| STRING | β | ||
Trace code (trace) is the parameter that Indicates the code that PayTabs can trace this response with | ||||
| ||||
| STRING | β | ||
Trace code (trace) is the parameter that Indicates the code that PayTabs can trace this response with | ||||
| ||||
| INT | β | ||
This parameter is a status code, that shows the code of the error and will be followed with message field that clarify the error | ||||
| ||||
| STRING | β | ||
This parameter is showing error message which is always shown after code parameter shown in the response | ||||
| ||||
| STRING | β | ||
Indicates the same as Transaction Reference on the PayTabs side check details on [Response Parameters | tran_ref], but it's used for forsa refund transactions | ||||
| ||||
| STRING | β | ||
it transaction reference related to forsa provider( payment method, it's differs from paytabs reference | ||||
| ||||
| STRING | β | ||
Indicates the same as Transaction Reference on the PayTabs side check details on [Response Parameters | tran_ref], but it's in the response of the refund of forsa #TODO#ADDFORSA ENDOINTHERE# | ||||
| ||||
| DECIMAL | 0.01 | 99999999.99 | β |
indicate the refunded amount from the normal detected transaction, means that you may partial refund not full | ||||
| ||||
| #boolean | β | ||
boolean field indicates if the refund is done or not | ||||
| ||||
| OBJECT | β | ||
Indicates the form of payment information in detail. | ||||
| ||||
Nested Parameter | Data Type | Min | Max | Required |
| STRING | N/A | N/A | β |
The type of payment method used (e.g., 'Visa', 'Mastercard', 'ApplePay', 'Amex', etc). | ||||
| STRING | N/A | N/A | β |
Specifies whether the card is a 'Credit' or 'Debit' card. For all payments other than bank cards, this parameter will not be present. | ||||
| STRING | N/A | N/A | β |
The card network or brand (e.g., 'Visa', 'Mastercard', 'Amex'). For all payments other than bank cards, this parameter will be empty. | ||||
| STRING | N/A | N/A | β |
A masked representation of the card number for security purposes. For all payments other than bank cards, this parameter will shows the payment method name. | ||||
| INT | N/A | N/A | β |
The expiration month of the card (1-12). For all payments other than bank cards, this parameter will not be present. | ||||
| INT | N/A | N/A | β |
The expiration year of the card (e.g., 2027). For all payments other than bank cards, this parameter will not be present. | ||||
| STRING | N/A | N/A | β |
The two-letter country code (ISO 3166-1 alpha-2) of the payment method issuer (e.g., 'SA' for Saudi Arabia). | ||||
| STRING | N/A | N/A | β |
The name of the financial institution that issued the card, or funded the installment plan (for example, 'Valu', 'Arab National Bank', etc) | ||||
| OBJECT | β | ||
The main object containing contact transaction details. | ||||
| ||||
Nested Parameter | Data Type | Min | Max | Required |
| STRING | N/A | N/A | β |
A unique identifier for the transaction session. | ||||
| STRING | N/A | N/A | β |
The invoice number for tracking the payment plan. | ||||
| STRING | N/A | N/A | β |
The unique identifier of the client (customer ID). | ||||
| DECIMAL | N/A | N/A | β |
The total price of all items in the installment plan. | ||||
| DECIMAL | N/A | N/A | β |
The total down payment amount for all items. | ||||
| Array | N/A | N/A | β |
A list of items included in the contact transaction. | ||||
Nested Parameter | Data Type | Min | Max | Required |
| STRING | N/A | N/A | β |
The unique identifier of the item being purchased. | ||||
| DECIMAL | N/A | N/A | β |
The total price of the item in the installment plan. | ||||
| DECIMAL | N/A | N/A | β |
The initial amount paid upfront. | ||||
| INT | N/A | N/A | β |
The number of months (or installments) for repayment. | ||||
| DECIMAL | N/A | N/A | β |
Any administrative fees associated with the plan. | ||||
| BOOLEAN | N/A | N/A | β |
Indicates if the item qualifies for a bonus offer. | ||||
| STRING | β | ||
Indicates the link to which customers should be directed to complete their PayLink payment. | ||||
| ||||
| INT | β | ||
Indicates the PayLink ID you can find on your merchant dashboard PayLinks menu. | ||||
| ||||
| BOOLEAN | β | ||
Indicates whether the PayLink status is Actively enabled or disabled, by default is true 'Active'. | ||||
|
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.