Initiating The Payment
Hosted Payment Page integration type is ideal for merchants with PCI SAQ A or those without any PCI levels. To customize the UI of the hosted payment page, check thisarticle, and to learn more about the PCI DSS merchant requirements for the Hosted Payment Page, please check thisarticle.
The Endpoint and Related Postman Collectionβ
In this manual, we will rely on the PayTabs Hosted Payment Page API Endpoint, mentioned on PayTabs API endpoints postman collection, which you can access fromPayTabs Postman APIs Collection. 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
- Iraq
- Morocco
- Qatar
- 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-iraq.paytabs.com/payment/request
https://secure-morocco.paytabs.com/payment/request
https://secure-doha.paytabs.com/payment/request
https://secure-global.paytabs.com/payment/request
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 STRING | 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. | ||||
| ||||
| 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. | ||||
| ||||
| 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. | ||||
| ||||
| OBJECT | β | ||
| Indicates the customer shipping details for this payment. If provided, the payment page will be prefilled with the provided data.. | ||||
| ||||
| BOOLEAN | β | ||
| Indicates whether to preview the payment page within the current check page instead of redirection or not. If β, preview the redirect URL sent in the response in '<iframe>' HTML tag, which will preview the whole payment page within this frame. To know more about this parameter please click here. | ||||
| ||||
| BOOLEAN | β | ||
| Indicates whether to reload the whole page on redirections or just reload the current frame. To know more about this parameter please click here. | ||||
| ||||
| BOOLEAN | β | ||
| Indicates whether to reload the main base (could be div or another iFrame tag) that contained the payment page framed element. To know more about this parameter please click here. | ||||
| ||||
| URI | A valid HTTPS website URL of your domain (the recipient) that will receive the event. In order for the event to be dispatched, this domain must match exactly (including scheme, hostname, and port). | β | |
| If you didn't have a return URL, PayTabs default return page (return: 'None'), to receive the message after the payment is done using the javascript, which gives your system the ability to close the iFrame after payment | ||||
| ||||
| STRING | Either en or ar or fr | β | |
| Indicates the payment page displaying language. To know more about this parameter please click here. | ||||
| ||||
| INT | Valid Theme ID (from PayTabs dashboard) | β | |
| Allows you to choose between your list of themes that have been created on your PayTabs dashboard. This chosen theme will be applied to the created payment page. | ||||
| ||||
| 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 please click here. | ||||
| ||||
| Array | β | ||
| To provide discounts for specific customers. To know more about this parameter please click here. | ||||
| ||||
| STRING | N/A | 255 character | β |
card_filter is one of the optional parameters that the request may have, which will allow you to accept only cards that start with a specific number/identifier/BIN code you want. | ||||
| ||||
| STRING | Pass one of the following list:
| β | |
| The tokenization format the generated token should follow. Token-Based Transactions. To know more about this parameter please click here. | ||||
| ||||
| BOOLEAN | β | ||
| For showing the βsave this cardβ option on the payment page. 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 | 3 Characters | 3 Characters | β |
| Indicates an alternative currency that you want to display your amount with it in your payment page. This will allow you to display the approximate amount of the payment cart amount in this alternative currency for this transaction.. | ||||
| ||||
| STRING | Pass one or more of the following list: click here | β | |
| To know more about this parameter please click here. | ||||
| ||||
| STRING | β | ||
| token from previously tokenised transaction. 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] | ||||
| ||||
| 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. | ||||
| ||||
| BOOLEAN | β | ||
| If you set this parameter to true you will get a QR code image as encoded Base64 code within the response payload. | ||||
| ||||
| OBJECT | β | ||
| To provide more customization on token, and modify it if you don't like to use the default one | ||||
| ||||
| 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 customer reference that is provided from the merchant side. | ||||
| ||||
| INT | 1 | 20 Minutes by default. | β |
| Indicates the Hosted Payment Page's session expiry in minutes. | ||||
| ||||
| OBJECT | β | ||
| Indicates the merchant's ability to verify the customer's card BIN before proceeding with the transaction. | ||||
| ||||
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": "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/599458B182E5B6B********************B4817FD44318539688688",
"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": "[email protected]",
"phone": "0522222222",
"street1": "address street",
"city": "cc",
"state": "C",
"country": "AE",
"zip": "12345"
},
"shipping_details": {
"name": "FirstName LastName",
"email": "[email protected]",
"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,
"framed_message_target": "**Valid URL**"
}
{
"tran_ref": "TST22********159",
"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",
"return": "none",
"redirect_url": "https://secure.paytabs.com/payment/page/599458B182E5B6B********************B4817FD44318539688688",
"customer_details": {
"name": "FirstName LastName",
"email": "[email protected]",
"phone": "0522222222",
"street1": "address street",
"city": "cc",
"state": "C",
"country": "AE",
"zip": "12345"
},
"shipping_details": {
"name": "FirstName LastName",
"email": "[email protected]",
"phone": "971555555555",
"street1": "street2",
"city": "dubai",
"state": "dubai",
"country": "AE",
"zip": "54321"
},
"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 a Hosted Payment Page 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.