Esenda
Embedded Checkout

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

AttributeValueRequiredDescription
srcYOUR_CHECKOUT_SESSION_URLYesThe 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.
allowpayment; clipboard-writeYesBrowser permissions the checkout needs to function. See Allow permissions below.
titlee.g. Esenda CheckoutNoRecommended for accessibility. Screen readers announce this when the payer reaches the iframe.
widthe.g. 100%NoSee Recommended size.
heighte.g. 1040NoSee 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.

ValueRequiredDescription
paymentYesGrants 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-writeYesLets 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:

ValueWhy it's needed
allow-scriptsThe checkout is a JavaScript application and won't render without scripts.
allow-same-originLets the checkout keep its session and talk to payment providers securely.
allow-formsLets payers submit card and payment details.
allow-popupsSome payment steps, such as bank authentication or 3D Secure, open in a new window.
allow-popups-to-escape-sandboxLets those payment windows work normally rather than inheriting the iframe's restrictions.
allow-top-navigation-by-user-activationLets 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.

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 widthMinimum height
360px1040px
Greater than 360px, up to 480px930px
Greater than 480px850px
<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.

CheckcheckIdSeverityWhat to change
Blocked payment permissioniframe-payment-permissionErrorAdd 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 permissioniframe-clipboard-write-permissionWarningAdd 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 tokensiframe-sandboxErrorAdd both allow-popups and allow-popups-to-escape-sandbox, keeping the other required tokens.
Sandbox can't be verifiediframe-sandboxWarningCheck that the rendered iframe's sandbox attribute contains all required tokens.
Iframe smaller than recommendediframe-sizeWarningIncrease 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 sandbox attribute, so missing sandbox tokens often go undetected. Inspect the rendered HTML yourself. Without allow-scripts or allow-same-origin, the checkout, including its diagnostics, may not run at all.
  • A restrictive Permissions-Policy header on your page can block a feature even when allow includes it.

You can also receive diagnostics in your page, for example to forward them to your monitoring. See Integration Diagnostic Event.

Next steps

On this page