Embedded Checkout
Embed the HL Hunt payment form directly into your page for a seamless checkout experience that matches your site's design.
How Embedded Checkout Works
Embedded Checkout renders the payment form inline within a container element on your page. Unlike Popup Checkout, the form is part of your page layout rather than an overlay.
Benefits:
- Inline experience — feels native to your page
- Full control over layout — place it anywhere in your flow
- PCI compliant — sensitive data handled in a secure iframe
- Responsive — adapts to your container width
Integration
Add a container element and mount the checkout form:
<div id="checkout-container"></div>
<script src="https://payments.hlhunt.org/js/hlhunt-checkout.js"></script>
<script>
var checkout = HLHunt.checkout.mount("#checkout-container", {
sessionKey: "cs_abc123",
onSuccess: function (payload) {
window.location.href = "/thank-you";
},
onCancel: function (payload) {
console.log("Buyer cancelled", payload);
},
onError: function (payload) {
console.error("Checkout error", payload);
}
});
// checkout.unmount() removes the iframe when you no longer need it.
</script>- Create a Checkout Session on your server.
- Add a
<div>where you want the form to appear. - Call
HLHunt.checkout.mount()with the container selector and the session key. - Handle the success callback to redirect or show a confirmation. The call returns an object with an
unmount()method and the underlyingiframe.
Mount Options
The embedded form renders in an auto-resizing iframe and is styled by your HL Hunt branding settings, not by page CSS. The mount call accepts these options:
| Option | Description |
|---|---|
| sessionKey | Required. The checkout session key returned by your server. |
| minHeight | Minimum iframe height in pixels before it auto-resizes to its content. Defaults to 200. |
| onReady | Fires once the embedded form has loaded. |
| onSuccess | Fires when the payment succeeds. |
| onCancel | Fires when the buyer cancels. |
| onError | Fires when the checkout reports an error. |