Request: Manage the Hosted Payment Page's session expiry (paypage_ttl)
This parameter ONLY working with those integration types (Hosted Payment Page, Invoices(Payment Endpoint)).
The PayPage Time to live (TTL) parameter one of the optional parameters. It allows the merchant to set the expiry value of the payment page in minutes, with a minimum duration of 1 minute..
By default, the initial Payment Page URL will expire after 20 minutes.
Next, we can delve into the specifics of how to implement the
paypage_ttl
parameter in your requests.How this parameter could benefit you?​
Implementing the paypage_ttl
parameter can thus provide a more tailored and efficient payment experience, benefiting both your business operations and customer satisfaction.
Control Over Payment Window Duration: The parameter allows merchants to define how long a payment page remains active. This ensures that customers complete transactions within a specific timeframe, reducing the risk of abandoned carts and improving conversion rates.
Ideal for Time-Sensitive Products: For products or services with frequently changing prices, such as airline tickets, hotel bookings, and flash sale items, the parameter ensures that payment is made before the price changes. This reduces mismatched or outdated pricing issues, providing a smoother transaction experience for both merchants and customers.
Customizable Based on Business Needs: Merchants can customize the TTL based on their specific business needs, allowing for flexibility in managing payment windows according to different scenarios and requirements.
Name but a few different Businesses/Industries that can benefit from this API parameter:
- Airlines: Managing ticket sales with frequently changing prices.
- Hotels: Handling bookings with dynamic pricing.
- E-commerce: Managing flash sales and limited-time offers.
- Event Management: Selling tickets for events with specific timeframes.
- Subscription Services: Ensuring timely payments for subscription renewals.
- Retail: Managing inventory for high-demand products.
Limitations​
- The value must be specified as an integer representing minutes. Fractional values are not supported.
How to Use?​
In order for you to start use the paypage_ttl
parameter, you kindly need to follow the below simple steps:
- Within the initiation of the request payload of the payment integration, you will use the parameter
paypage_ttl
within the main request payload itself as shown below:{
"paypage_ttl": 1
} - Once you post your request, you will receive a response that includes the
redirect_url
of the payment page that will need to direct the customer to complete the payment process, and will expire after the provided time session pass{
...
"redirect_url": "https://secure.paytabs.com/payment/page/599458B1826B**************B4818688",
....
}
Parameter Specifications​
-
paypage_ttl
Parameter paypage_ttl
Description Indicates the Hosted Payment Page's session expiry in minutes. Data Type INT Required ✘ Min 1 Max 20 Minutes by default. Validation Rules The PayPage link will expire once the TTL period expires, regardless of whether the link has been generated but not accessed before the TTL expires. Sample {
"paypage_ttl": 1
}
Request & Response Payloads Samples​
- Hosted Payment Page
- Invoices
The below sample request payload will show you how you can pass the above-mentioned required parameter, which are needed to be passed with valid values to perform a request. Along with the response payload received after using this request payload.
- Request Sample Payload
- Response Sample Payload
{
"profile_id": "79000",
"tran_type": "sale",
"tran_class": "ecom",
"cart_id": "cart_101",
"cart_currency": "SAR",
"cart_amount": 120,
"cart_description": "Description of the items/services",
"paypage_lang": "en",
"customer_details": {
"name": "Technical Support",
"email": "[email protected]",
"phone": "+966 55 xxxxxx6",
"street1": "street2",
"city": "Riyadh",
"state": "Riyadh",
"country": "SA",
"zip": "54321"
},
"shipping_details": {
"name": "Technical Support",
"email": "[email protected]",
"phone": "+966 55 xxxxxx6",
"street1": "street2",
"city": "Riyadh",
"state": "Riyadh",
"country": "SA",
"zip": "54321"
}
"paypage_ttl": 1
}
{
"tran_ref": "TST22********159",
"tran_type": "sale",
"cart_id": "cart_101",
"cart_description": "Description of the items/services",
"cart_currency": "SAR",
"cart_amount": "120",
"tran_total": "0",
"return": "none",
"redirect_url": "https://secure.paytabs.com/payment/wr/5DBXXX4F5BB9C2EXXXX8249E75E3D4D8C84",
"customer_details": {
"name": "Technical Support",
"email": "[email protected]",
"phone": "+966 55 xxxxxx6",
"street1": "street2",
"city": "Riyadh",
"state": "01",
"country": "SA",
"zip": "54321",
"ip": "101.44.112.000"
},
"shipping_details": {
"name": "Technical Support",
"email": "[email protected]",
"phone": "+966 55 xxxxxx6",
"street1": "street2",
"city": "Riyadh",
"state": "01",
"country": "SA",
"zip": "54321",
}
"serviceId": 2,
"paymentChannel": "Payment Page",
"profileId": 79000,
"merchantId": 00000,
"trace": "PMNT0000.67F40000.00150000"
}
The below sample request payload will show you how you can pass the above-mentioned required parameter/s, which are needed to be passed with valid values to perform a request. Along with the response payload received after using this request payload.
- Request Sample Payload
- Response Sample Payload
{
"profile_id": {{profile_id}},
"tran_type": "sale",
"tran_class": "ecom",
"cart_currency": SAR,
"cart_amount": "9.5",
"cart_id": "cart_12345_2",
"cart_description": "Test Description",
"hide_shipping": true,
"paypage_ttl": 1
"invoice": {
"id": 3130066,
"shipping_charges": "0",
"extra_charges": "0",
"extra_discount": "0",
"total": "9.5",
"activation_date": 0,
"expiry_date": 0,
"due_date": 0,
"issue_date": 1733909180,
"line_items": [
{
"sku": "sku",
"description": "invoice item",
"url": "https://paytabs.com",
"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"
}
]
},
}
{
"tran_ref": "TST22********159",
"tran_type": "Sale",
"cart_id": "CART#1001",
"cart_description": "Description of the items/services",
"cart_currency": "SAR",
"cart_amount": "9.5",
"tran_total": ""tran_total": "0",",
"return": "none",
"redirect_url": "https://secure.paytabs.com/payment/page/599458B********************B18539688688",
"invoice": {
"id": 3130066,
"shipping_charges": "0",
"extra_charges": "0",
"extra_discount": "0",
"total": "9.5",
"activation_date": 0,
"expiry_date": 0,
"due_date": 0,
"issue_date": 1733909180,
"line_items": [
{
"sku": "sku",
"description": "invoice item",
"url": "https://paytabs.com",
"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"
}
]
},
"serviceId": 2,
"paymentChannel": "Payment Page",
"profileId": 9*****4,
"merchantId": 1*****7,
"trace": "PMN****4.63****A8.00****C4"
}
Expected Payment Flow Behavior​
- Hosted Payment Page
- Invoices
- As mentioned above in the How to use? section, As a merchant you would initiate a payment request per the above Specifications, same as the sample codes mentioned in the samples section above.
- Then, you will receive a response that includes the redirect URL. This means you have initiated a correct payment request/page successfully.
{
.
.
"redirect_url": "https://secure.paytabs.com/payment/page/52E5B6B*************B4818688",
.
.
} - Next, you should redirect your customer to this URL so the payment process can be finalized.
- After this, your customer would proceed normally with payment by choosing the preferred payment method (if available), and providing his card information.
- However, if the merchant didn't make any action before the expiration of the PayPage TTL period, or if the PayPage link is accessed after this period has expire, the session will terminate, preventing the customer from proceeding further. The following message will be displayed:
- If the customer proceeds within the allowed time, Then, they will be redirected to their issuer bank 3DS/OTP page to authenticate the used card.
- Finally, he would be redirect to a success/error page accordingly. By this time, you will be able to see his transaction on your merchant dashboard, whether it's accepted/authorized or not.
- As mentioned above in the How to use? section, As a merchant you would initiate a payment request per the above Specifications, same as the sample codes mentioned in the samples section above.WarningBe aware that this feature is only supported when initiating an invoice via the payment endpoint
- Then, you will receive a response that includes the redirect URL. This means you have initiated a correct payment request/page successfully.
{
.
.
"redirect_url": "https://secure.paytabs.com/payment/page/52E5B6B*************B4818688",
.
.
} - Next, you should redirect your customer to this URL so the payment process can be finalized.
- After this, your customer would proceed normally with payment by choosing the preferred payment method (if available), and providing his card information.
- However, if the merchant didn't make any action before the expiration of the PayPage TTL period, or if the PayPage link is accessed after this period has expire, the session will terminate, preventing the customer from proceeding further. The following message will be displayed:
- If the customer proceeds within the allowed time, Then, they will be redirected to their issuer bank 3DS/OTP page to authenticate the used card.
- Finally, he would be redirect to a success/error page accordingly. By this time, you will be able to see his transaction on your merchant dashboard, whether it's accepted/authorized or not.