Skip to main content
The Hizz Buy Widget drops the buy/sell box onto any site. It renders in an isolated iframe served from 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 Cardano asset.
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 carries data-asset, the loader inserts a host element right after it and mounts. Nothing else required.

Integration methods

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.
window.HizzBuyWidget is created when the loader runs. If you load it with async or defer, its order relative to an inline mount() call is not guaranteed — use the blocking order above or attach mount() to the loader script’s load event.

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.
If you need VESPR or mobile in-app browser support, do not ship a standalone raw iframe. Use methods 1-3, or add the loader script below so it can adopt the iframe and bridge top-level wallets into the widget.
Already shipped a raw iframe? Just add the loader script tag anywhere on the same page — it adopts existing /embed/buy iframes automatically, enabling auto-resize and the wallet bridge with no markup changes:

Options

Pass options as kebab-case data-* 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 stable partner 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:
The callback reports one submitted market swap, not the partner’s historical cumulative total. Sum 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:
Always verify 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:
The loader listens for this and adjusts the matching iframe (floor 360px), so the box grows and shrinks as users switch between buy / sell / recover. If you embed a raw iframe (method 4) you can subscribe to the same message:

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:
  1. Direct injection — most extensions (Eternl, Lace, …) inject window.cardano into every frame, so the widget sees them natively.
  2. 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. Loader 1.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.
Hizz managed wallet & social login (email, Google, Telegram) rely on first-party hizz.io cookies and OAuth redirects, both blocked in cross-origin iframes and under third-party-cookie restrictions in Safari, Brave, and Chrome. Full account login is not available inside a cross-origin embed — the widget hides those options and offers wallet connect only. Link out to the token page on hizz.io for the full account experience.

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 no X-Frame-Options, so it embeds from any origin.
  • The loader script is edge-cached for 5 minutes; frame content is always fresh.

Troubleshooting