Skip to content
Intents Checkout

Embedded widget

<PayButton> and <CheckoutEmbed> from @intents-fi/react, and the checkout.js loader for every other site.

import { PayButton } from "@intents-fi/react";
<PayButton
invoiceId={invoice.id}
clientSecret={invoice.clientSecret}
onPaid={() => router.push("/thanks")}
appearance={{ variables: { colorAccent: "#3D5A80", borderRadius: 12 } }}
/>

The same screens as the hosted page, rendered in your app: a modal sheet from <PayButton>, or inline from <CheckoutEmbed>. Create the invoice on your server (the quickstart shows how) and hand the browser only its id and clientSecret. The clientSecret is good for that one invoice, and the widget sends it in the x-client-secret header, never in a URL. Your secret key never leaves the server.

Terminal window
npm install @intents-fi/react
import { CheckoutEmbed } from "@intents-fi/react";
<CheckoutEmbed invoiceId={invoice.id} clientSecret={invoice.clientSecret} onPaid={showThanks} />

<CheckoutEmbed> takes these. <PayButton> takes the same (except onReturn, which closes its sheet) plus the four in the second table.

Prop What it does
invoiceId the invoice’s id, from your server’s POST /v0/invoices
clientSecret the invoice’s clientSecret, from the same response
appearance colours, font, corners and per-element rules; see Appearance
apiBase where the widget calls the API. Defaults to https://api.intents.fi
payer the customer’s address, if you already know it: the ways to pay are then ranked by what that address holds
onPaid(invoice) once, when the invoice is paid. For the page, not for fulfilment (below)
onEvent(event) { type: "status", status, screen } as the payment moves, and { type: "paid", checkout } once
onReturn() the Return to {merchant} button on the paid screen. Without it, the button follows the invoice’s successUrl
<PayButton> only What it does
children the button’s label. "Pay" by default: the price itself leads inside the sheet
className your own class for the button. Without one it is the checkout’s own primary button
disabled disables the button
onClose() when the sheet closes, paid or not

The sheet closes on its Close button, on Escape and on the backdrop, and puts focus back on the button. Closing it does not cancel the invoice: a payment already sent still completes, and the webhook still fires.

onPaid fires once, when the invoice is paid, so the page can say thank you. Fulfil the order from the invoice.paid webhook only: a callback in a browser can be faked, a signed webhook cannot.

The API accepts browser calls to /v0/checkout/* and /v0/links/* from any origin (CORS Access-Control-Allow-Origin: *, request headers content-type, x-client-secret and authorization, no cookies or credentials), so the default apiBase of https://api.intents.fi works from any page.

If you would rather the browser only ever talked to your own origin, run a small proxy that forwards /v0/checkout/* unchanged and point apiBase at it. The Next.js example in packages/react/examples/next does this in app/api/checkout/[...path]/route.ts, with apiBase="/api/checkout". It is optional.

When the customer connects a wallet, the widget reads what that wallet holds and preselects the cheapest way to pay that the balance covers: a customer holding USDT on Tron gets USDT on Tron first, even if another network is a few cents cheaper. Pass payer when your page already knows the customer’s address (they signed in with a wallet, say), and the list is ranked that way from the start. A wallet the customer connects later takes over from it. Headless checkout describes the same ranking on the API.

appearance is modelled on Stripe’s Appearance API: variables for the theme, rules for per-element overrides keyed by stable .ifc-* class names.

<CheckoutEmbed
invoiceId={invoice.id}
clientSecret={invoice.clientSecret}
appearance={{
variables: {
colorAccent: "#3D5A80",
colorBackground: "#FFFFFF",
colorText: "#1B1B1B",
fontFamily: "Source Serif 4",
borderRadius: 8,
spacingUnit: 4,
},
rules: {
".ifc-Button": { textTransform: "uppercase", borderRadius: "999px" },
".ifc-Option": { borderWidth: "2px" },
},
}}
/>

Every value is checked before it is used. A colour pair under 4.5:1 contrast, a font that is not on the supported list, or a rule that would hide, move or shrink something is dropped with a console warning that names it, and the rest still applies. The checkout is light only, so set light colours. Appearance lists every variable, the allowed properties and the class names.

At every level of customisation the customer always sees the exact amount, the network warning (“Send USDT on TRON only.”), the deposit address with its QR code, the expiry countdown, the refund address field, and the Powered by intents.fi line. rules can restyle them; nothing removes them. A headless integration renders the safety elements itself; see Headless checkout.

The widget connects browser wallets for EVM chains (MetaMask, Coinbase Wallet, Rabby and any other extension or in-app browser wallet), Solana and Tron, plus Bitcoin (Xverse, Unisat, Leather), NEAR and TON. A wallet’s code loads only when the customer picks a network it serves. A customer with no browser wallet pays from any wallet or exchange instead: a deposit address, the exact amount and a QR code. Nothing to configure; to use your own Solana RPC:

import { configureWallets } from "@intents-fi/react";
configureWallets({ solanaRpcUrl: "https://…" });

WalletConnect is not offered yet. walletConnectProjectId is accepted, so a setup that passes one keeps working, but it has no effect for now.

For a site without React, or a store plugin, load the loader from https://pay.intents.fi/v1/checkout.js. It opens the hosted page in an iframe, as a modal over your page or inline in an element of yours:

<script src="https://pay.intents.fi/v1/checkout.js"></script>
<script>
document.querySelector("#pay").addEventListener("click", () => {
IntentsCheckout.open({
invoiceId: "inv_3QkR7mVt9zLpXdB2hJn6Yw",
clientSecret: "inv_3QkR7mVt9zLpXdB2hJn6Yw_secret_8vCqA1sEuK4dPzN0rTbWyM",
appearance: { variables: { colorAccent: "#3D5A80" } },
onPaid: ({ invoiceId }) => showThanks(invoiceId),
onClose: () => enableButton(),
});
});
</script>
Option What it does
invoiceId required: an inv_… ID
clientSecret the invoice’s client secret; needed to start a payment from the frame
appearance the same object <CheckoutEmbed> takes
container an element or a selector: mount inline there instead of in a modal
origin the checkout’s origin. Defaults to the origin the script was loaded from
onPaid({ invoiceId }) once, when the invoice is paid. Fulfil from the webhook
onClose() the customer closed it, pressed Escape, or finished
onResize({ height }) the frame’s content height changed. The frame is resized for you

open() returns { close, iframe }.

The page and the frame talk over postMessage, and every message carries source: "intents-checkout":

Direction type Payload
frame → page ready none
page → frame init clientSecret?, appearance?
frame → page resize height (CSS px)
frame → page paid invoiceId
frame → page closed none

The client secret and the appearance go to the frame only after it says ready, addressed to the checkout’s origin, never in the frame’s URL. The loader listens only to its own frame, from that origin. Wallet extensions work inside the iframe, and your page never runs wallet code.

Create the invoice with an ik_test_ key. A test invoice has no address to send to and nothing to sign, so the widget, like the hosted page, says “This is a test payment. No money moves and there is no address to send to.” and shows a Complete the test payment button (when paying with a wallet, the wallet’s pay button does the same, with nothing to sign). Pressing it walks the invoice to paid, fires onPaid, and sends the real invoice.paid webhook. The MCP server’s send_test_webhook does the same from your terminal.

If your checkout already lists Card and PayPal, put the Pay with crypto option beside them and open this widget when the order is placed with it selected. The whole flow, server included, is in Add crypto to your existing checkout. Whatever onPaid does on the page, ship the order on the verified invoice.paid webhook only (Verify and test webhooks).