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.
This article is dedicated to the clarification of the Framed (framed) parameter. "framed" is one of the optional parameters of the request, which allows you to host the payment page in an embed frame within your site page itself.
For more information please check our How to not redirect my customers to an external payment page? (iFrame/Embedded Mode)solution article.
Be aware that ApplePay, SamsungPay, and Tappy payment methods DO NOT operate in the iFrame mode
In this article, you will be going to know:
Specifications
Framed
The Parameter Tag/Name framed JSON Example Data Type BOOLEAN Required ❌Validation Rules - true or false
Framed Return Top
The Parameter Tag/Name framed_return_top JSON Example Data Type BOOLEAN Required ❌Validation Rules - true or false
Framed Return Parent
The Parameter Tag/Name framed_return_parent JSON Example Data Type BOOLEAN Required ❌Validation Rules - true or false
Framed Message Target
The Parameter Tag/Name framed_message_target JSON Example Data Type URI Required ❌ Validation Rules - A valid HTTPS website URL
Usage Workflow
Along with the required parameters mentioned in our Step 3 - PT2 API Endpoints | Initiating the payment solution article, you may need to set the "framed" as shown below:
Sample Request Payload
Sample Response Payload
The Expected Parameter Behaviors
To enable the framed mood, you need at least use the framed property. The other properties (framed_return_top, framed_return_parent) are optional to control the reload/redirect behavior. To preview the payment page within your page instead of redirecting to the payment page.
Now you can use the redirect_url within the HTML iframe tag to embed the payment link in your site as shown below:
<iframe src="https://sec******.paytabs.com/payment/page/599******0AC4EB3D4B8B5948324" width="" height=""></iframe>
- Passing a true framed_return_top
- Passing a true framed_return_parent
- Passing a valid HTTPS URI in framed_message_target
- Using redirect URL from none farmed request
Passing a true framed_return_top
Indicates whether to reload the whole page on redirections or just reload the current frame
Passing a true framed_return_parent
Indicates whether to reload the main base (could be div or another iFrame tag) that contained the payment page framed element.
Passing a valid HTTPS URI in framed_message_target
The scenario will go through opening the Paytabs payment page within the iframe, and after the payment, since no return page was set within the request, the customer would be redirected to the Paytabs default return page.
Meanwhile, a message event would be sent to the target URI as set on the parameter "framed_message_target", to receive the message you can use the following sample. As per the above example by passing a valid HTTPS URI, Your system frontend will be able to receive the message event after the redirection to the Paytabs default return page. You can learn more by clicking here.
Using redirect URL from none farmed request
If you tried a redirect_url that belongs to none-framed transactions, the server would display this error "paytabs.com refused to connect", as shown below: