HostDeFi › Features › Buy Button
A buy button for your site in one snippet
Blogs, dashboards, docs and token pages can put a working swap where the reader already is — the embed builder generates the snippet; you paste it; it works.
Every "how to buy" article ends the same way: go somewhere else and do it. The buy button removes the somewhere-else — a snippet that drops a working swap widget into your own page, so the reader who just finished your guide can act on it without leaving.
What the builder generates
Open the embed page (it's also reachable as /buy-button) and it reads the live chain config — the Solana pill is static and always first, so the builder still works even when the EVM config endpoint is down, and every other network pill comes from the same chain list the swap itself uses. Pick a chain, optionally paste a token address — base58 mint on Solana, 0x contract on EVM — optionally add a referral wallet, and the page writes the snippet. The preview underneath isn't a mockup: it mounts the real swap component inline, so what you see while building is byte-for-byte what your visitors get.
What the snippet actually is
An iframe pointed at one of two chrome-less shells — /embed/sol-swap for Solana, /embed/swap?chain=… for EVM — sized to fit (560px for the Solana card, 660px for EVM, 520px max width, rounded corners, clipboard-write allowed for the address copy button). The shells are the app's own pages early-returned without navigation, so everything inside the frame is same-origin: the RPC proxies, the quote endpoints and the fee path all work with no CORS dance and no key.
Pinning a token locks the buy side
Paste your token's address and the generated widget opens pre-loaded with it as the buy side — on Solana it's locked outright, so the button can't be flipped to a same-ticker impostor, which is the entire reason teams embed it. Leave the address empty and you get the general swap: title bar, live-quote badge, open pair picker. Two refinements sit in the URL: ?in= pins the pay side (a wSOL page would otherwise open SOL→SOL and quote nothing), and ?theme=light restyles the card so it blends into a white page instead of reading as a black box.
What your visitors get
The embedded widget runs the same engines as the app — Jupiter-routed swaps on Solana, KyberSwap-routed swaps on every EVM chain — inside your page's frame, with the visitor's own wallet, their signature, and their keys. Wallet Standard auto-detects Phantom, Solflare and Backpack on Solana; EVM wallets come through the usual detection. Your site never touches the funds; the button is a window into the swap, not a custody layer.
The referral layer
Add your wallet address in the builder and the snippet bakes it in: visitors who swap through your embed pay you half the 1% fee — up to 80% at volume, same tiers as the referrals program. On EVM chains the share pays straight to your wallet on-chain, inside the same transaction as the swap, with nothing to claim. On Solana the widget stamps the referral cookie on load and the split settles through the referrals ledger — with one honest caveat: some browsers won't replay a cross-site iframe's cookie, and when that happens the trade still works, it just doesn't credit. Monad is the exception on both sides — it pays no referral share at all.
What it costs, stated plainly
Free means free: no license, no signup, no limits, no embed surcharge — visitors pay the identical flat 1% the app charges, shown before they sign, and nothing is billed to the host. The one thing that costs money is white-label: themed or badge-free builds for your brand are a conversation, not a button.
The honest limit: an embed vouches by placement — if the button on your page points at a token, readers will read it as an endorsement. Grade what you embed: run it through the scanner, and if you want the check visible on the page itself, the safety badge embeds a grade shield instead of a swap.
Embedding a token button?
Scan the token first — if the contract fails the read, the button is the endorsement, not the widget.
Frequently asked
Do I need an API key or an account?
No — the builder generates a paste-ready snippet with no key, no signup and no server component on your side. The widget calls the same public swap backend the app uses.
Which chains can the button point at?
Whatever the live config enables — Solana plus the supported EVM chains (Ethereum, Base, BNB Chain, Arbitrum, Monad and the rest). The builder reads the list live, so a chain that drops off can't be embedded dead.
Can visitors switch away from the token I pinned?
On Solana, no — a pinned mint renders the bare swap card with the buy side locked to your contract address, so the button can't be flipped to a lookalike token. Leave the address empty and the widget opens as a general swap with its own title bar instead.
Can I earn from swaps through my embed?
Yes — add your wallet in the builder and the snippet carries it: on EVM chains half the 1% fee is paid to your wallet on-chain inside each swap, and on Solana the trade binds through the referrals program (some browsers block attribution cookies inside iframes — the swap still works, it just doesn't credit). Monad currently pays no referral share.
Does it work on a static site?
Yes — the snippet is self-contained markup; there's no build step, no npm package and no framework requirement. If your page can hold an iframe-shaped embed, it can hold the button.
What does it cost me or my visitors?
The embed is free to use — visitors pay the same flat 1% swap fee the app charges, shown before they sign. There's no embed surcharge and nothing billed to the host.