https://www.hizz.io/embed/buy, so partner pages never
load the full Hizz app or its styles — they just get the trade box.
- Loader script:
https://www.hizz.io/widget/hizz-buy.js - Frame URL:
https://www.hizz.io/embed/buy?asset=<policyId|assetId> - Version:
window.HizzBuyWidget.version(1.2.0) · no API key required
The loader auto-detects its own origin from the
<script src>, so the iframe
always points back to wherever the script was loaded from. Use
https://www.hizz.io unless you self-host.Live demo
The real widget, embedded cross-origin. This example uses SNEK; swap in any Cardanoasset.
This preview loads
https://www.hizz.io/widget/hizz-buy.js and mounts with
window.HizzBuyWidget.mount(...), the same path as a partner site using the
loader. Wallets that only inject into the top-level page, including VESPR,
can be bridged into the frame when window.cardano.vespr exists on this page.Live — SNEK / ADA, dark theme
Quick start
The fastest integration — drop one tag where the widget should appear. When the script itself carriesdata-asset, the loader inserts a host element right
after it and mounts. Nothing else required.
Integration methods
1. Container element (recommended)
Full control over placement. The loader scans for[data-hizz-buy-widget] on
load and mounts each match.
2. Custom element
3. Programmatic mount
For containers that appear after load (modals, SPA routes, infinite scroll).mount(target, options) takes a CSS selector or an element, returns the iframe,
and is idempotent per element.
4. Raw iframe (fallback only)
For strict CSP or static-only pages. This can render the trade box, but it should not be the primary integration when wallet connect matters. You lose automatic height resizing — pick a fixed height that fits — and the wallet bridge: wallets that only inject into the top-level page (e.g. VESPR) will not be connectable inside the frame.Options
Pass options as kebab-casedata-* attributes on the host element/script, as
attributes on the custom element, or as camelCase keys in mount(target, options).
Themes
dark— default Hizz dark surface with a soft brand glow.light— light surface.snek— Snek “spotlight” mint-on-charcoal theme (good for snek.fun tokens).transparent— no page background, border, or padding. Use this to sit the box flush inside your own card or section.
Partner attribution and trade volume
Set a stablepartner value on every widget placement whose volume you want
attributed. For example, all HODLCOMP placements should use
partner: "hodlcomp" (or data-partner="hodlcomp"). Hizz stores that value on
the corresponding trade order as soon as the swap is built. ref can split a
partner’s traffic into campaigns without creating a second partner identity.
partner is an attribution label, not an API secret, payout instruction, or
server webhook. Hizz can aggregate finalized volume from its verified trade
orders later; the browser event below provides immediate per-trade data to the
partner page.
Programmatic callback
onTradeSubmitted runs after the connected wallet returns an on-chain
transaction hash:
volumeLovelace for immediate page analytics; use Hizz’s
verified reporting for final totals. A limit-order placement is not trading
volume and does not emit this event.
For buys, volume is the ADA input. For sells/recoveries, it is the quoted ADA
output (volumeBasis: "expected_output", with minimum output as a fallback).
The callback is a submission notification, not confirmation that the chain has
included the transaction.
Raw postMessage
The iframe also posts the same payload to its parent. This supports raw iframe
integrations and event-bus style integrations without a mount callback:
event.origin. The loader does this origin and iframe-source
validation before it invokes onTradeSubmitted.
Auto-resize
The framed page measures its content and posts its height to the parent:Trading & sign-in inside the embed
The embedded box uses the same trade engine as hizz.io, but it runs in a cross-origin iframe on your page, which limits how users can authenticate. CIP-30 wallets are the only sign-in path inside an embed (social login is hidden there). Two ways a wallet becomes available in the frame:- Direct injection — most extensions (Eternl, Lace, …) inject
window.cardanointo every frame, so the widget sees them natively. - Wallet bridge (loader v1.1.0+) — some wallets, VESPR in particular,
only inject into the top-level page. The loader script running on your
page detects them and proxies the CIP-30 calls into the frame over
postMessage. This is automatic — no partner code, no config. Approval and signing prompts are still rendered by the wallet itself. Loader1.1.1+also keeps watching for widgets/iframes inserted after page load and re-checks the parent page’s wallets while the connect dialog is open, which helps mobile in-app browsers whose providers inject late.
Requirements
- HTTPS only — clipboard, Web Share, and secure cookies need a secure context on both pages.
- One widget per container. Mounting is idempotent per element.
- The
/embed/*page sets noX-Frame-Options, so it embeds from any origin. - The loader script is edge-cached for 5 minutes; frame content is always fresh.
