Iframe Setup
Set up the embedded checkout iframe
Once you have a checkout_session_url from the Checkout Session Request, render it in an <iframe> within your application. This loads the Esenda payment form directly on your page.
Complete Domain Setup first
The checkout won't load on domains that aren't registered. See Domain Setup.
Add the iframe
Required attributes
The src and allow attributes are both required. If either is missing or
incomplete, parts of the checkout will fail, often without any visible error.
Copy the example below as your starting point.
Iframe attributes
| Attribute | Value | Required | Description |
|---|---|---|---|
src | YOUR_CHECKOUT_SESSION_URL | Yes | The checkout_session_url returned in the 200 response from the Checkout Session Request. Each URL is tied to a single order, so create a new session for each payment. |
allow | payment; clipboard-write | Yes | Browser permissions the checkout needs to function. See Allow permissions below. |
title | e.g. Esenda Checkout | No | Recommended for accessibility. Screen readers announce this when the payer reaches the iframe. |
width | e.g. 100% | No | See Recommended size. |
height | e.g. 1040 | No | See Recommended size. |
Allow permissions
The allow attribute grants the iframe access to browser features that are blocked by default for embedded content. Both of the following values are required.
| Value | Required | Description |
|---|---|---|
payment | Yes | Grants the iframe access to the browser's Payment Request API. Without it, Apple Pay and Google Pay will not be shown or will fail inside the iframe. See Domain Setup. |
clipboard-write | Yes | Lets payers copy content from inside the iframe, such as bank transfer details (account number, sort code, payment reference). Without it, copy buttons in the checkout will not work. |
Multiple allow values are separated by a semicolon, e.g. allow="payment; clipboard-write".
Sandbox attribute
We recommend not adding a sandbox attribute to the checkout iframe.
Sandboxed iframes block the checkout
An empty sandbox attribute disables scripts, forms and popups, so the
checkout can't load or take payments. Some frameworks, CMS platforms and
security policies add sandbox automatically, so check the rendered HTML in
your browser's developer tools, not just your source code.
If your platform requires a sandbox attribute, it must include all of the following values:
| Value | Why it's needed |
|---|---|
allow-scripts | The checkout is a JavaScript application and won't render without scripts. |
allow-same-origin | Lets the checkout keep its session and talk to payment providers securely. |
allow-forms | Lets payers submit card and payment details. |
allow-popups | Some payment steps, such as bank authentication or 3D Secure, open in a new window. |
allow-popups-to-escape-sandbox | Lets those payment windows work normally rather than inheriting the iframe's restrictions. |
allow-top-navigation-by-user-activation | Lets payment methods that redirect, such as open banking, continue when the payer chooses to proceed. |
<iframe
src="YOUR_CHECKOUT_SESSION_URL"
allow="payment; clipboard-write"
sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation"
title="Esenda Checkout"
></iframe>The allow attribute is still required alongside sandbox. The two control different things, and sandbox doesn't replace it.
Recommended size
The checkout is responsive and designed for a minimum width of 360px, which covers most mobile screens.
Recommended dimensions
Width: set width="100%" so the checkout fills its container, and make
sure the container is at least 360px wide. Below 360px, content may be cropped
or need horizontal scrolling.
Height: use height="1040" as a default that meets the minimum height
at every supported width. If you adjust the height for wider containers,
use the minimum heights below.
| Iframe width | Minimum height |
|---|---|
| 360px | 1040px |
| Greater than 360px, up to 480px | 930px |
| Greater than 480px | 850px |
<div style="min-width: 360px;">
<iframe
src="YOUR_CHECKOUT_SESSION_URL"
allow="payment; clipboard-write"
title="Esenda Checkout"
width="100%"
height="1040"
></iframe>
</div>Iframe example
<iframe
src="YOUR_CHECKOUT_SESSION_URL"
allow="payment; clipboard-write"
title="Esenda Checkout"
width="100%"
height="1040"
></iframe>Integration diagnostics
When embedded, the checkout checks for common integration problems and logs any it finds to your browser's DevTools console. Messages start with [Esenda Checkout] and end with a link to the relevant documentation. If you don't see them, make sure warnings are shown and the console isn't filtered to the top frame only.
| Check | checkId | Severity | What to change |
|---|---|---|---|
Blocked payment permission | iframe-payment-permission | Error | Add payment to the iframe's allow attribute and check your page's Permissions-Policy header. This is reported even if Apple Pay and Google Pay aren't enabled yet, because wallets can be switched on after you go live. |
Blocked clipboard-write permission | iframe-clipboard-write-permission | Warning | Add clipboard-write to allow and check your page's Permissions-Policy header. Copy buttons won't work, though payers can still copy bank details manually. |
| Sandbox missing popup tokens | iframe-sandbox | Error | Add both allow-popups and allow-popups-to-escape-sandbox, keeping the other required tokens. |
| Sandbox can't be verified | iframe-sandbox | Warning | Check that the rendered iframe's sandbox attribute contains all required tokens. |
| Iframe smaller than recommended | iframe-size | Warning | Increase the container to meet the recommended size. The message includes the actual and required dimensions. |
Each check reports at most once per iframe load; reloading the iframe resets this. Size is rechecked whenever the iframe is resized.
Limitations
Diagnostics don't replace testing
A clean console doesn't mean your integration is correct. Keep all required attributes and sandbox tokens, and test every payment method you offer.
- Browser support for Permissions Policy APIs varies. Where a check can't run reliably, it won't report a problem, or it will ask you to verify manually.
- The checkout usually can't read your iframe's
sandboxattribute, so missing sandbox tokens often go undetected. Inspect the rendered HTML yourself. Withoutallow-scriptsorallow-same-origin, the checkout, including its diagnostics, may not run at all. - A restrictive
Permissions-Policyheader on your page can block a feature even whenallowincludes it.
You can also receive diagnostics in your page, for example to forward them to your monitoring. See Integration Diagnostic Event.
Next steps
- Match the checkout to your brand with Iframe Customisation.
- Receive order status updates via Webhooks.
- Query the status of an order via Status Information.
- Listen for in-page events from the iframe via Embedded Flow Events.