# intents.fi — the whole corpus Generated from https://intents.fi/docs. Every page, in one file. ================================================================================================ # Docs — https://intents.fi/docs/ ================================================================================================ intents.fi has two products. They share an account, API keys and webhooks, but they are separate integrations: pick the one you need and follow only its pages. | You want to… | Use | Start with | |---|---|---| | **Get paid.** A store, invoices, subscriptions, payment links: "accept crypto payments" | **Intents Checkout** | [Intents Checkout quickstart](/docs/checkout/quickstart) | | **Let your users swap or move funds across chains.** A wallet, a dApp, a swap or bridge UI | **Intents Route** | [Route quickstart](/docs/route/quickstart) | Three ways in: - [Quickstart](/docs/checkout/quickstart) (5 minutes): a test payment from your own server. - [Agent setup](/docs/agent-setup) (2 minutes): let Claude Code, Cursor or Codex do it. - [Payment links](/docs/checkout/payment-links) (no code): sell from the dashboard. ## Build it with your AI agent The fastest way in is to let your coding agent (Claude Code, Cursor, Codex or any agent that reads markdown) do the integration. Open your app's root in the agent and paste one line: - **Intents Checkout:** `Read https://intents.fi/docs/agent-setup/checkout.md and follow it.` - **Route:** `Read https://intents.fi/docs/agent-setup/route.md and follow it.` The agent installs the MCP server, the skills and the SDK, writes the integration, and proves it works. Intents Checkout runs entirely on test keys, so no money moves. More on the [agent setup page](/docs/agent-setup). ## Intents Checkout Price in USD and get paid. Your customer pays with whatever they hold, on whatever chain they hold it; you receive a USD stablecoin or native Bitcoin at your own address. Hosted page, embedded widget, headless, payment links, and plugins for WooCommerce, WHMCS, Magento, PrestaShop and OpenCart. [Intents Checkout overview](/docs/checkout). ## Intents Route One API over every intent protocol. Request a quote and every protocol answers, ranked; turn the best one into an execution plan your user's wallet signs; track the order to completion with one status model. [Route overview](/docs/route). ## The part that matters **The one rule:** ship an order only when you receive the signed `invoice.paid` webhook. The browser's `onPaid` is for your UI. Funds never touch an intents.fi wallet. A payment goes from the customer to the protocol that moves it, and from there to **your** address. We cannot hold your money, freeze it or lose it, because we never have it. ## Shared by both - [Account and API keys](/docs/get-started) — sign up, the four keys, test versus live - [Webhooks](/docs/platform/webhooks) — the events, the signature, and what a receiver has to tolerate - [API reference](/docs/api) — every endpoint, with samples generated from OpenAPI - [Error codes](/docs/errors/) — one page per code ## For machines Every page is also plain markdown: add `.md` to any URL. `/llms.txt` is the index (it opens with which product to use), `/checkout/llms.txt` and `/route/llms.txt` are one product each, and `/llms-full.txt` is the whole corpus. The OpenAPI document is at `/openapi.json`, and the universal setup prompt at `/agent-setup/prompt.md`. ## Support Email [support@intents.fi](mailto:support@intents.fi). That is the only channel — no chat widget, no WhatsApp, no Telegram DMs asking for your keys. ================================================================================================ # Set up Intents Checkout with your AI agent — https://intents.fi/docs/agent-setup/checkout ================================================================================================ # Set up Intents Checkout in this project You are a coding agent adding **Intents Checkout** to this project so it can get paid in crypto. The merchant prices in USD, the customer pays in whatever token they hold on whatever chain, and the merchant receives one settlement asset (a USD stablecoin, or native Bitcoin) at their own address. Intents is non-custodial: it never holds the money. Invoices are always priced in USD: match orders on the invoice's `amount` and `currency`, never on `settlement.*`, which is in the settlement asset's base units (sats for BTC). This prompt is only about Intents Checkout. Do not call `/v0/quotes` or `/v0/orders` and do not read the Intents Route pages: Intents Checkout finds the route for every payment itself. (If the human actually wants their users to swap or bridge their own funds, stop and follow `https://intents.fi/docs/agent-setup/route.md` instead.) If the project is a WooCommerce, WHMCS, Magento, PrestaShop or OpenCart store, there is nothing to code: tell the human to install the plugin from `https://intents.fi/docs/checkout/index.md` and stop. Follow the steps in order. Stop and ask the human only where a step says **ASK**. ## Rules for the whole session - **Test keys only.** Use an `ik_test_` secret key. If the human gives you an `ik_live_` key, do not use it: say so and ask for the test key instead. Test mode routes in process, so no money moves. - The secret key lives in `.env.local` (check it is in `.gitignore`) and in server code only. It is never imported by a client component, printed, logged or committed. - Do not invent API fields. When unsure, read the docs: the `docs_search` and `docs_get_page` MCP tools, or `https://intents.fi/docs/checkout/llms.txt` (the Intents Checkout pages; every page is markdown at its URL plus `.md`). - Amounts on the wire are integer strings in base units; prices are decimal strings like `"25.00"`. Do maths in `BigInt`, never floats. - Only the webhook marks an order paid. A browser returning from checkout, or the widget's `onPaid`, is not proof of payment. ## Step 1: install the MCP server and the skills Install the intents.fi MCP server (`@intents-fi/mcp`, run with `npx -y @intents-fi/mcp`) with `INTENTS_API_KEY` set to the test key and `INTENTS_TOOLSETS=docs,checkout`, and the three Intents Checkout skills from `https://github.com/intents-fi/skills` (`integrate-checkout`, `verify-webhooks`, `go-live-checklist`). How depends on the agent you are: - **Claude Code:** `claude mcp add intents-fi -e INTENTS_API_KEY=ik_test_… -e INTENTS_TOOLSETS=docs,checkout -- npx -y @intents-fi/mcp`, then clone `https://github.com/intents-fi/skills` to a temporary directory and copy those three skill folders into `.claude/skills/` (each skill must sit directly under it, as `.claude/skills//SKILL.md`). - **Cursor:** add the server to `.cursor/mcp.json`; see `https://intents.fi/docs/agent-setup/cursor.md`. - **Codex:** add the server to `~/.codex/config.toml`; see `https://intents.fi/docs/agent-setup/codex.md`. **ASK** the human for their `ik_test_` secret key (dashboard.intents.fi → Developers → API keys) if it is not already in the environment. If the agent cannot load MCP servers, carry on without them: everything below also works from the docs alone. ## Step 2: install the SDK Install `@intents-fi/sdk` (the API client and webhook verification) and `@intents-fi/react` (the `PayButton` widget) with the project's package manager: ```bash npm install @intents-fi/sdk @intents-fi/react ``` ## Step 3: a test-mode checkout These files assume a Next.js App Router project. For another framework, keep the same three pieces — an invoice route, a verified webhook handler, a pay button — and adapt the wiring. Write them **as they are**; they use relative imports so no path alias is needed. `.env.local` (append; never commit it): ```bash # Test keys only while you build. dashboard.intents.fi → Developers → API keys. INTENTS_SECRET_KEY=ik_test_replace_me # Returned once, when you register the webhook endpoint (POST /v0/webhooks). INTENTS_WEBHOOK_SECRET=whsec_replace_me # Optional: only if the embedded widget should offer WalletConnect (Reown) wallets. NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID= ``` `lib/intents.ts`, the server-side client: ```ts import { createClient } from "@intents-fi/sdk"; /** * The intents.fi client, server-side only. INTENTS_SECRET_KEY is an `ik_test_` key while you * build; it must never reach the browser, so this file is only imported from route handlers. */ export function intents() { const apiKey = process.env.INTENTS_SECRET_KEY; if (!apiKey) throw new Error("Set INTENTS_SECRET_KEY (an ik_test_ key) in .env.local"); return createClient({ apiKey, ...(process.env.INTENTS_API_URL && { baseUrl: process.env.INTENTS_API_URL }), }); } ``` `lib/orders.ts`, a stand-in order store (tell the human to swap it for their database): ```ts /** * Your order store. Replace this Map with your database: the webhook handler marks an order paid * here, keyed by the `reference` you created the invoice with. * * `markPaid` is idempotent on purpose. Webhooks are retried and may arrive twice or out of order, * so a second `invoice.paid` for the same invoice must change nothing. */ export type OrderState = { invoiceId: string; status: "pending" | "paid"; late: boolean }; export const orders = new Map(); export function markPaid(reference: string, invoiceId: string, late: boolean): boolean { const existing = orders.get(reference); if (existing?.status === "paid") return false; orders.set(reference, { invoiceId, status: "paid", late }); return true; } ``` `app/api/checkout/route.ts`, which creates the invoice server-side: ```ts import { intents } from "../../../lib/intents"; /** * POST /api/checkout — create an invoice for a cart, server-side. * * The price comes from your own catalogue, never from the request body: a customer can send any * body they like. `reference` is your order ID and the API's idempotency key, so a retried request * returns the same invoice instead of a second one. */ const CATALOGUE: Record = { "starter-plan": { name: "Starter plan", price: "25.00" }, }; export async function POST(request: Request) { const { sku, orderId } = (await request.json()) as { sku?: string; orderId?: string }; const item = sku ? CATALOGUE[sku] : undefined; if (!item) return Response.json({ error: "unknown sku" }, { status: 400 }); const invoice = await intents().checkout.invoices.create({ amount: item.price, currency: "USD", reference: orderId ?? `order_${crypto.randomUUID()}`, description: item.name, }); // `clientSecret` is for this one invoice and is meant for the browser; the secret key is not. return Response.json({ invoiceId: invoice.id, clientSecret: invoice.clientSecret, url: invoice.url, amount: invoice.amount, }); } ``` `app/api/webhooks/intents/route.ts`, which verifies the signature and marks the order paid: ```ts import { verifyAndParse } from "@intents-fi/sdk"; import { markPaid } from "../../../../lib/orders"; /** * POST /api/webhooks/intents — the only thing that marks an order paid. * * Read the body as text: the signature covers the raw bytes, and parsed-then-reserialised JSON is * not the same bytes. `verifyAndParse` returns null for a bad or stale signature, and the body is * never trusted before that check. */ export async function POST(request: Request) { const secret = process.env.INTENTS_WEBHOOK_SECRET; if (!secret) return new Response("INTENTS_WEBHOOK_SECRET is not set", { status: 500 }); const body = await request.text(); const event = await verifyAndParse(body, request.headers.get("x-intents-signature"), secret); if (!event) return new Response("bad signature", { status: 400 }); // `data.status` is the truth; `type` is only why you were woken. Duplicates are normal. if (event.type === "invoice.paid" && event.data.status === "paid" && event.data.reference) { markPaid(event.data.reference, event.data.id, event.late === true); } return new Response(null, { status: 204 }); } ``` `app/checkout/page.tsx`, the page with the `PayButton`: ```tsx "use client"; import { PayButton } from "@intents-fi/react"; import { useState } from "react"; /** * /checkout — one product, one button. The invoice is created server-side by /api/checkout; * the browser only ever sees the invoice's own `clientSecret`. * * `onPaid` updates the page, and that is all it does. It is not proof of payment: the webhook * handler is what marks the order paid. */ type Created = { invoiceId: string; clientSecret: string; url: string; amount: string }; export default function CheckoutPage() { const [invoice, setInvoice] = useState(null); const [paid, setPaid] = useState(false); const [error, setError] = useState(null); async function start() { setError(null); const res = await fetch("/api/checkout", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ sku: "starter-plan" }), }); if (!res.ok) return setError("Could not start the payment. Try again."); setInvoice((await res.json()) as Created); } if (paid) { return (

Thank you

Your payment was received.

); } return (

Starter plan

$25.00

{invoice ? ( <> setPaid(true)} />

Or pay on the secure payment page.

) : ( )} {error &&

{error}

}
); } ``` ### The webhook secret The API only delivers to public `https` endpoints, so a handler on `localhost` never hears from it directly. For local development, set `INTENTS_WEBHOOK_SECRET` to the same `whsec_` value in `.env.local` **and** in the MCP server's environment: `send_test_webhook` signs with it. Once the app is deployed, register the real endpoint (`POST /v0/webhooks` with the test key, events `invoice.paid`, `invoice.expired`, `invoice.needs_review`) and use the `secret` it returns, once, in both places. ## Step 4: check it works 1. Run the dev server and open `/checkout`. The page shows the price and a **Pay $25.00** button. Pressing it creates a test invoice and shows a **Pay** button, which opens the payment sheet; for a test invoice the sheet says "This is a test payment. No money moves…" and offers **Complete the test payment**. 2. Use the MCP tools: `get_invoice` with the invoice ID shows `"mode": "test"` and `"status": "open"`. 3. Call `send_test_webhook` with the invoice ID and `url` set to `http://localhost:3000/api/webhooks/intents` (use the real port). It pays the test invoice and POSTs the signed `invoice.paid` to the handler. Expect `"status": "paid"` and `"direct": { "status": 204 }`, and the order marked paid in `lib/orders.ts`. 4. Send the handler a body with a wrong signature and check it answers `400`. If a step fails, read the error code's page at `https://intents.fi/docs/errors/.md` and fix the cause rather than working around it. ## Step 5: tell the human Summarise what you created and that it runs in test mode, and point them at the `go-live-checklist` skill (or `https://intents.fi/docs/checkout/index.md`, "Going live") for the switch to live keys: register a live endpoint, check the settlement address in the dashboard, pay themselves $5 for real. ================================================================================================ # Claude Code — https://intents.fi/docs/agent-setup/claude-code ================================================================================================ ```bash # 1. The MCP server, scoped to this project, with a test key claude mcp add intents-fi --scope project \ -e INTENTS_API_KEY=ik_test_… \ -e INTENTS_WEBHOOK_SECRET=whsec_… \ -- npx -y @intents-fi/mcp # 2. The skills, where Claude Code looks for project skills git clone --depth 1 https://github.com/intents-fi/skills /tmp/intents-fi-skills mkdir -p .claude/skills && cp -R /tmp/intents-fi-skills/{integrate-checkout,verify-webhooks,go-live-checklist,integrate-intents-route} .claude/skills/ ``` Then start `claude` in the app's root and paste the line for your product: - Intents Checkout (get paid): `Read https://intents.fi/docs/agent-setup/checkout.md and follow it.` - Intents Route (cross-chain swaps): `Read https://intents.fi/docs/agent-setup/route.md and follow it.` The prompt installs anything below that is missing, so this page is only for setting things up by hand. An Intents Checkout-only setup needs only the `integrate-checkout`, `verify-webhooks` and `go-live-checklist` skills; a Route-only one needs only `integrate-intents-route`. Set `INTENTS_TOOLSETS` to `docs,checkout` or `docs,routing` to load one product's tools. Claude Code picks the skills up from `.claude/skills/` and lists the server under `/mcp`. ## Check the server is connected Run `/mcp` inside Claude Code. `intents-fi` should be listed as connected with these tools: `docs_search`, `docs_get_page`, `create_invoice`, `get_invoice`, `send_test_webhook`, `compare_quotes`, `get_status`, `list_routes` and `get_route_status`. If it shows as failed, run the server by hand to see why: ```bash INTENTS_API_KEY=ik_test_… npx -y @intents-fi/mcp ``` It prints one line to stderr — the toolsets, the API it talks to and the *kind* of key, never the key itself — and then waits for a client on stdin. ## Keys - `--scope project` writes `.mcp.json` in the repository. The `-e` values land in it, so either keep that file out of git or use `--scope local` instead, which keeps them on your machine. - Use the test key. The Intents Checkout tools refuse a live one, and a live key has no business in an agent's configuration. - `INTENTS_WEBHOOK_SECRET` is only needed for `send_test_webhook`'s direct delivery to a local handler. It must match the value in the app's `.env.local`. ================================================================================================ # Codex — https://intents.fi/docs/agent-setup/codex ================================================================================================ `~/.codex/config.toml`: ```toml [mcp_servers.intents-fi] command = "npx" args = ["-y", "@intents-fi/mcp"] [mcp_servers.intents-fi.env] INTENTS_API_KEY = "ik_test_…" INTENTS_WEBHOOK_SECRET = "whsec_…" ``` The skills: ```bash git clone --depth 1 https://github.com/intents-fi/skills /tmp/intents-fi-skills mkdir -p ~/.codex/skills && cp -R /tmp/intents-fi-skills/{integrate-checkout,verify-webhooks,go-live-checklist,integrate-intents-route} ~/.codex/skills/ ``` If your Codex version does not load skills from there, add one line to the project's `AGENTS.md` instead: "For intents.fi work, read the matching `SKILL.md` in `~/.codex/skills/` first (`integrate-checkout`, `verify-webhooks`, `go-live-checklist`, `integrate-intents-route`)." Then run `codex` in the app's root and paste the line for your product: - Intents Checkout (get paid): `Read https://intents.fi/docs/agent-setup/checkout.md and follow it.` - Intents Route (cross-chain swaps): `Read https://intents.fi/docs/agent-setup/route.md and follow it.` The prompt installs anything below that is missing, so this page is only for setting things up by hand. An Intents Checkout-only setup needs only the `integrate-checkout`, `verify-webhooks` and `go-live-checklist` skills; a Route-only one needs only `integrate-intents-route`. Set `INTENTS_TOOLSETS` to `docs,checkout` or `docs,routing` to load one product's tools. ## Check the server is connected `codex mcp list` shows `intents-fi`. To see why it fails to start, run it by hand: `INTENTS_API_KEY=ik_test_… npx -y @intents-fi/mcp`. ## Keys The config file holds the key in plain text in your home directory. Use the test key only: the Intents Checkout tools refuse a live one. ================================================================================================ # Cursor — https://intents.fi/docs/agent-setup/cursor ================================================================================================ `.cursor/mcp.json` in the project (or `~/.cursor/mcp.json` for every project): ```json { "mcpServers": { "intents-fi": { "command": "npx", "args": ["-y", "@intents-fi/mcp"], "env": { "INTENTS_API_KEY": "ik_test_…", "INTENTS_WEBHOOK_SECRET": "whsec_…" } } } } ``` The skills: ```bash git clone --depth 1 https://github.com/intents-fi/skills /tmp/intents-fi-skills mkdir -p .cursor/skills && cp -R /tmp/intents-fi-skills/{integrate-checkout,verify-webhooks,go-live-checklist,integrate-intents-route} .cursor/skills/ ``` Each skill is a plain `SKILL.md` that points at the docs, so if your Cursor version does not load skills from that folder, reference the file in chat (`@.cursor/skills/verify-webhooks/SKILL.md`) or copy its body into a project rule under `.cursor/rules/`. Then open the agent in the app's root and paste the line for your product: - Intents Checkout (get paid): `Read https://intents.fi/docs/agent-setup/checkout.md and follow it.` - Intents Route (cross-chain swaps): `Read https://intents.fi/docs/agent-setup/route.md and follow it.` The prompt installs anything below that is missing, so this page is only for setting things up by hand. An Intents Checkout-only setup needs only the `integrate-checkout`, `verify-webhooks` and `go-live-checklist` skills; a Route-only one needs only `integrate-intents-route`. Set `INTENTS_TOOLSETS` to `docs,checkout` or `docs,routing` to load one product's tools. ## Check the server is connected Cursor Settings → MCP lists `intents-fi` with its tools. A red dot means it failed to start: run `INTENTS_API_KEY=ik_test_… npx -y @intents-fi/mcp` in a terminal to see the error. ## Keys `.cursor/mcp.json` holds the key in plain text. Keep it out of git, and use the test key only: the Intents Checkout tools refuse a live one. ================================================================================================ # Build with your AI agent — https://intents.fi/docs/agent-setup/ ================================================================================================ The quickest way to integrate either product is to let your coding agent do it. Open your app's root in Claude Code, Cursor, Codex or any agent that can read a URL, and paste the line for the product you want. ## Intents Checkout — get paid ```text Read https://intents.fi/docs/agent-setup/checkout.md and follow it. ``` The agent installs the MCP server, the Intents Checkout skills and the SDK, adds an invoice route, a verified webhook handler and a pay button, and proves it with a test payment. **Test keys only**: nothing it does can move money. [Read the Intents Checkout prompt](/docs/agent-setup/checkout). ## Intents Route — let your users swap across chains ```text Read https://intents.fi/docs/agent-setup/route.md and follow it. ``` The agent installs the MCP server, the Route skill and the SDK, adds a key-safe API proxy, a quote list and wallet execution, and checks it against real quotes. It never signs anything: the first real swap is yours, from your own wallet. [Read the Route prompt](/docs/agent-setup/route). Not sure which you need? The [universal prompt](/docs/agent-setup/prompt) has the agent decide from your codebase. ## What the agent needs from you - **A secret key.** Sign up at [dashboard.intents.fi](https://dashboard.intents.fi/signup) and copy a key from Developers → API keys. For Intents Checkout use the `ik_test_` key; the agent refuses a live one. - **Nothing else.** The prompt installs the [MCP server](/docs/agents/mcp) and the [skills](/docs/agents/skills) itself. To install them by hand first, see [Claude Code](/docs/agent-setup/claude-code), [Cursor](/docs/agent-setup/cursor) or [Codex](/docs/agent-setup/codex). ## What it will and will not do - It never puts the secret key in client code, a log or a commit. - It never signs a transaction or asks for a private key or seed phrase. - Going live — live keys, a live webhook endpoint, a real $5 payment or a first real swap — is yours to do. For Intents Checkout, the `go-live-checklist` skill is the list. ## For agents that can't fetch a URL Open the prompt page, press **Copy the full prompt**, and paste the whole thing instead of the one line. Everything the prompts link to is also listed in [`/llms.txt`](/docs/llms.txt). ================================================================================================ # Universal setup prompt — https://intents.fi/docs/agent-setup/prompt ================================================================================================ # Set up intents.fi in this project You are a coding agent adding intents.fi to this project. intents.fi has **two separate products**. Your first job is to pick exactly one, then follow only that product's prompt. | Product | For a project that… | Prompt to follow | |---|---|---| | **Intents Checkout** | wants to **get paid**: sells products, plans or services; has a cart, orders, invoices or subscriptions; the human said "accept crypto", "payments", "checkout" | `https://intents.fi/docs/agent-setup/checkout.md` | | **Intents Route** | moves **its users' own funds**: a wallet, a dApp, a swap or bridge screen; the human said "swap", "bridge", "cross-chain", "quotes" | `https://intents.fi/docs/agent-setup/route.md` | ## How to decide 1. If the human's message names the product or the goal, use that. 2. Otherwise look at the project: a store, pricing page, cart or order model points to Intents Checkout; a wallet connection (wagmi, viem, `@solana/wallet-adapter`) with token balances or a swap screen points to Route. 3. If it is still unclear, **ASK** exactly this, and nothing else: "Do you want to get paid in crypto (Intents Checkout), or let your users swap and move their funds across chains (Intents Route)?" Then fetch the chosen prompt and follow it from its first step. Do not mix the two: Intents Checkout never calls `/v0/quotes` or `/v0/orders`, and Route never creates invoices. If the human wants both, finish Intents Checkout first, then run the Route prompt as a separate task. ================================================================================================ # Set up Route with your AI agent — https://intents.fi/docs/agent-setup/route ================================================================================================ # Set up Intents Route in this project You are a coding agent adding **Intents Route** to this project so its users can swap and move their own funds across tokens and chains. Route quotes every intent protocol in one request, ranks the answers, and turns the chosen quote into an execution plan that **the user's own wallet** signs; intents.fi then tracks the order to completion. It never holds funds or keys. This prompt is only about Route. Do not create invoices and do not read the Intents Checkout pages. (If the human actually wants to get paid, stop and follow `https://intents.fi/docs/agent-setup/checkout.md` instead.) Follow the steps in order. Stop and ask the human only where a step says **ASK**. ## Rules for the whole session - **Never sign or send a transaction, and never ask for a private key or seed phrase.** The user's wallet does every signing step, in the browser, after the user approves it. - **Route has no test mode.** Quotes and orders are real with any key. You may request quotes as often as you like; you never execute a swap yourself. The human does the first real swap, with a small amount. - The secret key lives in `.env.local` (check it is in `.gitignore`) and in server code only. The browser talks to the project's own proxy, which adds the key. The key is never imported by a client component, printed, logged or committed. - Amounts are integer strings in base units. Do maths in `BigInt`, never floats, and format with the asset's `decimals` only for display. - Show the user `output.amountMin` (the least they will receive) before they sign, not only `amountExpected`. - Do not invent API fields. When unsure, read the docs: the `docs_search` and `docs_get_page` MCP tools, or `https://intents.fi/docs/route/llms.txt` (the Route pages; every page is markdown at its URL plus `.md`). ## Step 1: install the MCP server and the skill Install the intents.fi MCP server (`@intents-fi/mcp`, run with `npx -y @intents-fi/mcp`) with `INTENTS_API_KEY` set to the key and `INTENTS_TOOLSETS=docs,routing`, and the `integrate-intents-route` skill from `https://github.com/intents-fi/skills`. The routing tools are read-only: `compare_quotes`, `get_status`, `list_routes`, `get_route_status`. How depends on the agent you are: - **Claude Code:** `claude mcp add intents-fi -e INTENTS_API_KEY=ik_… -e INTENTS_TOOLSETS=docs,routing -- npx -y @intents-fi/mcp`, then clone `https://github.com/intents-fi/skills` to a temporary directory and copy its `integrate-intents-route` folder into `.claude/skills/` (as `.claude/skills/integrate-intents-route/SKILL.md`). - **Cursor:** add the server to `.cursor/mcp.json`; see `https://intents.fi/docs/agent-setup/cursor.md`. - **Codex:** add the server to `~/.codex/config.toml`; see `https://intents.fi/docs/agent-setup/codex.md`. **ASK** the human for a secret key (dashboard.intents.fi → Developers → API keys) if one is not already in the environment. An `ik_test_` key is fine: Route quotes are real either way. If the agent cannot load MCP servers, carry on without them: everything below also works from the docs. ## Step 2: install the SDK Look at how the project connects wallets (wagmi / viem for EVM, `@solana/wallet-adapter` for Solana). Install `@intents-fi/sdk` and the matching peer: `viem` for EVM, `@solana/web3.js` for Solana, both if the project has both. ```bash npm install @intents-fi/sdk viem ``` If the project has no wallet connection at all, **ASK** the human which wallets to support before adding one. ## Step 3: the key-safe proxy These files assume a Next.js App Router project. For another framework, keep the same piece — a server route that forwards the five Route endpoints and adds the key — and adapt the wiring. `.env.local` (append; never commit it): ```bash INTENTS_API_KEY=ik_… ``` `app/api/intents/[...path]/route.ts`: ```ts const ALLOWED = [/^v0\/quotes$/, /^v0\/orders$/, /^v0\/orders\/[\w-]+(\/submit)?$/, /^v0\/chains$/, /^v0\/assets$/]; async function proxy(req: Request, ctx: { params: Promise<{ path: string[] }> }) { const path = (await ctx.params).path.join("/"); if (!ALLOWED.some((re) => re.test(path))) { return Response.json({ error: { code: "NOT_FOUND", message: "Not proxied" } }, { status: 404 }); } const url = new URL(`https://api.intents.fi/${path}`); url.search = new URL(req.url).search; const res = await fetch(url, { method: req.method, headers: { "content-type": "application/json", authorization: `Bearer ${process.env.INTENTS_API_KEY}` }, ...(req.method !== "GET" && { body: await req.text() }), }); return new Response(res.body, { status: res.status, headers: { "content-type": "application/json" } }); } export const GET = proxy; export const POST = proxy; ``` `lib/intents-client.ts`, the browser client (it holds no key): ```ts import { createClient } from "@intents-fi/sdk"; export const intents = createClient({ apiKey: "proxied", baseUrl: `${window.location.origin}/api/intents` }); ``` Only import it from client components. ## Step 4: quotes **ASK** the human where the swap should live (a new `/swap` page, or an existing screen) and which pairs matter most, unless that is already clear. Build the quote step with the project's own UI components: - Inputs: from asset, to asset and amount. Asset IDs are CAIP-19 or the `alias:address` shorthand (`arbitrum:0xaf88d065e77c8cc2239327c5edb3a432268e5831` is USDC on Arbitrum). List what is routable with `GET /v0/chains` and `GET /v0/assets?chain=&q=` through the proxy. - `sender` is the connected wallet's address on the source chain; `recipient` defaults to the same user's address on the destination chain. - Call `intents.quotes.create({ from, to, sender, recipient, executionModes: executionModesFor(wallets) })`. Show each quote's `provider`, `output.amountMin`, `fees.totalUsd` and `etaSeconds`, with `best` preselected. - On `NO_ROUTE`, show the reasons in `error.details.errors` rather than a bare failure. - Quotes expire (`expiresAt`, often under a minute): re-quote when the inputs change or the quote ages out. ## Step 5: execution When the user confirms, run the swap in their wallet: ```ts import { executionModesFor, swap } from "@intents-fi/sdk"; const order = await swap( intents, { from, to, sender, recipient, pick: (qs) => qs.find((q) => q.id === chosenId) }, wallets, // { evm: { walletClient } } and/or { solana: { publicKey, signAndSendTransaction, connection } } { onStep: (e) => showStep(e), // approve / swap / signature, with txHash onTransferRequired: (t) => showDepositAddress(t), // chains the wallet can't send on onUpdate: (o) => showStatus(o.status), }, ); ``` Show every state to the user: `awaiting_user`, `submitted`, `pending_deposit`, `processing`, then `completed` (with `output.amountActual`), `refunded`, `failed` (with `failReason`) or `expired`. On `QUOTE_DRIFT`, show the fresh quote from the error and let the user confirm again. ## Step 6: check it works 1. Use the MCP tool `compare_quotes` for a small real pair (for example 10 USDC from Arbitrum to Base) and check several protocols answer. 2. Run the dev server and request the same quote through the app's proxy: `curl -X POST localhost:3000/api/intents/v0/quotes -H 'content-type: application/json' -d '…'`. Expect `200` with `quotes` and `best`. A path outside the five endpoints must answer `404`. 3. Build the app and confirm the key is not in the client bundle (`grep -r "ik_" .next/static` finds nothing). 4. Open the swap screen, connect a wallet and check the quotes render with `amountMin`. **Do not execute.** If a step fails, read the error code on `https://intents.fi/docs/route/index.md` ("Errors you will meet") and fix the cause rather than working around it. ## Step 7: tell the human Summarise what you created. Tell them Route has no test mode, so the first real swap is theirs to make, with a small amount, from their own wallet; and that `https://intents.fi/docs/status` shows live success rates per protocol. ================================================================================================ # MCP server — https://intents.fi/docs/agents/mcp ================================================================================================ ```bash INTENTS_API_KEY=ik_test_… npx -y @intents-fi/mcp ``` One stdio server with a toolset per product: `checkout` for Intents Checkout, `routing` for Intents Route, and `docs` for both. Load only the product you are building with `INTENTS_TOOLSETS` (`docs,checkout` or `docs,routing`); the [setup prompts](/docs/agent-setup) do this for you. Install it in your agent with the [Claude Code](/docs/agent-setup/claude-code), [Cursor](/docs/agent-setup/cursor) or [Codex](/docs/agent-setup/codex) page. ## Tools | Toolset | Tool | What it does | |---|---|---| | docs | `docs_search` | Search every page; returns titles, URLs, the `.md` URL and a snippet | | docs | `docs_get_page` | One page as markdown, by path (`/checkout/quickstart`) or URL | | checkout | `create_invoice` | A **test** invoice: id, hosted `url`, `clientSecret` | | checkout | `get_invoice` | Status, settlement and attempts of a test invoice | | checkout | `send_test_webhook` | Pays a test invoice end to end and fires `invoice.paid`; with `url`, also POSTs the signed event to a local handler | | routing | `compare_quotes` | Every protocol's quote for one swap, ranked, plus who could not quote and why | | routing | `get_status` | An order's lifecycle, the same states for every protocol | | routing | `list_routes` | Routable chains and the protocols on each, or the assets on one chain | | routing | `get_route_status` | The [route status](/docs/status): success per protocol, quotes vs NEAR Intents, failovers | The spec names the docs tools `docs.search` and `docs.get_page`. They are registered as `docs_search` and `docs_get_page`, because several clients only accept letters, digits, `_` and `-` in a tool name. ## Configuration | Variable | Default | Notes | |---|---|---| | `INTENTS_API_KEY` | — | An `ik_test_` secret key. The Intents Checkout tools refuse anything else | | `INTENTS_WEBHOOK_SECRET` | — | The `whsec_` that `send_test_webhook` signs a direct delivery with | | `INTENTS_TOOLSETS` | `docs,checkout,routing` | Load fewer toolsets | | `INTENTS_API_URL` | `https://api.intents.fi` | | | `INTENTS_DOCS_URL` | `https://intents.fi/docs` | | ## Safety - **Test mode only for Intents Checkout.** A test invoice is routed in process: its attempts carry no deposit address and no transaction, so nothing these tools do can move money. A live key is refused, and so is a live invoice. - **Read-only for Intents Route.** There is no execute tool. A route is executed by the user's own wallet from the plan `POST /v0/orders` returns; this server holds nothing that can sign. - **No secrets out.** The key and the webhook secret are removed from every tool result and error message, and the server's one log line names the kind of key (`ik_test_…`), never the key. - `docs_get_page` fetches from the docs host only; it is not a general web fetcher. ## Why `send_test_webhook` has a `url` The API delivers webhooks to public `https` endpoints only, and refuses private and loopback addresses, so a handler on `localhost` never hears from it. With `url`, the tool pays the invoice and then signs the paid invoice itself — the same envelope and the same `X-Intents-Signature` scheme as a real delivery — and POSTs it to your local handler. Without `url`, the API's own delivery reaches whatever endpoint you registered for the test key. ================================================================================================ # Skills — https://intents.fi/docs/agents/skills ================================================================================================ ```bash git clone --depth 1 https://github.com/intents-fi/skills /tmp/intents-fi-skills mkdir -p .claude/skills && cp -R /tmp/intents-fi-skills/{integrate-checkout,verify-webhooks,go-live-checklist,integrate-intents-route} .claude/skills/ ``` A skill is a `SKILL.md` with a name, a one-line description the agent matches tasks against, and a short body that points at the right `.md` pages instead of restating them, so it never drifts from the docs. | Skill | Product | Use it when | |---|---|---| | `integrate-checkout` | Intents Checkout | adding a checkout: invoice route, `` or the hosted page, the webhook | | `verify-webhooks` | Intents Checkout | writing or debugging a webhook receiver: raw body, signature, duplicates, ordering | | `go-live-checklist` | Intents Checkout | switching from test to live keys, including the customer-safety check for headless | | `integrate-intents-route` | Route | quoting and executing cross-chain swaps with Intents Route | Install only the ones for your product. The [setup prompts](/docs/agent-setup) install them for you. Where they go per agent: [Claude Code](/docs/agent-setup/claude-code) (`.claude/skills/`), [Cursor](/docs/agent-setup/cursor), [Codex](/docs/agent-setup/codex). The skills live in this repository under `skills/` and are published as `intents-fi/skills`. ================================================================================================ # API reference — https://intents.fi/docs/api ================================================================================================ Base URL `https://api.intents.fi`. The OpenAPI document is at [/openapi.json](/docs/openapi.json) — everything on this page, every sample on it and the TypeScript SDK are generated from that file, so it is the thing to trust. ## Authentication ```http authorization: Bearer ik_test_… ``` A **secret** key (`ik_`) reaches everything its account owns. A **publishable** key (`pk_`) is browser-safe and reaches almost nothing: it cannot read invoices or create a custom one. The prefix also decides the mode — `_test_` or `_live_` — and no key of either kind can change a settlement address ([why](/docs/get-started)). The public checkout endpoints are the exception. They take the invoice's client secret instead, because they run in a customer's browser: ```http x-client-secret: inv_3QkR7mVt9zLpXdB2hJn6Yw_secret_… ``` That secret reaches one invoice's public endpoints, nothing else, and expires with the invoice. The public view deliberately omits the merchant's settlement address and net amount. ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`. Each one has a page under [/errors](/docs/errors/). ## Amounts Prices (`amount`) are decimal strings in the invoice currency: `"49.00"`. Everything else — `amountExpected`, `amountNet`, `amountIn`, `fee.amount` — is an **integer string in the asset's base units**. Use `BigInt`, never a float. Assets are CAIP-19 IDs and chains are CAIP-2, so `eip155:8453/erc20:0x8335…` is USDC on Base. ## Not shipped yet An endpoint whose contract is published but whose implementation has not landed answers [`501 NOT_IMPLEMENTED`](/docs/errors/NOT_IMPLEMENTED). The shape in this reference is what it will return. ## Checkout: invoices, the merchant and payment links ### Create an invoice `POST /v0/invoices` Creates an invoice priced in USD. The customer may pay in any routable token on any routable chain; the merchant receives one settlement asset at its own address (§0). Settlement is in a USD stablecoin (USDC on base, USDC on arbitrum, USDC on ethereum, USDC on solana, USDC on polygon, USDT on tron, USDT on ethereum, USDT on arbitrum, USDT on bsc), 1:1 with `amount`, or in BTC. A BTC invoice's `amountExpected` is locked from live quotes when it is created (`priceLock`, §5.2); if no reliable price can be had the invoice is refused with `503 PRICE_UNAVAILABLE`. Re-sending a `reference` in the same mode returns `200` with the invoice that already exists, so a retried create never charges twice. References are scoped by mode: the same `reference` under a test key and a live key makes two separate invoices. | Parameter | In | Required | Notes | |---|---|---|---| | `x-intents-affiliate` | header | no | Store plugins: the Affiliate ID from the plugin settings. Links a merchant that nobody referred yet and that has no live payment (affiliate rules); never overwrites and never changes the fee. | | Field | Type | Required | Notes | |---|---|---|---| | `amount` | string | yes | Price in the invoice currency, e.g. "49.00" | | `currency` | `USD` | no | | | `settlement` | object | no | Choose between the merchant's registered settlement targets. API keys cannot introduce a new address (§8.3). | | `settlement.asset` | string | yes | | | `settlement.address` | string | yes | | | `reference` | string | no | The merchant's own ID. Unique per merchant and mode, and the idempotency key. | | `description` | string | no | | | `customerEmail` | string | no | | | `successUrl` | string | no | | | `cancelUrl` | string | no | | | `expiresInSec` | integer | no | | | `metadata` | object | no | | ```bash title="curl" curl https://api.intents.fi/v0/invoices \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'x-intents-affiliate: ' \ -H 'content-type: application/json' \ -d '{ "amount": "49.00", "settlement": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "address": "0x6A3fB91c7D8e45A2b0C1fE97D3a8B52c4e7F10dA" }, "reference": "order_1042", "description": "Pro plan — 1 month", "customerEmail": "ana@example.com", "successUrl": "https://northwood.example/thanks" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/invoices", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "amount": "49.00", "settlement": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "address": "0x6A3fB91c7D8e45A2b0C1fE97D3a8B52c4e7F10dA" }, "reference": "order_1042", "description": "Pro plan — 1 month", "customerEmail": "ana@example.com", "successUrl": "https://northwood.example/thanks" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/invoices", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "amount": "49.00", "settlement": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "address": "0x6A3fB91c7D8e45A2b0C1fE97D3a8B52c4e7F10dA" }, "reference": "order_1042", "description": "Pro plan — 1 month", "customerEmail": "ana@example.com", "successUrl": "https://northwood.example/thanks" }, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | An invoice with this `reference` already exists in this mode; it is returned unchanged | | `201` | Invoice created. `clientSecret` is shown only here. | ### List invoices `GET /v0/invoices` | Parameter | In | Required | Notes | |---|---|---|---| | `status` | query | no | | | `limit` | query | no | | | `startingAfter` | query | no | The last `id` of the previous page | ```bash title="curl" curl https://api.intents.fi/v0/invoices?status=paid&limit=25 \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/invoices?status=paid&limit=25", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/invoices?status=paid&limit=25", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Invoices for this key's merchant and mode, newest first | ### Fetch an invoice `GET /v0/invoices/{id}` | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ```bash title="curl" curl https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | The invoice, with its payment attempts | ### Cancel an invoice `POST /v0/invoices/{id}/cancel` Only while `open` or `underpaid`. An invoice with a payment in flight is never canceled, so no customer pays an invoice we have written off. | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ```bash title="curl" curl https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw/cancel \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw/cancel", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw/cancel", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | The canceled invoice | ### Fetch the merchant profile `GET /v0/merchant` ```bash title="curl" curl https://api.intents.fi/v0/merchant \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/merchant", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/merchant", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Profile, branding and the settlement targets in effect | ### Update branding and payment options `PATCH /v0/merchant` Branding, display name and `absorbRouteCost` (§5.1) only. Settlement addresses cannot be changed with an API key: a stolen key must never be able to redirect a payout (§8.3). Change them in the dashboard, where it takes fresh email OTP and 24 hours. | Field | Type | Required | Notes | |---|---|---|---| | `name` | string | no | | | `branding` | object | no | | | `absorbRouteCost` | boolean | no | §5.1: absorb the route cost on stablecoin payments, up to 1% of the invoice. Applies to invoices created after the change. | ```bash title="curl" curl https://api.intents.fi/v0/merchant \ -X PATCH \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/merchant", { method: "PATCH", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.patch( "https://api.intents.fi/v0/merchant", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | The updated profile | ### What a payment link sells, for the link page `GET /v0/links/{id}` | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ```bash title="curl" curl https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo", { method: "GET", }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.get( "https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo", ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | The link | | `404` | Unknown or off | ### One visit to a payment link: an invoice at the link's price, or the customer's amount `POST /v0/links/{id}/invoices` Takes the merchant's publishable key (pk_), or no key: the link ID is its capability, and a link can only create the invoice the merchant priced, or, on a `custom` link, one at an amount the customer chose inside the merchant's bounds. A key must match the link's account and mode. Body (optional JSON, schema `PaymentLinkInvoiceRequest`): `quantity`, `amount` (custom links, required there), `customerEmail`. | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ```bash title="curl" curl https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo/invoices \ -X POST ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo/invoices", { method: "POST", }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.post( "https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo/invoices", ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `201` | Created; send the customer to `url` | | `400` | A bad quantity or amount, or a key from the other mode | | `404` | Unknown or off | | `422` | AMOUNT_OUT_OF_RANGE: outside the link's minimum and maximum | | `429` | Too many from this IP, or on this custom-amount link | ## Checkout: the public payment page ### Resolve a custom checkout domain `GET /v0/checkout/domains/{host}` Which merchant a verified custom checkout domain (`pay.merchant.com`) belongs to. The hosted page calls it for any host that is not its own, and serves only that merchant's invoices there. 404 for anything that is not a verified checkout domain, including one still waiting on DNS. | Parameter | In | Required | Notes | |---|---|---|---| | `host` | path | yes | | ```bash title="curl" curl https://api.intents.fi/v0/checkout/domains/ \ -H 'x-client-secret: $CLIENT_SECRET' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/domains/", { method: "GET", headers: { "x-client-secret": clientSecret, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.get( "https://api.intents.fi/v0/checkout/domains/", headers={"x-client-secret": client_secret}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | A verified checkout domain | ### Fetch the public checkout view `GET /v0/checkout/{invoiceId}` What the payer is shown: the price, the merchant's name and theme, the status and the active attempt. Readable with the invoice ID alone, which carries 22+ characters of randomness, so it never returns the merchant's settlement address or net amount. | Parameter | In | Required | Notes | |---|---|---|---| | `invoiceId` | path | yes | | ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw \ -H 'x-client-secret: $CLIENT_SECRET' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw", { method: "GET", headers: { "x-client-secret": clientSecret, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.get( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw", headers={"x-client-secret": client_secret}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | The public view of the invoice | ### List the assets this invoice can be paid with `GET /v0/checkout/{invoiceId}/options` The ranked "pay with" list. Each row is quoted exact-output through the core aggregator, so `amountIn` is all-in: the invoice plus the cost of delivering it, as one number the customer reads. Route cost is never broken out as gas, bridging or slippage (§5.1). Assets whose provider minimum exceeds the invoice amount are left out (§5.4), and `modes` lists `transfer` only where a provider returns a deposit address for that asset. With no `payer` the list is ten popular assets. With a `payer`, what that address holds of **any** payable asset on its own network joins them (up to 10 more), each with its `balance`; a row whose balance is below `amountIn` has `covers: false` and is listed after the ones the payer can afford. A balance that cannot be read within 800 ms is left out, never waited for (§6.4). `?assets=` quotes up to 3 named assets on demand instead: the one a customer picked from `GET …/assets`. Those rows are never `recommended`. A payable asset no provider will quote right now comes back in `unavailable`; an asset that cannot pay this invoice at all (outside `GET …/assets`: a Bitcoin or NEAR token, a Mayan-only asset, the settlement asset) is refused with `422 NO_ROUTE_FOR_ASSET` before anything is quoted, as `POST …/attempts` refuses it. Cache misses count against a per-invoice hourly limit (`429 RATE_LIMITED`). Quotes are indicative and cached per invoice and asset for `ttlSec`; the binding amount comes from `POST /attempts`. | Parameter | In | Required | Notes | |---|---|---|---| | `invoiceId` | path | yes | | | `payer` | query | no | The payer's address. Balances are read from it on its own VM (§6.4). | | `chains` | query | no | Comma-separated CAIP-2 chain IDs, to narrow the list | | `assets` | query | no | Up to 3 comma-separated CAIP-19 asset IDs to quote on demand: the asset a customer picked from search, or a short result set (§11.35). Only these are quoted. Cache misses count against a per-invoice hourly limit (`429 RATE_LIMITED`). | ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/options \ -H 'x-client-secret: $CLIENT_SECRET' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/options", { method: "GET", headers: { "x-client-secret": clientSecret, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.get( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/options", headers={"x-client-secret": client_secret}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Ranked payment options, newest quote first | ### Search every asset this invoice can be paid with `GET /v0/checkout/{invoiceId}/assets` Searches every payable asset in the registry, not just the default list, by symbol, token name, network or contract address. Every word of `q` must match ("usdc base"). Only assets that a provider can route exact-output to the invoice's settlement asset are listed (§11.3). On Bitcoin and NEAR only the native coin is listed. Search never quotes a long list. When the whole result set is 3 assets or fewer, each match carries its `option` (or `null`: nothing routes it right now). Otherwise price the one the customer picks with `GET …/options?assets=`. Limited per invoice: 240 searches an hour (`429 RATE_LIMITED`). | Parameter | In | Required | Notes | |---|---|---|---| | `invoiceId` | path | yes | | | `q` | query | yes | What the customer typed: a symbol, a token name, a network, or a contract address. Every word must match. | | `limit` | query | no | | | `cursor` | query | no | `nextCursor` from the previous page | | `payer` | query | no | The payer's address, so an inline quote can read their balance (§6.4) | ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/assets?q=usdc%20base&limit=10 \ -H 'x-client-secret: $CLIENT_SECRET' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/assets?q=usdc%20base&limit=10", { method: "GET", headers: { "x-client-secret": clientSecret, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.get( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/assets?q=usdc%20base&limit=10", headers={"x-client-secret": client_secret}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Matching assets, best match first | ### Start a payment attempt `POST /v0/checkout/{invoiceId}/attempts` Picks one asset and turns it into a core order: an exact-output quote for the invoice's net amount (`amountExpected` less the checkout fee), paying the merchant's settlement address, with the fee charged in route on top (§5.1, §11.53). `refundTo` is required in `transfer` mode and defaults to `payer` in `wallet` mode (§11.2). It must be valid on the origin chain, because a failed payment is returned there and nowhere else. Creating an attempt supersedes the invoice's previous active one. The superseded deposit address can still be paid, and if it is, the money still reaches the merchant and is handled as a late payment (§3.2) — which is why the UI shows only the newest address. | Parameter | In | Required | Notes | |---|---|---|---| | `invoiceId` | path | yes | | | `x-client-secret` | header | no | The invoice's `clientSecret`, from `POST /v0/invoices` | ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts \ -X POST \ -H 'x-client-secret: $CLIENT_SECRET' \ -H 'content-type: application/json' \ -d '{ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts", { method: "POST", headers: { "x-client-secret": clientSecret, "content-type": "application/json", }, body: JSON.stringify({ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.post( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts", headers={"x-client-secret": client_secret}, json={ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `201` | The attempt, with the steps that pay it | ### Pay an invoice as an agent, with no UI `POST /v0/checkout/{invoiceId}/agent` For software that pays on someone's behalf (§12 C3). Call it with **no body** and it answers `402 Payment Required`, x402-style: the invoice, and in `accepts[]` every asset it can be paid with and the indicative all-in amount for each. Nothing is created. Call it again with `{ "asset", "mode": "transfer", "refundTo" }` and it creates a payment attempt, exactly like `POST …/attempts`, tagged `channel: "agent"`. The response carries the deposit address and the binding amount in `display`. Send exactly that amount, then poll `GET …/attempts/{id}` until `invoiceStatus` is `paid`. The merchant gets the same webhooks as for any other payment. No client secret is needed: the invoice ID is the capability, as it is for the hosted page (§11.10), and the same per-invoice and per-IP attempt limits apply. | Parameter | In | Required | Notes | |---|---|---|---| | `invoiceId` | path | yes | | ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent \ -X POST \ -H 'x-client-secret: $CLIENT_SECRET' \ -H 'content-type: application/json' \ -d '{ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent", { method: "POST", headers: { "x-client-secret": clientSecret, "content-type": "application/json", }, body: JSON.stringify({ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.post( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent", headers={"x-client-secret": client_secret}, json={ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `201` | The attempt, with the deposit address (transfer) or the steps (wallet) | | `402` | Payment required: the invoice and what it accepts | ### Hand in a transaction hash or signature `POST /v0/checkout/{invoiceId}/attempts/{id}/submit` Required by the providers that settle from a signature, and a shortcut everywhere else: telling us the hash finds the payment sooner than watching for it. | Parameter | In | Required | Notes | |---|---|---|---| | `invoiceId` | path | yes | | | `id` | path | yes | | | `x-client-secret` | header | no | The invoice's `clientSecret`, from `POST /v0/invoices` | | Field | Type | Required | Notes | |---|---|---|---| | `txHash` | string | no | | | `signature` | string | no | | | `chain` | string | no | | ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit \ -X POST \ -H 'x-client-secret: $CLIENT_SECRET' \ -H 'content-type: application/json' \ -d '{ "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit", { method: "POST", headers: { "x-client-secret": clientSecret, "content-type": "application/json", }, body: JSON.stringify({ "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.post( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit", headers={"x-client-secret": client_secret}, json={ "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4" }, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | The attempt, with the submission recorded | ### Fetch a payment attempt `GET /v0/checkout/{invoiceId}/attempts/{id}` Refreshed from the provider when stale, like core `GET /v0/orders/{id}`. Poll it every 2 s while the page is visible, backing off to 10 s after 5 minutes (§4.5). It carries `invoiceStatus` too, so one poll drives the whole screen. | Parameter | In | Required | Notes | |---|---|---|---| | `invoiceId` | path | yes | | | `id` | path | yes | | ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw \ -H 'x-client-secret: $CLIENT_SECRET' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw", { method: "GET", headers: { "x-client-secret": clientSecret, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.get( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw", headers={"x-client-secret": client_secret}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | The attempt and the invoice status it implies | ## Intents Route ### POST /v0/quotes `POST /v0/quotes` | Field | Type | Required | Notes | |---|---|---|---| | `tradeType` | `EXACT_INPUT` \| `EXACT_OUTPUT` | no | | | `from` | object | yes | | | `from.asset` | string | yes | | | `from.amount` | string | no | | | `to` | object | yes | | | `to.asset` | string | yes | | | `to.amount` | string | no | | | `sender` | string | yes | | | `recipient` | string | yes | | | `refundTo` | string | no | | | `slippageBps` | object | no | | | `providers` | array | no | | | `excludeProviders` | array | no | | | `rank` | `output` \| `speed` \| `balanced` | no | | | `executionModes` | array | no | | | `timeoutMs` | integer | no | | ```bash title="curl" curl https://api.intents.fi/v0/quotes \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "from": { "asset": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831", "amount": "100000000" }, "to": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" }, "sender": "0x15AAB9098125C5A728CA818B31620a902C25f764", "recipient": "0x9b3c1f4A6D2E5b70CA18F4D3e9B2A7C641FD8E05", "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/quotes", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "from": { "asset": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831", "amount": "100000000" }, "to": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" }, "sender": "0x15AAB9098125C5A728CA818B31620a902C25f764", "recipient": "0x9b3c1f4A6D2E5b70CA18F4D3e9B2A7C641FD8E05", "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/quotes", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "from": { "asset": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831", "amount": "100000000" }, "to": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" }, "sender": "0x15AAB9098125C5A728CA818B31620a902C25f764", "recipient": "0x9b3c1f4A6D2E5b70CA18F4D3e9B2A7C641FD8E05", "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764" }, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Ranked quotes from every provider that answered in time | ### GET /v0/chains `GET /v0/chains` ```bash title="curl" curl https://api.intents.fi/v0/chains \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/chains", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/chains", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Supported chains | ### GET /v0/assets `GET /v0/assets` | Parameter | In | Required | Notes | |---|---|---|---| | `chain` | query | no | | | `q` | query | no | | | `limit` | query | no | | ```bash title="curl" curl https://api.intents.fi/v0/assets?limit=25 \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/assets?limit=25", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/assets?limit=25", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Assets routable by at least one provider. Look up by address; symbols are display-only. | ### POST /v0/orders `POST /v0/orders` | Field | Type | Required | Notes | |---|---|---|---| | `quoteId` | string | yes | | | `driftToleranceBps` | integer | no | | ```bash title="curl" curl https://api.intents.fi/v0/orders \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "quoteId": "" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/orders", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "quoteId": "" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/orders", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "quoteId": "" }, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Existing order for this quote | | `201` | Order created | ### POST /v0/orders/{id}/submit `POST /v0/orders/{id}/submit` | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | | Field | Type | Required | Notes | |---|---|---|---| | `txHash` | string | no | | | `signature` | string | no | | | `chain` | string | no | | ```bash title="curl" curl https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4" }, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Submission recorded | ### GET /v0/orders/{id} `GET /v0/orders/{id}` | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ```bash title="curl" curl https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Order status (refreshed from the provider when stale) | ### Check a Connect request before showing it `POST /v0/connect/check` Validates what a plugin sent to `dashboard.intents.fi/connect`: a known platform, https URLs, a `return_url` on the same origin as `site_url`, a `state` and an S256 `code_challenge`. A refused request is never shown and the browser is never sent to its `return_url`. Needs no authentication and reads nothing. | Field | Type | Required | Notes | |---|---|---|---| | `platform` | string | yes | One of woocommerce, whmcs, prestashop, opencart, magento | | `site_url` | string | yes | The store, e.g. `https://shop.example.com` | | `return_url` | string | yes | Where the browser goes back to. Must share `site_url`'s origin. | | `state` | string | yes | The plugin's own random value, echoed back | | `code_challenge` | string | yes | base64url(SHA-256(code_verifier)) | | `code_challenge_method` | `S256` | no | | | `mode` | `test` \| `live` | no | Default `test` | | `partner` | string | no | Agency Partner ID, when present | ```bash title="curl" curl https://api.intents.fi/v0/connect/check \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "platform": "woocommerce", "site_url": "https://shop.northwood.example", "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return", "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "mode": "test" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/connect/check", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "platform": "woocommerce", "site_url": "https://shop.northwood.example", "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return", "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "mode": "test" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/connect/check", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "platform": "woocommerce", "site_url": "https://shop.northwood.example", "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return", "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "mode": "test" }, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | A request the consent screen may show | | `400` | INVALID_REQUEST, with `details.field` | ### Approve a Connect request (the consent screen's Connect button) `POST /v0/connect/authorize` Dashboard session only. Re-checks the request, then issues a single-use code (5 minutes) bound to the site, the return URL and the challenge. `mode: live` is `LIVE_MODE_LOCKED` until the go-live checklist is done. Choose the account with `x-account-id`. | Field | Type | Required | Notes | |---|---|---|---| | `platform` | string | yes | One of woocommerce, whmcs, prestashop, opencart, magento | | `site_url` | string | yes | The store, e.g. `https://shop.example.com` | | `return_url` | string | yes | Where the browser goes back to. Must share `site_url`'s origin. | | `state` | string | yes | The plugin's own random value, echoed back | | `code_challenge` | string | yes | base64url(SHA-256(code_verifier)) | | `code_challenge_method` | `S256` | no | | | `mode` | `test` \| `live` | no | Default `test` | | `partner` | string | no | Agency Partner ID, when present | ```bash title="curl" curl https://api.intents.fi/v0/connect/authorize \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "platform": "woocommerce", "site_url": "https://shop.northwood.example", "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return", "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "mode": "test" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/connect/authorize", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "platform": "woocommerce", "site_url": "https://shop.northwood.example", "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return", "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "mode": "test" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/connect/authorize", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "platform": "woocommerce", "site_url": "https://shop.northwood.example", "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return", "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "mode": "test" }, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Approved | | `400` | INVALID_REQUEST | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key; FORBIDDEN below the role needed | ### Exchange a Connect code for the store's keys (server to server) `POST /v0/connect/token` Called by the plugin's server, never a browser. The code is spent by the first attempt, right or wrong; presenting a spent code again revokes the connection it made. Returns a secret key named for the site and scoped to the merchant, which can create invoices and register webhooks but never change where the merchant is paid. Test-mode keys unless the code was approved for live after go-live. | Field | Type | Required | Notes | |---|---|---|---| | `code` | string | yes | | | `code_verifier` | string | yes | | | `site_url` | string | yes | The same `site_url` the request named | ```bash title="curl" curl https://api.intents.fi/v0/connect/token \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "code": "", "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", "site_url": "https://shop.northwood.example" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/connect/token", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "code": "", "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", "site_url": "https://shop.northwood.example" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/connect/token", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "code": "", "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", "site_url": "https://shop.northwood.example" }, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Connected | | `400` | CONNECT_CODE_INVALID: unknown, expired, used, wrong verifier or site | | `403` | LIVE_MODE_LOCKED or MERCHANT_RESTRICTED | ### Disconnect a store: revoke this key's connection `POST /v0/connect/revoke` Authenticated with the connection's own secret key. Revokes its keys and the webhooks they registered, at once. ```bash title="curl" curl https://api.intents.fi/v0/connect/revoke \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/connect/revoke", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/connect/revoke", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Revoked | | `401` | Missing or invalid API key | | `404` | The key is not a Connect key | ### Become an affiliate: a profile with a generated code `POST /v0/affiliate/signup` ```bash title="curl" curl https://api.intents.fi/v0/affiliate/signup \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/signup", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/affiliate/signup", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `201` | Created | | `400` | INVALID_REQUEST, with `details.field` | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `409` | AFFILIATE_EXISTS: this user already has a profile | ### The affiliate's profile, link, share, status and payout wallet (masked) `GET /v0/affiliate/me` ```bash title="curl" curl https://api.intents.fi/v0/affiliate/me \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/me", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/affiliate/me", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Profile | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | ### Edit the display name, website, type, notifications, or change the code once `PATCH /v0/affiliate/me` ```bash title="curl" curl https://api.intents.fi/v0/affiliate/me \ -X PATCH \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/me", { method: "PATCH", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.patch( "https://api.intents.fi/v0/affiliate/me", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Saved | | `400` | INVALID_REQUEST, with `details.field` | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | | `409` | AFFILIATE_CODE_TAKEN, or AFFILIATE_CODE_LOCKED after one change | ### Close the affiliate profile; only when nothing is pending, payable or held `POST /v0/affiliate/me/close` Sets `status` to `closed` (a status, not a delete: the audit trail and the code stay reserved). Refused with `AFFILIATE_CLOSE_BLOCKED` while any commission is pending, payable or held, or a payout is pending. Added by Agent B (orchestrator decision, 2026-11-26). ```bash title="curl" curl https://api.intents.fi/v0/affiliate/me/close \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/me/close", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/affiliate/me/close", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Closed | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | | `409` | AFFILIATE_CLOSE_BLOCKED: commission is still pending, payable or held | ### Totals, next payout, funnel and daily series `GET /v0/affiliate/overview` | Parameter | In | Required | Notes | |---|---|---|---| | `range` | query | no | Default `30d`; the funnel and series | ```bash title="curl" curl https://api.intents.fi/v0/affiliate/overview \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/overview", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/affiliate/overview", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Overview | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | ### Earnings per referred merchant (masked); JSON or CSV `GET /v0/affiliate/merchants` | Parameter | In | Required | Notes | |---|---|---|---| | `status` | query | no | | | `source` | query | no | | | `format` | query | no | `csv` for a download | ```bash title="curl" curl https://api.intents.fi/v0/affiliate/merchants?status=signed_up \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/merchants?status=signed_up", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/affiliate/merchants?status=signed_up", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Merchants | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | ### The per-payment ledger; JSON or CSV `GET /v0/affiliate/commissions` | Parameter | In | Required | Notes | |---|---|---|---| | `status` | query | no | | | `month` | query | no | Payment month, `YYYY-MM` | | `merchant` | query | no | A `merchantRef` from /v0/affiliate/merchants | | `format` | query | no | `csv` for a download | ```bash title="curl" curl https://api.intents.fi/v0/affiliate/commissions?status=paid \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/commissions?status=paid", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/affiliate/commissions?status=paid", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Commissions | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | ### Tracked links with clicks, signups, live merchants and earnings each `GET /v0/affiliate/links` ```bash title="curl" curl https://api.intents.fi/v0/affiliate/links \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/links", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/affiliate/links", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Links | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | ### Add a tracked link (a name for a sub-ID and a target page) `POST /v0/affiliate/links` ```bash title="curl" curl https://api.intents.fi/v0/affiliate/links \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/links", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/affiliate/links", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `201` | Created | | `400` | INVALID_REQUEST, with `details.field` | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | | `409` | AFFILIATE_LINK_EXISTS: that sub-ID is already one of your links | ### Remove a tracked link (its past clicks still count) `DELETE /v0/affiliate/links/{id}` | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ```bash title="curl" curl https://api.intents.fi/v0/affiliate/links/inv_3QkR7mVt9zLpXdB2hJn6Yw \ -X DELETE \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/links/inv_3QkR7mVt9zLpXdB2hJn6Yw", { method: "DELETE", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.delete( "https://api.intents.fi/v0/affiliate/links/inv_3QkR7mVt9zLpXdB2hJn6Yw", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `204` | Removed | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | ### Set the USDC payout wallet; a change after the first needs a step-up code `PUT /v0/affiliate/payout-wallet` The first wallet takes effect at once. Every later change needs `stepUpCode` (purpose `affiliate_payout_wallet`). A wallet changed less than 24 hours before a payout run is skipped that month. ```bash title="curl" curl https://api.intents.fi/v0/affiliate/payout-wallet \ -X PUT \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/payout-wallet", { method: "PUT", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.put( "https://api.intents.fi/v0/affiliate/payout-wallet", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Saved | | `400` | INVALID_REQUEST: bad checksum, unsupported chain or a known exchange address | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED, STEP_UP_REQUIRED, AFFILIATE_SUSPENDED or AFFILIATE_CLOSED | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | ### Email a fresh code for a payout wallet change (purpose `affiliate_payout_wallet`) `POST /v0/affiliate/step-up` Works without an account (an affiliate is a user's). `POST /v0/dashboard/step-up` with `purpose: affiliate_payout_wallet` issues the same code for a user who is an account member. Send the code as `stepUpCode` on `PUT /v0/affiliate/payout-wallet`. Added by Agent B (2026-11-26). ```bash title="curl" curl https://api.intents.fi/v0/affiliate/step-up \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/step-up", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/affiliate/step-up", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | A code was emailed to the signed-in user | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | | `429` | RATE_LIMITED: too many codes this hour | ### Payout history `GET /v0/affiliate/payouts` ```bash title="curl" curl https://api.intents.fi/v0/affiliate/payouts \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/payouts", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/affiliate/payouts", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Payouts | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | ### Public: is this an active affiliate code? For the plugin settings field `GET /v0/ref/resolve` | Parameter | In | Required | Notes | |---|---|---|---| | `code` | query | yes | | ```bash title="curl" curl https://api.intents.fi/v0/ref/resolve?code=%3Ccode%3E \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/ref/resolve?code=%3Ccode%3E", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/ref/resolve?code=%3Ccode%3E", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Cached for 5 minutes | ### Route status `GET /v0/status` Per-protocol success and quote-error rates, the median improvement of intents.fi's best quote over NEAR Intents alone, recent failover events, and each protocol's state for each of the last 90 UTC days. Public, aggregates only, test mode excluded, recomputed at most once a minute. | Parameter | In | Required | Notes | |---|---|---|---| | `window` | query | no | How far back the figures reach | ```bash title="curl" curl https://api.intents.fi/v0/status \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/status", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/status", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | The route status for the window | ## Platform: webhooks, fees and health ### GET /health `GET /health` ```bash title="curl" curl https://api.intents.fi/health \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/health", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/health", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Service is up | ### GET /health/migrations `GET /health/migrations` ```bash title="curl" curl https://api.intents.fi/health/migrations \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/health/migrations", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/health/migrations", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | The database has applied every migration this deploy expects | | `503` | Migrations are pending, or the migration history can't be read | ### GET /health/config `GET /health/config` ```bash title="curl" curl https://api.intents.fi/health/config \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/health/config", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/health/config", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Every secret production needs is set | | `503` | A production secret is missing; `missing` names it | ### POST /v0/webhooks `POST /v0/webhooks` | Field | Type | Required | Notes | |---|---|---|---| | `url` | string | yes | | | `events` | array | no | Event types to deliver. Checkout merchants subscribe to `invoice.*`; they never receive `order.updated` for a payment attempt's order (SPEC-checkout §4.4). | ```bash title="curl" curl https://api.intents.fi/v0/webhooks \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "url": "https://northwood.example/hooks/intents" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "url": "https://northwood.example/hooks/intents" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/webhooks", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "url": "https://northwood.example/hooks/intents" }, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `201` | Webhook registered. The signing secret is returned only here. | ### GET /v0/webhooks `GET /v0/webhooks` ```bash title="curl" curl https://api.intents.fi/v0/webhooks \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/webhooks", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Active webhooks | ### Send a signed test event to the endpoint now (test keys only) `POST /v0/webhooks/{id}/test` Delivers one test event, signed with the endpoint's real secret, outside the retry queue. `type` picks the event (default `invoice.paid`): its `data` is a sample test-mode invoice that does not exist, and the envelope carries `sample: true`. `webhook.test` sends a ping with no invoice. Test (`ik_test_`) keys only: a live key gets `TEST_MODE_ONLY`. The response carries the request body and the endpoint's answer (truncated to 2 KB), whatever it was. | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | | Field | Type | Required | Notes | |---|---|---|---| | `type` | `webhook.test` \| `invoice.processing` \| `invoice.underpaid` \| `invoice.paid` \| `invoice.expired` \| `invoice.canceled` \| `invoice.needs_review` | no | Default `invoice.paid`. | ```bash title="curl" curl https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw/test \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw/test", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw/test", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Sent, whether or not the endpoint accepted it: see `delivered`. | ### DELETE /v0/webhooks/{id} `DELETE /v0/webhooks/{id}` | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ```bash title="curl" curl https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw \ -X DELETE \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw", { method: "DELETE", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.delete( "https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Deleted | ### GET /v0/fees/balance `GET /v0/fees/balance` ```bash title="curl" curl https://api.intents.fi/v0/fees/balance \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/fees/balance", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/fees/balance", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Partner fee balance: accrued partner share minus payouts sent | ### GET /v0/fees/statement `GET /v0/fees/statement` | Parameter | In | Required | Notes | |---|---|---|---| | `month` | query | yes | | | `format` | query | no | | ```bash title="curl" curl https://api.intents.fi/v0/fees/statement?month=2026-10 \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/fees/statement?month=2026-10", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/fees/statement?month=2026-10", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Per-order fee lines for a month, with totals (JSON, or CSV with format=csv) | ================================================================================================ # Remove a tracked link (its past clicks still count) — https://intents.fi/docs/api/delete-affiliate-links-id ================================================================================================ `DELETE /v0/affiliate/links/{id}` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ## Responses | Status | Means | |---|---| | `204` | Removed | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | ## Request ```bash title="curl" curl https://api.intents.fi/v0/affiliate/links/inv_3QkR7mVt9zLpXdB2hJn6Yw \ -X DELETE \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/links/inv_3QkR7mVt9zLpXdB2hJn6Yw", { method: "DELETE", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.delete( "https://api.intents.fi/v0/affiliate/links/inv_3QkR7mVt9zLpXdB2hJn6Yw", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Delete a webhook — https://intents.fi/docs/api/delete-webhooks-id ================================================================================================ `DELETE /v0/webhooks/{id}` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ## Responses | Status | Means | |---|---| | `200` | Deleted | ## Request ```bash title="curl" curl https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw \ -X DELETE \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw", { method: "DELETE", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.delete( "https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # The per-payment ledger; JSON or CSV — https://intents.fi/docs/api/get-affiliate-commissions ================================================================================================ `GET /v0/affiliate/commissions` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `status` | query | no | | | `month` | query | no | Payment month, `YYYY-MM` | | `merchant` | query | no | A `merchantRef` from /v0/affiliate/merchants | | `format` | query | no | `csv` for a download | ## Responses | Status | Means | |---|---| | `200` | Commissions | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | ## Request ```bash title="curl" curl https://api.intents.fi/v0/affiliate/commissions?status=paid \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/commissions?status=paid", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/affiliate/commissions?status=paid", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Tracked links with clicks, signups, live merchants and earnings each — https://intents.fi/docs/api/get-affiliate-links ================================================================================================ `GET /v0/affiliate/links` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Responses | Status | Means | |---|---| | `200` | Links | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | ## Request ```bash title="curl" curl https://api.intents.fi/v0/affiliate/links \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/links", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/affiliate/links", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # The affiliate's profile, link, share, status and payout wallet (masked) — https://intents.fi/docs/api/get-affiliate-me ================================================================================================ `GET /v0/affiliate/me` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Responses | Status | Means | |---|---| | `200` | Profile | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | ## Request ```bash title="curl" curl https://api.intents.fi/v0/affiliate/me \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/me", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/affiliate/me", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Earnings per referred merchant (masked); JSON or CSV — https://intents.fi/docs/api/get-affiliate-merchants ================================================================================================ `GET /v0/affiliate/merchants` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `status` | query | no | | | `source` | query | no | | | `format` | query | no | `csv` for a download | ## Responses | Status | Means | |---|---| | `200` | Merchants | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | ## Request ```bash title="curl" curl https://api.intents.fi/v0/affiliate/merchants?status=signed_up \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/merchants?status=signed_up", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/affiliate/merchants?status=signed_up", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Totals, next payout, funnel and daily series — https://intents.fi/docs/api/get-affiliate-overview ================================================================================================ `GET /v0/affiliate/overview` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `range` | query | no | Default `30d`; the funnel and series | ## Responses | Status | Means | |---|---| | `200` | Overview | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | ## Request ```bash title="curl" curl https://api.intents.fi/v0/affiliate/overview \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/overview", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/affiliate/overview", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Payout history — https://intents.fi/docs/api/get-affiliate-payouts ================================================================================================ `GET /v0/affiliate/payouts` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Responses | Status | Means | |---|---| | `200` | Payouts | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | ## Request ```bash title="curl" curl https://api.intents.fi/v0/affiliate/payouts \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/payouts", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/affiliate/payouts", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # List routable assets — https://intents.fi/docs/api/get-assets ================================================================================================ `GET /v0/assets` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `chain` | query | no | | | `q` | query | no | | | `limit` | query | no | | ## Responses | Status | Means | |---|---| | `200` | Assets routable by at least one provider. Look up by address; symbols are display-only. | ## Request ```bash title="curl" curl https://api.intents.fi/v0/assets?limit=25 \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/assets?limit=25", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/assets?limit=25", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # List supported chains — https://intents.fi/docs/api/get-chains ================================================================================================ `GET /v0/chains` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Responses | Status | Means | |---|---| | `200` | Supported chains | ## Request ```bash title="curl" curl https://api.intents.fi/v0/chains \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/chains", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/chains", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Resolve a custom checkout domain — https://intents.fi/docs/api/get-checkout-domains-host ================================================================================================ `GET /v0/checkout/domains/{host}` Which merchant a verified custom checkout domain (`pay.merchant.com`) belongs to. The hosted page calls it for any host that is not its own, and serves only that merchant's invoices there. 404 for anything that is not a verified checkout domain, including one still waiting on DNS. ## Authentication The invoice's client secret, in the `x-client-secret` header. It reaches this one invoice's public endpoints and nothing else, and expires with the invoice. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `host` | path | yes | | ## Responses | Status | Means | |---|---| | `200` | A verified checkout domain | ## Request ```bash title="curl" curl https://api.intents.fi/v0/checkout/domains/ \ -H 'x-client-secret: $CLIENT_SECRET' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/domains/", { method: "GET", headers: { "x-client-secret": clientSecret, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.get( "https://api.intents.fi/v0/checkout/domains/", headers={"x-client-secret": client_secret}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Fetch the public checkout view — https://intents.fi/docs/api/get-checkout-invoiceid ================================================================================================ `GET /v0/checkout/{invoiceId}` What the payer is shown: the price, the merchant's name and theme, the status and the active attempt. Readable with the invoice ID alone, which carries 22+ characters of randomness, so it never returns the merchant's settlement address or net amount. ## Authentication The invoice's client secret, in the `x-client-secret` header. It reaches this one invoice's public endpoints and nothing else, and expires with the invoice. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `invoiceId` | path | yes | | ## Responses | Status | Means | |---|---| | `200` | The public view of the invoice | ## Request ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw \ -H 'x-client-secret: $CLIENT_SECRET' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw", { method: "GET", headers: { "x-client-secret": clientSecret, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.get( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw", headers={"x-client-secret": client_secret}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Search every asset this invoice can be paid with — https://intents.fi/docs/api/get-checkout-invoiceid-assets ================================================================================================ `GET /v0/checkout/{invoiceId}/assets` Searches every payable asset in the registry, not just the default list, by symbol, token name, network or contract address. Every word of `q` must match ("usdc base"). Only assets that a provider can route exact-output to the invoice's settlement asset are listed (§11.3). On Bitcoin and NEAR only the native coin is listed. Search never quotes a long list. When the whole result set is 3 assets or fewer, each match carries its `option` (or `null`: nothing routes it right now). Otherwise price the one the customer picks with `GET …/options?assets=`. Limited per invoice: 240 searches an hour (`429 RATE_LIMITED`). ## Authentication The invoice's client secret, in the `x-client-secret` header. It reaches this one invoice's public endpoints and nothing else, and expires with the invoice. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `invoiceId` | path | yes | | | `q` | query | yes | What the customer typed: a symbol, a token name, a network, or a contract address. Every word must match. | | `limit` | query | no | | | `cursor` | query | no | `nextCursor` from the previous page | | `payer` | query | no | The payer's address, so an inline quote can read their balance (§6.4) | ## Responses | Status | Means | |---|---| | `200` | Matching assets, best match first | ## Request ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/assets?q=usdc%20base&limit=10 \ -H 'x-client-secret: $CLIENT_SECRET' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/assets?q=usdc%20base&limit=10", { method: "GET", headers: { "x-client-secret": clientSecret, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.get( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/assets?q=usdc%20base&limit=10", headers={"x-client-secret": client_secret}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Fetch a payment attempt — https://intents.fi/docs/api/get-checkout-invoiceid-attempts-id ================================================================================================ `GET /v0/checkout/{invoiceId}/attempts/{id}` Refreshed from the provider when stale, like core `GET /v0/orders/{id}`. Poll it every 2 s while the page is visible, backing off to 10 s after 5 minutes (§4.5). It carries `invoiceStatus` too, so one poll drives the whole screen. ## Authentication The invoice's client secret, in the `x-client-secret` header. It reaches this one invoice's public endpoints and nothing else, and expires with the invoice. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `invoiceId` | path | yes | | | `id` | path | yes | | ## Responses | Status | Means | |---|---| | `200` | The attempt and the invoice status it implies | ## Request ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw \ -H 'x-client-secret: $CLIENT_SECRET' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw", { method: "GET", headers: { "x-client-secret": clientSecret, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.get( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw", headers={"x-client-secret": client_secret}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # List the assets this invoice can be paid with — https://intents.fi/docs/api/get-checkout-invoiceid-options ================================================================================================ `GET /v0/checkout/{invoiceId}/options` The ranked "pay with" list. Each row is quoted exact-output through the core aggregator, so `amountIn` is all-in: the invoice plus the cost of delivering it, as one number the customer reads. Route cost is never broken out as gas, bridging or slippage (§5.1). Assets whose provider minimum exceeds the invoice amount are left out (§5.4), and `modes` lists `transfer` only where a provider returns a deposit address for that asset. With no `payer` the list is ten popular assets. With a `payer`, what that address holds of **any** payable asset on its own network joins them (up to 10 more), each with its `balance`; a row whose balance is below `amountIn` has `covers: false` and is listed after the ones the payer can afford. A balance that cannot be read within 800 ms is left out, never waited for (§6.4). `?assets=` quotes up to 3 named assets on demand instead: the one a customer picked from `GET …/assets`. Those rows are never `recommended`. A payable asset no provider will quote right now comes back in `unavailable`; an asset that cannot pay this invoice at all (outside `GET …/assets`: a Bitcoin or NEAR token, a Mayan-only asset, the settlement asset) is refused with `422 NO_ROUTE_FOR_ASSET` before anything is quoted, as `POST …/attempts` refuses it. Cache misses count against a per-invoice hourly limit (`429 RATE_LIMITED`). Quotes are indicative and cached per invoice and asset for `ttlSec`; the binding amount comes from `POST /attempts`. ## Authentication The invoice's client secret, in the `x-client-secret` header. It reaches this one invoice's public endpoints and nothing else, and expires with the invoice. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `invoiceId` | path | yes | | | `payer` | query | no | The payer's address. Balances are read from it on its own VM (§6.4). | | `chains` | query | no | Comma-separated CAIP-2 chain IDs, to narrow the list | | `assets` | query | no | Up to 3 comma-separated CAIP-19 asset IDs to quote on demand: the asset a customer picked from search, or a short result set (§11.35). Only these are quoted. Cache misses count against a per-invoice hourly limit (`429 RATE_LIMITED`). | ## Responses | Status | Means | |---|---| | `200` | Ranked payment options, newest quote first | ## Request ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/options \ -H 'x-client-secret: $CLIENT_SECRET' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/options", { method: "GET", headers: { "x-client-secret": clientSecret, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.get( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/options", headers={"x-client-secret": client_secret}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Fetch the fee balance — https://intents.fi/docs/api/get-fees-balance ================================================================================================ `GET /v0/fees/balance` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Responses | Status | Means | |---|---| | `200` | Partner fee balance: accrued partner share minus payouts sent | ## Request ```bash title="curl" curl https://api.intents.fi/v0/fees/balance \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/fees/balance", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/fees/balance", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Fetch the fee statement — https://intents.fi/docs/api/get-fees-statement ================================================================================================ `GET /v0/fees/statement` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `month` | query | yes | | | `format` | query | no | | ## Responses | Status | Means | |---|---| | `200` | Per-order fee lines for a month, with totals (JSON, or CSV with format=csv) | ## Request ```bash title="curl" curl https://api.intents.fi/v0/fees/statement?month=2026-10 \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/fees/statement?month=2026-10", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/fees/statement?month=2026-10", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Check service health — https://intents.fi/docs/api/get-health ================================================================================================ `GET /health` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Responses | Status | Means | |---|---| | `200` | Service is up | ## Request ```bash title="curl" curl https://api.intents.fi/health \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/health", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/health", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Check service configuration — https://intents.fi/docs/api/get-health-config ================================================================================================ `GET /health/config` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Responses | Status | Means | |---|---| | `200` | Every secret production needs is set | | `503` | A production secret is missing; `missing` names it | ## Request ```bash title="curl" curl https://api.intents.fi/health/config \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/health/config", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/health/config", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Check database migrations — https://intents.fi/docs/api/get-health-migrations ================================================================================================ `GET /health/migrations` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Responses | Status | Means | |---|---| | `200` | The database has applied every migration this deploy expects | | `503` | Migrations are pending, or the migration history can't be read | ## Request ```bash title="curl" curl https://api.intents.fi/health/migrations \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/health/migrations", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/health/migrations", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # List invoices — https://intents.fi/docs/api/get-invoices ================================================================================================ `GET /v0/invoices` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `status` | query | no | | | `limit` | query | no | | | `startingAfter` | query | no | The last `id` of the previous page | ## Responses | Status | Means | |---|---| | `200` | Invoices for this key's merchant and mode, newest first | ## Request ```bash title="curl" curl https://api.intents.fi/v0/invoices?status=paid&limit=25 \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/invoices?status=paid&limit=25", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/invoices?status=paid&limit=25", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Fetch an invoice — https://intents.fi/docs/api/get-invoices-id ================================================================================================ `GET /v0/invoices/{id}` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ## Responses | Status | Means | |---|---| | `200` | The invoice, with its payment attempts | ## Request ```bash title="curl" curl https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # What a payment link sells, for the link page — https://intents.fi/docs/api/get-links-id ================================================================================================ `GET /v0/links/{id}` ## Authentication None. The payment link's ID is the capability, so this runs in a customer's browser with no key at all. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ## Responses | Status | Means | |---|---| | `200` | The link | | `404` | Unknown or off | ## Request ```bash title="curl" curl https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo", { method: "GET", }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.get( "https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo", ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Fetch the merchant profile — https://intents.fi/docs/api/get-merchant ================================================================================================ `GET /v0/merchant` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Responses | Status | Means | |---|---| | `200` | Profile, branding and the settlement targets in effect | ## Request ```bash title="curl" curl https://api.intents.fi/v0/merchant \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/merchant", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/merchant", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Fetch an order — https://intents.fi/docs/api/get-orders-id ================================================================================================ `GET /v0/orders/{id}` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ## Responses | Status | Means | |---|---| | `200` | Order status (refreshed from the provider when stale) | ## Request ```bash title="curl" curl https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Public: is this an active affiliate code? For the plugin settings field — https://intents.fi/docs/api/get-ref-resolve ================================================================================================ `GET /v0/ref/resolve` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `code` | query | yes | | ## Responses | Status | Means | |---|---| | `200` | Cached for 5 minutes | ## Request ```bash title="curl" curl https://api.intents.fi/v0/ref/resolve?code=%3Ccode%3E \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/ref/resolve?code=%3Ccode%3E", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/ref/resolve?code=%3Ccode%3E", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Route status — https://intents.fi/docs/api/get-status ================================================================================================ `GET /v0/status` Per-protocol success and quote-error rates, the median improvement of intents.fi's best quote over NEAR Intents alone, recent failover events, and each protocol's state for each of the last 90 UTC days. Public, aggregates only, test mode excluded, recomputed at most once a minute. ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `window` | query | no | How far back the figures reach | ## Responses | Status | Means | |---|---| | `200` | The route status for the window | ## Request ```bash title="curl" curl https://api.intents.fi/v0/status \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/status", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/status", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # List webhooks — https://intents.fi/docs/api/get-webhooks ================================================================================================ `GET /v0/webhooks` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Responses | Status | Means | |---|---| | `200` | Active webhooks | ## Request ```bash title="curl" curl https://api.intents.fi/v0/webhooks \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/webhooks", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Edit the display name, website, type, notifications, or change the code once — https://intents.fi/docs/api/patch-affiliate-me ================================================================================================ `PATCH /v0/affiliate/me` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Responses | Status | Means | |---|---| | `200` | Saved | | `400` | INVALID_REQUEST, with `details.field` | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | | `409` | AFFILIATE_CODE_TAKEN, or AFFILIATE_CODE_LOCKED after one change | ## Request ```bash title="curl" curl https://api.intents.fi/v0/affiliate/me \ -X PATCH \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/me", { method: "PATCH", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.patch( "https://api.intents.fi/v0/affiliate/me", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Update branding and payment options — https://intents.fi/docs/api/patch-merchant ================================================================================================ `PATCH /v0/merchant` Branding, display name and `absorbRouteCost` (§5.1) only. Settlement addresses cannot be changed with an API key: a stolen key must never be able to redirect a payout (§8.3). Change them in the dashboard, where it takes fresh email OTP and 24 hours. ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Body parameters | Field | Type | Required | Notes | |---|---|---|---| | `name` | string | no | | | `branding` | object | no | | | `absorbRouteCost` | boolean | no | §5.1: absorb the route cost on stablecoin payments, up to 1% of the invoice. Applies to invoices created after the change. | ## Responses | Status | Means | |---|---| | `200` | The updated profile | ## Request ```bash title="curl" curl https://api.intents.fi/v0/merchant \ -X PATCH \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/merchant", { method: "PATCH", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.patch( "https://api.intents.fi/v0/merchant", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Add a tracked link (a name for a sub-ID and a target page) — https://intents.fi/docs/api/post-affiliate-links ================================================================================================ `POST /v0/affiliate/links` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Responses | Status | Means | |---|---| | `201` | Created | | `400` | INVALID_REQUEST, with `details.field` | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | | `409` | AFFILIATE_LINK_EXISTS: that sub-ID is already one of your links | ## Request ```bash title="curl" curl https://api.intents.fi/v0/affiliate/links \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/links", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/affiliate/links", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Close the affiliate profile; only when nothing is pending, payable or held — https://intents.fi/docs/api/post-affiliate-me-close ================================================================================================ `POST /v0/affiliate/me/close` Sets `status` to `closed` (a status, not a delete: the audit trail and the code stay reserved). Refused with `AFFILIATE_CLOSE_BLOCKED` while any commission is pending, payable or held, or a payout is pending. Added by Agent B (orchestrator decision, 2026-11-26). ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Responses | Status | Means | |---|---| | `200` | Closed | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | | `409` | AFFILIATE_CLOSE_BLOCKED: commission is still pending, payable or held | ## Request ```bash title="curl" curl https://api.intents.fi/v0/affiliate/me/close \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/me/close", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/affiliate/me/close", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Become an affiliate: a profile with a generated code — https://intents.fi/docs/api/post-affiliate-signup ================================================================================================ `POST /v0/affiliate/signup` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Responses | Status | Means | |---|---| | `201` | Created | | `400` | INVALID_REQUEST, with `details.field` | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `409` | AFFILIATE_EXISTS: this user already has a profile | ## Request ```bash title="curl" curl https://api.intents.fi/v0/affiliate/signup \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/signup", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/affiliate/signup", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Email a fresh code for a payout wallet change (purpose `affiliate_payout_wallet`) — https://intents.fi/docs/api/post-affiliate-step-up ================================================================================================ `POST /v0/affiliate/step-up` Works without an account (an affiliate is a user's). `POST /v0/dashboard/step-up` with `purpose: affiliate_payout_wallet` issues the same code for a user who is an account member. Send the code as `stepUpCode` on `PUT /v0/affiliate/payout-wallet`. Added by Agent B (2026-11-26). ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Responses | Status | Means | |---|---| | `200` | A code was emailed to the signed-in user | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | | `429` | RATE_LIMITED: too many codes this hour | ## Request ```bash title="curl" curl https://api.intents.fi/v0/affiliate/step-up \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/step-up", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/affiliate/step-up", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Pay an invoice as an agent, with no UI — https://intents.fi/docs/api/post-checkout-invoiceid-agent ================================================================================================ `POST /v0/checkout/{invoiceId}/agent` For software that pays on someone's behalf (§12 C3). Call it with **no body** and it answers `402 Payment Required`, x402-style: the invoice, and in `accepts[]` every asset it can be paid with and the indicative all-in amount for each. Nothing is created. Call it again with `{ "asset", "mode": "transfer", "refundTo" }` and it creates a payment attempt, exactly like `POST …/attempts`, tagged `channel: "agent"`. The response carries the deposit address and the binding amount in `display`. Send exactly that amount, then poll `GET …/attempts/{id}` until `invoiceStatus` is `paid`. The merchant gets the same webhooks as for any other payment. No client secret is needed: the invoice ID is the capability, as it is for the hosted page (§11.10), and the same per-invoice and per-IP attempt limits apply. ## Authentication The invoice's client secret, in the `x-client-secret` header. It reaches this one invoice's public endpoints and nothing else, and expires with the invoice. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `invoiceId` | path | yes | | ## Responses | Status | Means | |---|---| | `201` | The attempt, with the deposit address (transfer) or the steps (wallet) | | `402` | Payment required: the invoice and what it accepts | ## Request ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent \ -X POST \ -H 'x-client-secret: $CLIENT_SECRET' \ -H 'content-type: application/json' \ -d '{ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent", { method: "POST", headers: { "x-client-secret": clientSecret, "content-type": "application/json", }, body: JSON.stringify({ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.post( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent", headers={"x-client-secret": client_secret}, json={ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Start a payment attempt — https://intents.fi/docs/api/post-checkout-invoiceid-attempts ================================================================================================ `POST /v0/checkout/{invoiceId}/attempts` Picks one asset and turns it into a core order: an exact-output quote for the invoice's net amount (`amountExpected` less the checkout fee), paying the merchant's settlement address, with the fee charged in route on top (§5.1, §11.53). `refundTo` is required in `transfer` mode and defaults to `payer` in `wallet` mode (§11.2). It must be valid on the origin chain, because a failed payment is returned there and nowhere else. Creating an attempt supersedes the invoice's previous active one. The superseded deposit address can still be paid, and if it is, the money still reaches the merchant and is handled as a late payment (§3.2) — which is why the UI shows only the newest address. ## Authentication The invoice's client secret, in the `x-client-secret` header. It reaches this one invoice's public endpoints and nothing else, and expires with the invoice. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `invoiceId` | path | yes | | | `x-client-secret` | header | no | The invoice's `clientSecret`, from `POST /v0/invoices` | ## Responses | Status | Means | |---|---| | `201` | The attempt, with the steps that pay it | ## Request ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts \ -X POST \ -H 'x-client-secret: $CLIENT_SECRET' \ -H 'content-type: application/json' \ -d '{ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts", { method: "POST", headers: { "x-client-secret": clientSecret, "content-type": "application/json", }, body: JSON.stringify({ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.post( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts", headers={"x-client-secret": client_secret}, json={ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Hand in a transaction hash or signature — https://intents.fi/docs/api/post-checkout-invoiceid-attempts-id-submit ================================================================================================ `POST /v0/checkout/{invoiceId}/attempts/{id}/submit` Required by the providers that settle from a signature, and a shortcut everywhere else: telling us the hash finds the payment sooner than watching for it. ## Authentication The invoice's client secret, in the `x-client-secret` header. It reaches this one invoice's public endpoints and nothing else, and expires with the invoice. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `invoiceId` | path | yes | | | `id` | path | yes | | | `x-client-secret` | header | no | The invoice's `clientSecret`, from `POST /v0/invoices` | ## Body parameters | Field | Type | Required | Notes | |---|---|---|---| | `txHash` | string | no | | | `signature` | string | no | | | `chain` | string | no | | ## Responses | Status | Means | |---|---| | `200` | The attempt, with the submission recorded | ## Request ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit \ -X POST \ -H 'x-client-secret: $CLIENT_SECRET' \ -H 'content-type: application/json' \ -d '{ "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit", { method: "POST", headers: { "x-client-secret": clientSecret, "content-type": "application/json", }, body: JSON.stringify({ "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.post( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit", headers={"x-client-secret": client_secret}, json={ "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4" }, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Approve a Connect request (the consent screen's Connect button) — https://intents.fi/docs/api/post-connect-authorize ================================================================================================ `POST /v0/connect/authorize` Dashboard session only. Re-checks the request, then issues a single-use code (5 minutes) bound to the site, the return URL and the challenge. `mode: live` is `LIVE_MODE_LOCKED` until the go-live checklist is done. Choose the account with `x-account-id`. ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Body parameters | Field | Type | Required | Notes | |---|---|---|---| | `platform` | string | yes | One of woocommerce, whmcs, prestashop, opencart, magento | | `site_url` | string | yes | The store, e.g. `https://shop.example.com` | | `return_url` | string | yes | Where the browser goes back to. Must share `site_url`'s origin. | | `state` | string | yes | The plugin's own random value, echoed back | | `code_challenge` | string | yes | base64url(SHA-256(code_verifier)) | | `code_challenge_method` | `S256` | no | | | `mode` | `test` \| `live` | no | Default `test` | | `partner` | string | no | Agency Partner ID, when present | ## Responses | Status | Means | |---|---| | `200` | Approved | | `400` | INVALID_REQUEST | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED for an API key; FORBIDDEN below the role needed | ## Request ```bash title="curl" curl https://api.intents.fi/v0/connect/authorize \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "platform": "woocommerce", "site_url": "https://shop.northwood.example", "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return", "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "mode": "test" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/connect/authorize", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "platform": "woocommerce", "site_url": "https://shop.northwood.example", "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return", "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "mode": "test" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/connect/authorize", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "platform": "woocommerce", "site_url": "https://shop.northwood.example", "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return", "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "mode": "test" }, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Check a Connect request before showing it — https://intents.fi/docs/api/post-connect-check ================================================================================================ `POST /v0/connect/check` Validates what a plugin sent to `dashboard.intents.fi/connect`: a known platform, https URLs, a `return_url` on the same origin as `site_url`, a `state` and an S256 `code_challenge`. A refused request is never shown and the browser is never sent to its `return_url`. Needs no authentication and reads nothing. ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Body parameters | Field | Type | Required | Notes | |---|---|---|---| | `platform` | string | yes | One of woocommerce, whmcs, prestashop, opencart, magento | | `site_url` | string | yes | The store, e.g. `https://shop.example.com` | | `return_url` | string | yes | Where the browser goes back to. Must share `site_url`'s origin. | | `state` | string | yes | The plugin's own random value, echoed back | | `code_challenge` | string | yes | base64url(SHA-256(code_verifier)) | | `code_challenge_method` | `S256` | no | | | `mode` | `test` \| `live` | no | Default `test` | | `partner` | string | no | Agency Partner ID, when present | ## Responses | Status | Means | |---|---| | `200` | A request the consent screen may show | | `400` | INVALID_REQUEST, with `details.field` | ## Request ```bash title="curl" curl https://api.intents.fi/v0/connect/check \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "platform": "woocommerce", "site_url": "https://shop.northwood.example", "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return", "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "mode": "test" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/connect/check", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "platform": "woocommerce", "site_url": "https://shop.northwood.example", "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return", "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "mode": "test" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/connect/check", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "platform": "woocommerce", "site_url": "https://shop.northwood.example", "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return", "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "mode": "test" }, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Disconnect a store: revoke this key's connection — https://intents.fi/docs/api/post-connect-revoke ================================================================================================ `POST /v0/connect/revoke` Authenticated with the connection's own secret key. Revokes its keys and the webhooks they registered, at once. ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Responses | Status | Means | |---|---| | `200` | Revoked | | `401` | Missing or invalid API key | | `404` | The key is not a Connect key | ## Request ```bash title="curl" curl https://api.intents.fi/v0/connect/revoke \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/connect/revoke", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/connect/revoke", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Exchange a Connect code for the store's keys (server to server) — https://intents.fi/docs/api/post-connect-token ================================================================================================ `POST /v0/connect/token` Called by the plugin's server, never a browser. The code is spent by the first attempt, right or wrong; presenting a spent code again revokes the connection it made. Returns a secret key named for the site and scoped to the merchant, which can create invoices and register webhooks but never change where the merchant is paid. Test-mode keys unless the code was approved for live after go-live. ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Body parameters | Field | Type | Required | Notes | |---|---|---|---| | `code` | string | yes | | | `code_verifier` | string | yes | | | `site_url` | string | yes | The same `site_url` the request named | ## Responses | Status | Means | |---|---| | `200` | Connected | | `400` | CONNECT_CODE_INVALID: unknown, expired, used, wrong verifier or site | | `403` | LIVE_MODE_LOCKED or MERCHANT_RESTRICTED | ## Request ```bash title="curl" curl https://api.intents.fi/v0/connect/token \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "code": "", "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", "site_url": "https://shop.northwood.example" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/connect/token", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "code": "", "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", "site_url": "https://shop.northwood.example" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/connect/token", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "code": "", "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", "site_url": "https://shop.northwood.example" }, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Create an invoice — https://intents.fi/docs/api/post-invoices ================================================================================================ `POST /v0/invoices` Creates an invoice priced in USD. The customer may pay in any routable token on any routable chain; the merchant receives one settlement asset at its own address (§0). Settlement is in a USD stablecoin (USDC on base, USDC on arbitrum, USDC on ethereum, USDC on solana, USDC on polygon, USDT on tron, USDT on ethereum, USDT on arbitrum, USDT on bsc), 1:1 with `amount`, or in BTC. A BTC invoice's `amountExpected` is locked from live quotes when it is created (`priceLock`, §5.2); if no reliable price can be had the invoice is refused with `503 PRICE_UNAVAILABLE`. Re-sending a `reference` in the same mode returns `200` with the invoice that already exists, so a retried create never charges twice. References are scoped by mode: the same `reference` under a test key and a live key makes two separate invoices. ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `x-intents-affiliate` | header | no | Store plugins: the Affiliate ID from the plugin settings. Links a merchant that nobody referred yet and that has no live payment (affiliate rules); never overwrites and never changes the fee. | ## Body parameters | Field | Type | Required | Notes | |---|---|---|---| | `amount` | string | yes | Price in the invoice currency, e.g. "49.00" | | `currency` | `USD` | no | | | `settlement` | object | no | Choose between the merchant's registered settlement targets. API keys cannot introduce a new address (§8.3). | | `settlement.asset` | string | yes | | | `settlement.address` | string | yes | | | `reference` | string | no | The merchant's own ID. Unique per merchant and mode, and the idempotency key. | | `description` | string | no | | | `customerEmail` | string | no | | | `successUrl` | string | no | | | `cancelUrl` | string | no | | | `expiresInSec` | integer | no | | | `metadata` | object | no | | ## Responses | Status | Means | |---|---| | `200` | An invoice with this `reference` already exists in this mode; it is returned unchanged | | `201` | Invoice created. `clientSecret` is shown only here. | ## Request ```bash title="curl" curl https://api.intents.fi/v0/invoices \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'x-intents-affiliate: ' \ -H 'content-type: application/json' \ -d '{ "amount": "49.00", "settlement": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "address": "0x6A3fB91c7D8e45A2b0C1fE97D3a8B52c4e7F10dA" }, "reference": "order_1042", "description": "Pro plan — 1 month", "customerEmail": "ana@example.com", "successUrl": "https://northwood.example/thanks" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/invoices", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "amount": "49.00", "settlement": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "address": "0x6A3fB91c7D8e45A2b0C1fE97D3a8B52c4e7F10dA" }, "reference": "order_1042", "description": "Pro plan — 1 month", "customerEmail": "ana@example.com", "successUrl": "https://northwood.example/thanks" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/invoices", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "amount": "49.00", "settlement": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "address": "0x6A3fB91c7D8e45A2b0C1fE97D3a8B52c4e7F10dA" }, "reference": "order_1042", "description": "Pro plan — 1 month", "customerEmail": "ana@example.com", "successUrl": "https://northwood.example/thanks" }, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Cancel an invoice — https://intents.fi/docs/api/post-invoices-id-cancel ================================================================================================ `POST /v0/invoices/{id}/cancel` Only while `open` or `underpaid`. An invoice with a payment in flight is never canceled, so no customer pays an invoice we have written off. ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ## Responses | Status | Means | |---|---| | `200` | The canceled invoice | ## Request ```bash title="curl" curl https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw/cancel \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw/cancel", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw/cancel", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # One visit to a payment link: an invoice at the link's price, or the customer's amount — https://intents.fi/docs/api/post-links-id-invoices ================================================================================================ `POST /v0/links/{id}/invoices` Takes the merchant's publishable key (pk_), or no key: the link ID is its capability, and a link can only create the invoice the merchant priced, or, on a `custom` link, one at an amount the customer chose inside the merchant's bounds. A key must match the link's account and mode. Body (optional JSON, schema `PaymentLinkInvoiceRequest`): `quantity`, `amount` (custom links, required there), `customerEmail`. ## Authentication None. The payment link's ID is the capability, so this runs in a customer's browser with no key at all. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ## Responses | Status | Means | |---|---| | `201` | Created; send the customer to `url` | | `400` | A bad quantity or amount, or a key from the other mode | | `404` | Unknown or off | | `422` | AMOUNT_OUT_OF_RANGE: outside the link's minimum and maximum | | `429` | Too many from this IP, or on this custom-amount link | ## Request ```bash title="curl" curl https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo/invoices \ -X POST ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo/invoices", { method: "POST", }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.post( "https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo/invoices", ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Create an order — https://intents.fi/docs/api/post-orders ================================================================================================ `POST /v0/orders` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Body parameters | Field | Type | Required | Notes | |---|---|---|---| | `quoteId` | string | yes | | | `driftToleranceBps` | integer | no | | ## Responses | Status | Means | |---|---| | `200` | Existing order for this quote | | `201` | Order created | ## Request ```bash title="curl" curl https://api.intents.fi/v0/orders \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "quoteId": "" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/orders", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "quoteId": "" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/orders", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "quoteId": "" }, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Submit an order's transaction — https://intents.fi/docs/api/post-orders-id-submit ================================================================================================ `POST /v0/orders/{id}/submit` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ## Body parameters | Field | Type | Required | Notes | |---|---|---|---| | `txHash` | string | no | | | `signature` | string | no | | | `chain` | string | no | | ## Responses | Status | Means | |---|---| | `200` | Submission recorded | ## Request ```bash title="curl" curl https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4" }, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Request quotes — https://intents.fi/docs/api/post-quotes ================================================================================================ `POST /v0/quotes` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Body parameters | Field | Type | Required | Notes | |---|---|---|---| | `tradeType` | `EXACT_INPUT` \| `EXACT_OUTPUT` | no | | | `from` | object | yes | | | `from.asset` | string | yes | | | `from.amount` | string | no | | | `to` | object | yes | | | `to.asset` | string | yes | | | `to.amount` | string | no | | | `sender` | string | yes | | | `recipient` | string | yes | | | `refundTo` | string | no | | | `slippageBps` | object | no | | | `providers` | array | no | | | `excludeProviders` | array | no | | | `rank` | `output` \| `speed` \| `balanced` | no | | | `executionModes` | array | no | | | `timeoutMs` | integer | no | | ## Responses | Status | Means | |---|---| | `200` | Ranked quotes from every provider that answered in time | ## Request ```bash title="curl" curl https://api.intents.fi/v0/quotes \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "from": { "asset": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831", "amount": "100000000" }, "to": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" }, "sender": "0x15AAB9098125C5A728CA818B31620a902C25f764", "recipient": "0x9b3c1f4A6D2E5b70CA18F4D3e9B2A7C641FD8E05", "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/quotes", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "from": { "asset": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831", "amount": "100000000" }, "to": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" }, "sender": "0x15AAB9098125C5A728CA818B31620a902C25f764", "recipient": "0x9b3c1f4A6D2E5b70CA18F4D3e9B2A7C641FD8E05", "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/quotes", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "from": { "asset": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831", "amount": "100000000" }, "to": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" }, "sender": "0x15AAB9098125C5A728CA818B31620a902C25f764", "recipient": "0x9b3c1f4A6D2E5b70CA18F4D3e9B2A7C641FD8E05", "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764" }, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Register a webhook — https://intents.fi/docs/api/post-webhooks ================================================================================================ `POST /v0/webhooks` ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Body parameters | Field | Type | Required | Notes | |---|---|---|---| | `url` | string | yes | | | `events` | array | no | Event types to deliver. Checkout merchants subscribe to `invoice.*`; they never receive `order.updated` for a payment attempt's order (SPEC-checkout §4.4). | ## Responses | Status | Means | |---|---| | `201` | Webhook registered. The signing secret is returned only here. | ## Request ```bash title="curl" curl https://api.intents.fi/v0/webhooks \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "url": "https://northwood.example/hooks/intents" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "url": "https://northwood.example/hooks/intents" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/webhooks", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "url": "https://northwood.example/hooks/intents" }, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Send a signed test event to the endpoint now (test keys only) — https://intents.fi/docs/api/post-webhooks-id-test ================================================================================================ `POST /v0/webhooks/{id}/test` Delivers one test event, signed with the endpoint's real secret, outside the retry queue. `type` picks the event (default `invoice.paid`): its `data` is a sample test-mode invoice that does not exist, and the envelope carries `sample: true`. `webhook.test` sends a ping with no invoice. Test (`ik_test_`) keys only: a live key gets `TEST_MODE_ONLY`. The response carries the request body and the endpoint's answer (truncated to 2 KB), whatever it was. ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Parameters | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ## Body parameters | Field | Type | Required | Notes | |---|---|---|---| | `type` | `webhook.test` \| `invoice.processing` \| `invoice.underpaid` \| `invoice.paid` \| `invoice.expired` \| `invoice.canceled` \| `invoice.needs_review` | no | Default `invoice.paid`. | ## Responses | Status | Means | |---|---| | `200` | Sent, whether or not the endpoint accepted it: see `delivered`. | ## Request ```bash title="curl" curl https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw/test \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw/test", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw/test", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Set the USDC payout wallet; a change after the first needs a step-up code — https://intents.fi/docs/api/put-affiliate-payout-wallet ================================================================================================ `PUT /v0/affiliate/payout-wallet` The first wallet takes effect at once. Every later change needs `stepUpCode` (purpose `affiliate_payout_wallet`). A wallet changed less than 24 hours before a payout run is skipped that month. ## Authentication A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it. ## Responses | Status | Means | |---|---| | `200` | Saved | | `400` | INVALID_REQUEST: bad checksum, unsupported chain or a known exchange address | | `401` | No valid dashboard session | | `403` | SESSION_REQUIRED, STEP_UP_REQUIRED, AFFILIATE_SUSPENDED or AFFILIATE_CLOSED | | `404` | AFFILIATE_REQUIRED: this user has no affiliate profile | ## Request ```bash title="curl" curl https://api.intents.fi/v0/affiliate/payout-wallet \ -X PUT \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/affiliate/payout-wallet", { method: "PUT", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.put( "https://api.intents.fi/v0/affiliate/payout-wallet", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` ## Errors ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api). ================================================================================================ # Add crypto to your existing checkout — https://intents.fi/docs/checkout/add-crypto ================================================================================================ Your checkout already takes cards, maybe PayPal. This adds one more option, **Pay with crypto**, without replacing anything: your customer picks it from your own list, pays in a pop-up with whatever token they hold, and you receive a USD stablecoin or native Bitcoin at your own address. Four steps, and the last one is the only one that ships anything: 1. **Show the option** beside your other payment methods. 2. **Create the invoice on your server** when the order is placed. 3. **Open the pop-up** (or mount the checkout inline) with that invoice. 4. **Fulfil on the `invoice.paid` webhook.** Only there. Complete, runnable versions: [Next.js](/docs/checkout/examples/nextjs), [Express](/docs/checkout/examples/express), [plain PHP](/docs/checkout/examples/php). ## 1. Show the option React: ```tsx import { PaymentMethodOption } from "@intents-fi/react"; setMethod("crypto")} /> ``` Any other site: load `https://pay.intents.fi/v1/option.css` and paste the row's markup. Both are on [the "Pay with crypto" option](/docs/checkout/payment-option); the logos are in the [logo pack](/docs/checkout/logo-pack). Selecting the row takes no payment: it only records the customer's choice, like your Card row does. ## 2. Create the invoice on your server When the order is placed with crypto selected, your server creates an invoice for that order. ```ts import { createInvoice } from "@intents-fi/sdk"; const invoice = await createInvoice({ amount: order.total, reference: order.id }); // → { id, clientSecret, url, … }: send id and clientSecret to the page ``` - The **amount comes from your records**, in USD, never from the browser. - **`reference` is your order id.** Creating twice for the same order (a retry, a double click) returns the same invoice, so a customer is never asked to pay twice. - Use a secret key (`ik_test_…` while you build). It never reaches the browser. PHP shops use [intents-php](/docs/platform/server-sdk-php): `$intents->createInvoice(['amount' => '42.00', 'reference' => $orderId])`. ## 3. Open the pop-up ```tsx // React router.push("/thanks")} /> ``` ```html ``` To keep the checkout on your page instead of a pop-up, mount `` or pass `container` to `IntentsCheckout.open()`. See the [embedded widget](/docs/checkout/widget). The customer sees the price first, then picks a token and network, and gets the exact amount, the address, a QR code, a countdown and a refund address field. `onPaid` is for **your page**: close the pop-up, show a thank-you. It is not proof of payment. Anyone can call it from the browser console. ## 4. Fulfil on the webhook Add a webhook endpoint in the dashboard (**Webhooks**, for `invoice.paid`), and ship from it: ```ts import { isTestEvent, verifyWebhook, WebhookSignatureError } from "@intents-fi/sdk"; export async function POST(request: Request) { try { const event = await verifyWebhook(await request.text(), request.headers, process.env.INTENTS_WEBHOOK_SECRET); if (event.type === "invoice.paid" && !isTestEvent(event)) await markPaid(event.data.reference); return new Response(null, { status: 204 }); } catch (e) { if (e instanceof WebhookSignatureError) return new Response("bad signature", { status: 400 }); throw e; } } ``` - Verify over the **raw body**. In Express, mount `express.raw()` on this route. - `markPaid` must be **safe to run twice**: the same event can arrive again. - Events can arrive **out of order**: act on `event.data.status`. [Verify and test webhooks](/docs/platform/verify-webhooks) covers each of these, and how to try your receiver with **Send test event** and **Resend**. ## Before you go live - Run the whole flow with test keys: test mode moves no money. - **Send test event** from the dashboard: your receiver answers 2xx and ships nothing. - **Resend** a real delivery: the order is still shipped once. - Then swap in live keys once your account is live (the dashboard's go-live checklist). Using Stripe? A guide to listing "Pay with crypto" inside Stripe's Payment Element is coming. ================================================================================================ # Paying as an agent — https://intents.fi/docs/checkout/agents ================================================================================================ ```bash # 1. Ask what the invoice accepts. No body, no key, no client secret. curl -s -X POST https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent # → 402 Payment Required # 2. Pick an asset from accepts[] and ask for a deposit address. curl -s -X POST https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent \ -H 'content-type: application/json' \ -d '{"asset":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501","mode":"transfer","refundTo":"7mQ4pVxLdR2nKjYb9sWcTfA6uZgE3hN8rJpXvB5qDkMt"}' # → 201, with display.address and display.amountBaseUnits # 3. Send exactly display.amountBaseUnits to display.address, then poll until invoiceStatus is "paid". curl -s https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/pat_9bRm3TyKwE7cNfLv ``` An agent that pays on someone's behalf needs only the invoice ID: the same ID that's in the hosted page's URL. The invoice, the order behind it and the webhooks are the same as for a customer paying on the page. The merchant can tell the difference: the attempt, the invoice and every invoice webhook carry `channel: "agent"`. ## The 402 A call with no body creates nothing. It answers `402 Payment Required` with the invoice and, in `accepts[]`, every asset it can be paid with, x402-style: ```json { "x402Version": 1, "error": "Payment required", "resource": "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent", "invoice": { "id": "inv_3QkR7mVt9zLpXdB2hJn6Yw", "status": "open", "amount": "49.00", "currency": "USD", "merchant": "Northwood Supply", "description": "Pro plan — 1 month", "expiresAt": "2026-11-19T10:30:00.000Z" }, "accepts": [ { "scheme": "intents-deposit", "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp", "asset": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501", "symbol": "SOL", "decimals": 9, "chain": "Solana", "maxAmountRequired": "331250000", "amountInUsd": "49.27", "modes": ["wallet", "transfer"], "maxTimeoutSeconds": 30 } ], "next": { "method": "POST", "url": "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent", "body": { "asset": "one of accepts[].asset", "mode": "transfer", "refundTo": "your address on that asset's chain" }, "instructions": "Send exactly display.amountBaseUnits of the asset to display.address …" } } ``` `maxAmountRequired` is the all-in amount in base units, and it's **indicative**: the quote is cached for `maxTimeoutSeconds`. The binding amount comes back with the deposit address, so always send `display.amountBaseUnits` from step 2, never the 402's number. `scheme` is `intents-deposit`, not x402's `exact`: you pay a deposit address with an ordinary transfer, and there's no EIP-3009 authorization to sign. ## Paying Call it again with a body, as for [`POST …/attempts`](/docs/checkout/headless/): - `transfer` mode needs `refundTo`, an address on the asset's own chain. If the payment fails, it's returned there and nowhere else. - `wallet` mode needs `payer`, and the response carries `execution.steps` to sign instead of an address. Send exactly `display.amountBaseUnits` to `display.address`, and include `display.memo` when it's set: without the memo, the payment is lost. Then poll `GET /v0/checkout/{id}/attempts/{attemptId}` every few seconds until `invoiceStatus` is `paid`. Sending less leaves the attempt `underpaid` with `amountRemaining` set; top up the same address. A failed payment arrives at `refundTo` minus network costs. ## Limits No client secret is needed: the invoice ID is the capability, as it is for the hosted page. The attempt limits are the same as for every other surface, per invoice and per IP. A new attempt replaces the invoice's previous one, so an agent and a person shouldn't pay the same invoice at once. A test-mode invoice (`ik_test_` key) works here too, but has no deposit address. Complete it with `POST …/attempts/{id}/submit`, which needs the invoice's client secret. #### Pay an invoice as an agent, with no UI `POST /v0/checkout/{invoiceId}/agent` For software that pays on someone's behalf (§12 C3). Call it with **no body** and it answers `402 Payment Required`, x402-style: the invoice, and in `accepts[]` every asset it can be paid with and the indicative all-in amount for each. Nothing is created. Call it again with `{ "asset", "mode": "transfer", "refundTo" }` and it creates a payment attempt, exactly like `POST …/attempts`, tagged `channel: "agent"`. The response carries the deposit address and the binding amount in `display`. Send exactly that amount, then poll `GET …/attempts/{id}` until `invoiceStatus` is `paid`. The merchant gets the same webhooks as for any other payment. No client secret is needed: the invoice ID is the capability, as it is for the hosted page (§11.10), and the same per-invoice and per-IP attempt limits apply. | Parameter | In | Required | Notes | |---|---|---|---| | `invoiceId` | path | yes | | ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent \ -X POST \ -H 'x-client-secret: $CLIENT_SECRET' \ -H 'content-type: application/json' \ -d '{ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent", { method: "POST", headers: { "x-client-secret": clientSecret, "content-type": "application/json", }, body: JSON.stringify({ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.post( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent", headers={"x-client-secret": client_secret}, json={ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `201` | The attempt, with the deposit address (transfer) or the steps (wallet) | | `402` | Payment required: the invoice and what it accepts | ================================================================================================ # Appearance — https://intents.fi/docs/checkout/appearance ================================================================================================ The checkout can look like your store at three levels, and the customer-safety elements are the same at all of them: 1. **Branding**, set once in the dashboard at [dashboard.intents.fi/branding](https://dashboard.intents.fi/branding): your name, logo, colours, font, corner radius and a few button labels. It applies everywhere, the hosted page included. 2. **`appearance`**, passed in code to ``, `` or `checkout.js` ([Embedded widget](/docs/checkout/widget)). It is layered over your branding for that one page. 3. **Headless**: your own UI, with the safety elements rendered by you ([Headless checkout](/docs/checkout/headless)). Each layer is checked before it is used. A value that would make the checkout hard to read falls back to the layer under it, never to nothing, and the reason is reported: in the dashboard for branding, as a console warning for `appearance`. **The checkout is light only.** One merchant accent cannot be readable on both a light and a dark background, so there is no dark or automatic theme: set light backgrounds and dark text. ## The `appearance` object ```ts type Appearance = { theme?: "light"; // the only value; anything else is ignored variables?: { colorBackground?: string; colorText?: string; colorAccent?: string; colorButton?: string; colorButtonText?: string; fontFamily?: string; fontUrl?: string; borderRadius?: number | string; spacingUnit?: number | string; }; rules?: Record>; }; ``` The same object works in all three embeds. `checkout.js` hands it to the frame over `postMessage`. ## Variables | Variable | What it sets | Checked | |---|---|---| | `colorBackground` | the page | with `colorText`: text must be at least 4.5:1 on it | | `colorText` | body text. Muted text is derived from it, only as far as 4.5:1 allows | with `colorBackground` | | `colorAccent` | links and highlights | at least 4.5:1 on the background, or the text colour is used | | `colorButton` | the primary button | with `colorButtonText`: at least 4.5:1 | | `colorButtonText` | the primary button's label | with `colorButton` | | `fontFamily` | the body font: one of the supported Google Fonts below | an unlisted family is dropped | | `fontUrl` | your own font, as an `https:` URL to a `.woff2` file. Wins over `fontFamily` | anything else is dropped | | `borderRadius` | corners, in px (`12` or `"12px"`), 0 to 24 | capped at 24 | | `spacingUnit` | the spacing base, in px, 2 to 8. The default is 4 | outside the range, the default is used | Colours are checked in pairs: set a dark `colorBackground` without a `colorText` and the pair is checked against the text colour underneath, so dark text on a dark page is refused rather than shipped. Changing the page colours also inverts the default button to match, unless you set the button colours yourself. Addresses, amounts and transaction references are always in a monospaced face, whatever font you choose, so every character can be checked. **Supported Google Fonts:** Newsreader, Source Serif 4, Literata, Lora, Merriweather, EB Garamond, Fraunces, Inter, IBM Plex Sans, Work Sans, Manrope, DM Sans, Nunito Sans, Rubik, Space Grotesk. Each has lining numerals and reads at 13 px, which the amount and the address captions need. ## Rules `rules` restyles single elements, keyed by a stable class name: ```ts rules: { ".ifc-Button": { borderRadius: "999px", textTransform: "uppercase" }, ".ifc-Button:hover": { backgroundColor: "#2B4562" }, ".ifc-Option": { borderWidth: 2 }, ".ifc-Amount": { fontWeight: 500 }, } ``` A rule is your CSS running next to a customer's money, so it is compiled, never passed through: - **Selectors** are one `.ifc-*` class from the list below, optionally with a `--modifier`, optionally with one state: `:hover`, `:focus`, `:focus-visible`, `:disabled` or `::placeholder`. No descendant, sibling or attribute selectors, so a rule cannot reach outside the checkout. - **Properties** may be written in camelCase or kebab-case, from this list only: `color`, `background-color`, `border`, `border-color`, `border-style`, `border-width`, `border-top`, `border-bottom`, `border-left`, `border-right`, `border-radius`, `box-shadow`, `outline-color`, `font-family`, `font-size`, `font-style`, `font-weight`, `letter-spacing`, `line-height`, `text-align`, `text-decoration`, `text-transform`, `padding` (and its four sides), `transition`. A bare number on a length property is read as px. - **Values** cannot open a block, end a declaration, load a URL (`url(…)`, `@import`) or run an expression, and are at most 200 characters. Some values are refused because they would make the payment hard to read or push it off a phone screen: | Refused | Why | |---|---| | `display`, `visibility`, `opacity`, `position`, `transform`, `width`, `height`, `margin`, `clip-path`, `content`, and every other property not listed | they hide, move, clip or shrink an element | | `outline`, `outline-offset` (only `outline-color` is allowed) | a wide outline paints over everything, the address included | | `font-size` under 12 px (in px, rem or em) | an amount or an address must be readable on a phone | | `padding` over 48 px | it pushes the safety elements off a 375 px screen | | `line-height` under 1 | lines of text would overlap | | `letter-spacing` beyond ±0.25em (or ±4 px) | characters of an address run together or apart | | `font-family` on `.ifc-Mono`, `.ifc-AmountExact`, `.ifc-AddressValue` | they stay monospaced, so an address can be checked character by character | | `color` / `background-color` under 4.5:1 against what the element sits on | the same contrast bar as the theme | A refused rule or declaration is dropped with a warning; the rest of your rules still apply. ## Class names These are the public contract: renaming one would break your rules, so they do not change. The list is `IFC_CLASSES`, exported from `@intents-fi/react`. | Class | Element | |---|---| | `.ifc-Root` | the checkout's outer element (a rule on it targets the checkout as a whole) | | `.ifc-Page`, `.ifc-Sheet`, `.ifc-ModalSheet` | the page, the card the checkout sits on, the `` sheet | | `.ifc-Merchant` | your name and logo | | `.ifc-Amount` | the price, in USD, at the top | | `.ifc-Title`, `.ifc-H3`, `.ifc-Body`, `.ifc-Small`, `.ifc-Caption`, `.ifc-Muted` | text styles | | `.ifc-Mono` | monospaced text: references and hashes | | `.ifc-Rule` | a dividing line | | `.ifc-Button` | every button | | `.ifc-Field`, `.ifc-Label`, `.ifc-Input`, `.ifc-Error` | form fields, their labels, inputs and errors | | `.ifc-Notice`, `.ifc-Pill` | a notice box, a status pill | | `.ifc-OptionList`, `.ifc-Option`, `.ifc-OptionMain`, `.ifc-OptionSide` | the "pay with" list, one row of it, and the row's two sides | | `.ifc-Address` | a copyable row: the exact amount or the deposit address, with its copy button | | `.ifc-AmountExact` | the exact amount to send, inside its row | | `.ifc-AddressValue` | the deposit address, inside its row | | `.ifc-Qr`, `.ifc-QrFrame` | the QR code and its frame | | `.ifc-Stepper`, `.ifc-Step`, `.ifc-StepMark`, `.ifc-StepLabel`, `.ifc-Check` | the progress steps after paying | | `.ifc-Breakdown` | the price breakdown, network fee included | | `.ifc-ChainWarning` | the network warning | | `.ifc-Countdown` | the expiry countdown | | `.ifc-RefundField` | the refund address field | | `.ifc-Footer` | the footer: "Powered by intents.fi" and the support email | ## What cannot be hidden Whatever you set, the customer always sees: - the **exact amount** to send, - the **network warning** ("Send USDT on TRON only."), - the **deposit address and its QR code**, - the **expiry countdown**, - the **refund address field**, - and the **Powered by intents.fi** line. No variable or rule can remove, hide, cover or shrink them: the properties that could are not on the list. In a [headless](/docs/checkout/headless) checkout you render the safety elements yourself, and `assertRequiredRendered` checks that you did. ## Dashboard branding The branding page sets the same things for every checkout of yours: display name, logo (an `https:` image), accent, background, text, muted text, surface and button colours, the font (one of the Google Fonts above, or an uploaded `.woff2`), the corner radius and the support email shown in the footer. It refuses a colour pair under 4.5:1 before saving, and the checkout checks again when it renders. It also takes a few **copy overrides**: the labels a merchant has a reason to change. | Key | Longest | What it replaces | |---|---|---| | `connectWallet` | 40 | **Connect wallet** | | `payAnotherWay` | 60 | **Pay from an exchange or another wallet** | | `getAddress` | 60 | **Show me where to send it** | | `paidTitle` | 40 | the paid screen's heading | | `successMessage` | 280 | nothing by default: an extra message on the paid screen | | `returnButton` | 60 | **Return to {merchant}** | An override is plain text. The safety wording (the network warning, "send exactly", the refund address explanation) cannot be overridden, and an override that uses words a customer should not have to know ("bridge", "gas", "slippage" and the like) is refused with a warning. ================================================================================================ # Base44 — https://intents.fi/docs/checkout/base44 ================================================================================================ Base44's payment menu offers its own providers only, so Intents Checkout goes in as three **backend functions** that call the API with your secret key. Your app needs a Base44 plan that includes backend functions. The customer pays on the intents.fi hosted page, in any supported token on any supported chain, and you receive USDC or USDT in your own wallet. | Function | What it does | |---|---| | `intentsCreatePayment` | Creates an invoice for an order from the order's own total and returns the payment page URL | | `intentsWebhook` | Receives signed `invoice.*` webhooks and updates the order. The only thing that marks it paid | | `intentsSyncPayment` | Asks the API for the order's payment, for the page the customer comes back to | ## Set it up 1. In [the dashboard](https://dashboard.intents.fi), check your [settlement](/docs/checkout/settlement) asset and address, and copy your **test** API key (`ik_test_…`). 2. In the Base44 editor, **Dashboard → Secrets → Add Secret**: `INTENTS_SECRET_KEY`, the test key. 3. Paste the prompt below into the Base44 AI chat. It adds the payment fields to your `Order` entity, the three functions, a **Pay with crypto** button and a confirmation page. If your order entity or its total field has another name, say so in the chat; the names are constants at the top of each function. 4. Publish the app, then add a webhook endpoint for your test key, subscribed to the `invoice.*` events, at `https:///functions/intentsWebhook`, on the dashboard's **Webhooks** page or with the API: ```bash title="curl" curl https://api.intents.fi/v0/webhooks \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "url": "https://northwood.example/hooks/intents" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "url": "https://northwood.example/hooks/intents" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/webhooks", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "url": "https://northwood.example/hooks/intents" }, ) response.raise_for_status() data = response.json() ``` 5. Add the `whsec_…` secret it returns as a second Base44 secret, `INTENTS_WEBHOOK_SECRET`. 6. Place an order and press **Pay with crypto**. A test invoice's hosted page has a **Complete the test payment** button. Press it, and you come back to the confirmation page with the order marked **paid**. **Go live** once your account is reviewed: replace `INTENTS_SECRET_KEY` with your `ik_live_` key, add the same webhook URL for the live key, and replace `INTENTS_WEBHOOK_SECRET` with the live endpoint's secret. Test and live payments never share a reference, so an order started in test mode gets a new live payment. ## The prompt ````text Add crypto payments to this app with Intents Checkout. Use exactly the code below; do not rewrite the payment logic. 1. Order entity: add these fields (keep the existing ones). If orders live in an entity with another name, or the total is in another field, change ORDER_ENTITY and AMOUNT_FIELD at the top of the shared block in all three functions, identically (and DESCRIPTION_FIELD, the order's title, in intentsCreatePayment). - total_usd: number (the order total in USD) — skip if the order already has a USD total - payment_status: string, default "unpaid" (unpaid, awaiting_payment, payment_processing, payment_expired, needs_review, paid) - intents_invoice_id: string - intents_mode: string - intents_attempt: number - intents_paid_invoice_id: string - paid_at: string (date-time) Only backend functions may set payment_status and the intents_* fields. Never set them from the frontend. 2. Backend functions, each in its own file, exactly as written: base44/functions/intentsCreatePayment/entry.ts ```ts import { createClientFromRequest } from "npm:@base44/sdk"; /** * intentsCreatePayment: a Base44 backend function. Starts a crypto payment for one order and * returns the intents.fi hosted payment page to send the customer to. * * Frontend: * const { data } = await base44.functions.invoke("intentsCreatePayment", { orderId, returnPath: "/order-confirmation" }); * window.location.href = data.url; * * The price is read from the order record here, on the server, never from the request: a customer * can send any body they like. Secrets (Dashboard → Secrets): INTENTS_SECRET_KEY (ik_test_… first, * ik_live_… once your account is live). Optional: APP_URL, your app's public https address. */ const API = Deno.env.get("INTENTS_API_URL") ?? "https://api.intents.fi"; const DESCRIPTION_FIELD = "title"; // optional; shown on the payment page const PAYABLE = new Set(["open", "processing", "underpaid"]); async function intents(method: string, path: string, key: string, body?: unknown): Promise { const res = await fetch(`${API}${path}`, { method, headers: { authorization: `Bearer ${key}`, "content-type": "application/json" }, body: body === undefined ? undefined : JSON.stringify(body), }); const json = await res.json().catch(() => ({})); if (!res.ok) throw new Error(json?.error?.message ?? `intents.fi ${method} ${path}: ${res.status}`); return json as T; } // --- intents.fi shared block: identical in all three functions --- // Change these if your order entity or its fields have other names. const ORDER_ENTITY = "Order"; const AMOUNT_FIELD = "total_usd"; // the order total in USD, e.g. 49 or "49.00" type Invoice = { id: string; status: string; mode: string; amount: string; url: string; needsReview?: boolean; metadata?: Record; }; type OrderRecord = Record & { id: string }; type Orders = { update(id: string, data: Record): Promise }; /** "49", 49 or 49.5 → "49.00" / "49.50"; anything else → null. */ function usd(value: unknown): string | null { const s = typeof value === "number" ? value.toFixed(2) : String(value ?? "").trim(); if (!/^\d{1,15}(\.\d{1,2})?$/.test(s) || Number(s) <= 0) return null; const [whole, cents = ""] = s.split("."); return `${whole}.${cents.padEnd(2, "0")}`; } /** * Write what an intents.fi invoice says onto its order. The only place an order becomes paid. * `invoice` is the API's own invoice (a verified webhook's `data`, or GET /v0/invoices/{id}). * Safe to call any number of times, in any order: a paid order is never changed again. */ async function applyInvoice(orders: Orders, order: OrderRecord, invoice: Invoice): Promise { if (order.payment_status === "paid") return "paid"; if (invoice.metadata?.base44_order_id !== order.id || invoice.mode !== order.intents_mode) { return String(order.payment_status ?? "unpaid"); // not this order's payment } const current = invoice.id === order.intents_invoice_id; let next: Record | null = null; if (invoice.status === "paid") { // Paid on the order's current payment, for the order's current total: paid. Anything else // (a replaced payment, a changed total) is real money a person must look at. next = current && invoice.amount === usd(order[AMOUNT_FIELD]) ? { payment_status: "paid", paid_at: new Date().toISOString(), intents_paid_invoice_id: invoice.id, } : { payment_status: "needs_review", intents_paid_invoice_id: invoice.id }; } else if (!current) { return String(order.payment_status ?? "unpaid"); } else if (invoice.needsReview) { next = { payment_status: "needs_review" }; } else if (invoice.status === "processing" || invoice.status === "underpaid") { next = { payment_status: "payment_processing" }; } else if (invoice.status === "expired" || invoice.status === "canceled") { next = { payment_status: "payment_expired" }; } if (next && next.payment_status !== order.payment_status) await orders.update(order.id, next); return String(next?.payment_status ?? order.payment_status ?? "unpaid"); } // --- end of shared block --- Deno.serve(async (req) => { try { const key = Deno.env.get("INTENTS_SECRET_KEY"); if (!key?.startsWith("ik_test_") && !key?.startsWith("ik_live_")) { return Response.json( { error: "Set the INTENTS_SECRET_KEY secret (ik_test_… or ik_live_…)" }, { status: 500 }, ); } const mode = key.startsWith("ik_live_") ? "live" : "test"; const { orderId, returnPath } = (await req.json().catch(() => ({}))) as { orderId?: string; returnPath?: string; }; if (!orderId) return Response.json({ error: "orderId is required" }, { status: 400 }); const base44 = createClientFromRequest(req); const orders = base44.asServiceRole.entities[ORDER_ENTITY]; const order = (await orders.get(orderId).catch(() => null)) as OrderRecord | null; if (!order) return Response.json({ error: "order not found" }, { status: 404 }); if (order.payment_status === "paid") { return Response.json({ error: "this order is already paid" }, { status: 409 }); } const amount = usd(order[AMOUNT_FIELD]); if (!amount) return Response.json({ error: `order.${AMOUNT_FIELD} is not a USD amount` }, { status: 400 }); // Reuse the order's current payment while it can still be paid, so a double click or a reload // never opens a second one. const sameMode = Boolean(order.intents_invoice_id) && order.intents_mode === mode; if (sameMode) { const id = encodeURIComponent(String(order.intents_invoice_id)); const current = await intents("GET", `/v0/invoices/${id}`, key); if (current.status === "paid") { // Paid, but the webhook has not landed yet: record it now and never charge twice. const status = await applyInvoice(orders, order, current); return Response.json( { error: "this order's payment is complete", status }, { status: 409 }, ); } if (PAYABLE.has(current.status) && current.amount === amount) { return Response.json({ url: current.url, invoiceId: current.id }); } if (current.status === "open") { // The total changed since: retire the old payment before opening a new one. await intents("POST", `/v0/invoices/${id}/cancel`, key).catch(() => {}); } else if (PAYABLE.has(current.status)) { return Response.json( { error: "a payment for this order is already on its way" }, { status: 409 }, ); } } // `reference` is the API's idempotency key: one per order and attempt, so a retried request // returns the same invoice, and an expired one is replaced by `-r2`, `-r3`… const attempt = sameMode ? (Number(order.intents_attempt) || 1) + 1 : 1; const reference = `base44-${orderId}${attempt > 1 ? `-r${attempt}` : ""}-${mode}`; const origin = (Deno.env.get("APP_URL") ?? req.headers.get("origin") ?? "").replace(/\/+$/, ""); const path = typeof returnPath === "string" && /^\/(?![/\\])/.test(returnPath) ? returnPath : "/"; const back = /^https:\/\/[^/]+$/.test(origin) ? `${origin}${path}${path.includes("?") ? "&" : "?"}orderId=${encodeURIComponent(orderId)}` : undefined; const invoice = await intents("POST", "/v0/invoices", key, { amount, currency: "USD", reference, description: String(order[DESCRIPTION_FIELD] || `Order ${orderId}`).slice(0, 500), ...(back ? { successUrl: back, cancelUrl: back } : {}), metadata: { base44_order_id: orderId }, }); await orders.update(orderId, { intents_invoice_id: invoice.id, intents_mode: mode, intents_attempt: attempt, payment_status: "awaiting_payment", }); return Response.json({ url: invoice.url, invoiceId: invoice.id }); } catch (error) { return Response.json({ error: (error as Error).message }, { status: 502 }); } }); ``` base44/functions/intentsWebhook/entry.ts ```ts import { createClientFromRequest } from "npm:@base44/sdk"; /** * intentsWebhook: a Base44 backend function, and the URL you register as a webhook endpoint in * the intents.fi dashboard: https:///functions/intentsWebhook, events `invoice.*`. * * It checks the X-Intents-Signature header against the raw body before trusting a byte of it, then * writes the invoice onto its order. Deliveries can repeat and arrive out of order; that is fine. * Secret (Dashboard → Secrets): INTENTS_WEBHOOK_SECRET, the whsec_… shown when you add the endpoint. */ const TOLERANCE_SECONDS = 300; /** `t=,v1=`, within five minutes. */ async function verify(body: string, header: string | null, secret: string): Promise { const parts = Object.fromEntries((header ?? "").split(",").map((p) => p.trim().split("=", 2))); const t = Number(parts.t); const v1 = String(parts.v1 ?? "").toLowerCase(); if (!Number.isInteger(t) || !/^[0-9a-f]{64}$/.test(v1)) return false; if (Math.abs(Date.now() / 1000 - t) > TOLERANCE_SECONDS) return false; const key = await crypto.subtle.importKey( "raw", new TextEncoder().encode(secret), { name: "HMAC", hash: "SHA-256" }, false, ["sign"], ); const mac = new Uint8Array( await crypto.subtle.sign("HMAC", key, new TextEncoder().encode(`${t}.${body}`)), ); const expected = Array.from(mac, (b) => b.toString(16).padStart(2, "0")).join(""); let diff = 0; for (let i = 0; i < expected.length; i++) diff |= expected.charCodeAt(i) ^ v1.charCodeAt(i); return diff === 0; } // --- intents.fi shared block: identical in all three functions --- // Change these if your order entity or its fields have other names. const ORDER_ENTITY = "Order"; const AMOUNT_FIELD = "total_usd"; // the order total in USD, e.g. 49 or "49.00" type Invoice = { id: string; status: string; mode: string; amount: string; url: string; needsReview?: boolean; metadata?: Record; }; type OrderRecord = Record & { id: string }; type Orders = { update(id: string, data: Record): Promise }; /** "49", 49 or 49.5 → "49.00" / "49.50"; anything else → null. */ function usd(value: unknown): string | null { const s = typeof value === "number" ? value.toFixed(2) : String(value ?? "").trim(); if (!/^\d{1,15}(\.\d{1,2})?$/.test(s) || Number(s) <= 0) return null; const [whole, cents = ""] = s.split("."); return `${whole}.${cents.padEnd(2, "0")}`; } /** * Write what an intents.fi invoice says onto its order. The only place an order becomes paid. * `invoice` is the API's own invoice (a verified webhook's `data`, or GET /v0/invoices/{id}). * Safe to call any number of times, in any order: a paid order is never changed again. */ async function applyInvoice(orders: Orders, order: OrderRecord, invoice: Invoice): Promise { if (order.payment_status === "paid") return "paid"; if (invoice.metadata?.base44_order_id !== order.id || invoice.mode !== order.intents_mode) { return String(order.payment_status ?? "unpaid"); // not this order's payment } const current = invoice.id === order.intents_invoice_id; let next: Record | null = null; if (invoice.status === "paid") { // Paid on the order's current payment, for the order's current total: paid. Anything else // (a replaced payment, a changed total) is real money a person must look at. next = current && invoice.amount === usd(order[AMOUNT_FIELD]) ? { payment_status: "paid", paid_at: new Date().toISOString(), intents_paid_invoice_id: invoice.id, } : { payment_status: "needs_review", intents_paid_invoice_id: invoice.id }; } else if (!current) { return String(order.payment_status ?? "unpaid"); } else if (invoice.needsReview) { next = { payment_status: "needs_review" }; } else if (invoice.status === "processing" || invoice.status === "underpaid") { next = { payment_status: "payment_processing" }; } else if (invoice.status === "expired" || invoice.status === "canceled") { next = { payment_status: "payment_expired" }; } if (next && next.payment_status !== order.payment_status) await orders.update(order.id, next); return String(next?.payment_status ?? order.payment_status ?? "unpaid"); } // --- end of shared block --- Deno.serve(async (req) => { const secret = Deno.env.get("INTENTS_WEBHOOK_SECRET"); if (!secret) return Response.json({ error: "Set the INTENTS_WEBHOOK_SECRET secret" }, { status: 500 }); // Read the body as text: the signature covers these exact bytes. const body = await req.text(); if (!(await verify(body, req.headers.get("x-intents-signature"), secret))) { return Response.json({ error: "bad signature" }, { status: 400 }); } const event = JSON.parse(body) as { type?: string; data?: Invoice }; const orderId = event.data?.metadata?.base44_order_id; if (!event.data || typeof orderId !== "string") return new Response(null, { status: 204 }); // not from this app // A webhook has no signed-in user, so the service role reads and writes the order. const base44 = createClientFromRequest(req); const orders = base44.asServiceRole.entities[ORDER_ENTITY]; const order = (await orders.get(orderId).catch(() => null)) as OrderRecord | null; if (!order) return new Response(null, { status: 204 }); // `data.status` is the truth; `type` is only why we were woken. await applyInvoice(orders, order, event.data); return new Response(null, { status: 204 }); }); ``` base44/functions/intentsSyncPayment/entry.ts ```ts import { createClientFromRequest } from "npm:@base44/sdk"; /** * intentsSyncPayment: a Base44 backend function. Asks intents.fi for an order's payment and * writes the answer onto the order. Call it from the page the customer returns to, so the page * is right even before the webhook lands: * const { data } = await base44.functions.invoke("intentsSyncPayment", { orderId }); * // data.payment_status: "paid", "payment_processing", "awaiting_payment", "payment_expired"… * * It reads the invoice from the API with your secret key, so nothing the browser sends can mark an * order paid. Secret: INTENTS_SECRET_KEY, as for intentsCreatePayment. */ const API = Deno.env.get("INTENTS_API_URL") ?? "https://api.intents.fi"; // --- intents.fi shared block: identical in all three functions --- // Change these if your order entity or its fields have other names. const ORDER_ENTITY = "Order"; const AMOUNT_FIELD = "total_usd"; // the order total in USD, e.g. 49 or "49.00" type Invoice = { id: string; status: string; mode: string; amount: string; url: string; needsReview?: boolean; metadata?: Record; }; type OrderRecord = Record & { id: string }; type Orders = { update(id: string, data: Record): Promise }; /** "49", 49 or 49.5 → "49.00" / "49.50"; anything else → null. */ function usd(value: unknown): string | null { const s = typeof value === "number" ? value.toFixed(2) : String(value ?? "").trim(); if (!/^\d{1,15}(\.\d{1,2})?$/.test(s) || Number(s) <= 0) return null; const [whole, cents = ""] = s.split("."); return `${whole}.${cents.padEnd(2, "0")}`; } /** * Write what an intents.fi invoice says onto its order. The only place an order becomes paid. * `invoice` is the API's own invoice (a verified webhook's `data`, or GET /v0/invoices/{id}). * Safe to call any number of times, in any order: a paid order is never changed again. */ async function applyInvoice(orders: Orders, order: OrderRecord, invoice: Invoice): Promise { if (order.payment_status === "paid") return "paid"; if (invoice.metadata?.base44_order_id !== order.id || invoice.mode !== order.intents_mode) { return String(order.payment_status ?? "unpaid"); // not this order's payment } const current = invoice.id === order.intents_invoice_id; let next: Record | null = null; if (invoice.status === "paid") { // Paid on the order's current payment, for the order's current total: paid. Anything else // (a replaced payment, a changed total) is real money a person must look at. next = current && invoice.amount === usd(order[AMOUNT_FIELD]) ? { payment_status: "paid", paid_at: new Date().toISOString(), intents_paid_invoice_id: invoice.id, } : { payment_status: "needs_review", intents_paid_invoice_id: invoice.id }; } else if (!current) { return String(order.payment_status ?? "unpaid"); } else if (invoice.needsReview) { next = { payment_status: "needs_review" }; } else if (invoice.status === "processing" || invoice.status === "underpaid") { next = { payment_status: "payment_processing" }; } else if (invoice.status === "expired" || invoice.status === "canceled") { next = { payment_status: "payment_expired" }; } if (next && next.payment_status !== order.payment_status) await orders.update(order.id, next); return String(next?.payment_status ?? order.payment_status ?? "unpaid"); } // --- end of shared block --- Deno.serve(async (req) => { try { const key = Deno.env.get("INTENTS_SECRET_KEY"); if (!key) return Response.json({ error: "Set the INTENTS_SECRET_KEY secret" }, { status: 500 }); const { orderId } = (await req.json().catch(() => ({}))) as { orderId?: string }; if (!orderId) return Response.json({ error: "orderId is required" }, { status: 400 }); const base44 = createClientFromRequest(req); const orders = base44.asServiceRole.entities[ORDER_ENTITY]; const order = (await orders.get(orderId).catch(() => null)) as OrderRecord | null; if (!order) return Response.json({ error: "order not found" }, { status: 404 }); if (!order.intents_invoice_id || order.payment_status === "paid") { return Response.json({ payment_status: order.payment_status ?? "unpaid" }); } const id = encodeURIComponent(String(order.intents_invoice_id)); const res = await fetch(`${API}/v0/invoices/${id}`, { headers: { authorization: `Bearer ${key}` }, }); if (!res.ok) return Response.json( { error: `intents.fi GET /v0/invoices: ${res.status}` }, { status: 502 }, ); const payment_status = await applyInvoice(orders, order, (await res.json()) as Invoice); return Response.json({ payment_status }); } catch (error) { return Response.json({ error: (error as Error).message }, { status: 502 }); } }); ``` 3. Secrets: INTENTS_SECRET_KEY (ask me for it; it starts with ik_test_) and later INTENTS_WEBHOOK_SECRET (starts with whsec_). 4. Frontend: - On the checkout or order page, a "Pay with crypto" button that creates the order first if it does not exist yet, then runs const { data } = await base44.functions.invoke("intentsCreatePayment", { orderId: order.id, returnPath: "/order-confirmation" }); and sends the browser to data.url. Show data.error if there is one. - An /order-confirmation page that reads orderId from the URL, calls base44.functions.invoke("intentsSyncPayment", { orderId }) on load and every 5 seconds until payment_status is "paid" or "payment_expired", and shows: paid → "Payment received", awaiting_payment or payment_processing → "Waiting for your payment to confirm", payment_expired → "This payment expired" with a "Try again" button that calls intentsCreatePayment again, needs_review → "We're checking your payment". - Treat an order as paid only when payment_status is "paid". ```` ## How a payment runs 1. **Pay with crypto** calls `intentsCreatePayment` with the order ID. The function reads the order's `total_usd` itself, creates an invoice with `reference = base44--test` (or `-live`) and `metadata.base44_order_id`, saves the invoice ID on the order and returns the hosted page URL. A second click while the payment can still be paid returns the same page. 2. The customer pays on the hosted page and comes back to `/order-confirmation?orderId=…`. The return URL is built from your app's own origin (or the optional `APP_URL` secret), never from the request. 3. intents.fi sends signed webhooks to `intentsWebhook`. It checks `X-Intents-Signature` against the raw body (and rejects anything older than five minutes) before it reads a byte, then writes the invoice onto its order. `intentsSyncPayment` writes the same thing from `GET /v0/invoices/{id}`, so the confirmation page is right even before the webhook lands. If an invoice expires or is cancelled, the next **Pay with crypto** creates a new one (`-r2`, then `-r3`). If the order total changed while its invoice was still open, the old invoice is cancelled first. ## What each status means | Invoice | `payment_status` | |---|---| | `open` | `awaiting_payment` | | `processing`, `underpaid` | `payment_processing` | | `paid`, on the order's current invoice, for its current total | `paid`, with `paid_at` | | `paid`, on a replaced invoice or for a different total | `needs_review` | | `needsReview` set | `needs_review` | | `expired`, `canceled` | `payment_expired` | A `paid` order never changes again. Deliveries can repeat and arrive out of order; the functions read `data.status`, not the event type, so a late `invoice.expired` after `invoice.paid` changes nothing. Look at a `needs_review` order in the dashboard and fulfil it by hand if the payment is right. ## Limits - **USD only.** `total_usd` is the price in USD; nothing is converted. - **No refund button.** A failed payment is returned to the customer automatically; refund a completed one from your own wallet. - **Subscriptions** are not covered: each order is one payment. ================================================================================================ # Plugin Connect — https://intents.fi/docs/checkout/connect ================================================================================================ **Connect** links a store plugin to an intents.fi account in a few clicks. The merchant presses **Connect intents.fi** in their store's settings, signs in (or signs up) on the dashboard, approves, and lands back in their store already connected, in test mode, with payment notifications set up. Nobody copies a key. The [WooCommerce plugin](/docs/checkout/woocommerce), the [WHMCS module](/docs/checkout/whmcs), the [PrestaShop module](/docs/checkout/prestashop), the [Magento module](/docs/checkout/magento) and the [OpenCart extension](/docs/checkout/opencart) speak Connect today. The plugin half is a small PHP class with no platform code in it (`plugins/_shared/connect/class-connect-protocol.php`), so other plugins get the same checks as they adopt it. ## What a connection can do The consent screen says it, and the API holds to it: - **Create payments** for the store's orders and read them. - **Get notified** when an order is paid: the plugin registers its own webhook endpoint. - **Use the merchant's logo and colours** on checkout. - It **can't change where the merchant gets paid.** No API key can: a payout wallet changes only from a signed-in dashboard session, with a fresh email code and a 24-hour wait. The key is a normal secret key named for the store (`WooCommerce: shop.example.com`), so it shows on the **API keys** page, and the account's owners get the "New API key created" email. ## Test first, live after go-live A connection made before go-live gets **test-mode keys only**. **Go live** in the plugin runs the same round trip with `mode=live`; the dashboard checks the go-live checklist (a verified email and a payout wallet) and says what is missing. Live keys are issued only once both are done, and the plugin switches to live only when the round trip finishes. Nothing goes live by itself. ## Disconnect From the plugin (**Disconnect**, which calls `POST /v0/connect/revoke` with its own key) or from the dashboard (**Integrations → Connected stores → Disconnect**). Either way the store's keys and the webhooks they registered stop at once. Connecting the same store again replaces the last connection. ## The protocol, for plugin authors It is OAuth 2.0's authorization-code flow with PKCE (S256), with the keys as the result. 1. **Start.** Make a `state` and a `code_verifier` (32 random bytes each, base64url). Keep both on your server, tied to the admin who pressed Connect (never in a cookie or the page). Send the admin's browser to: ```text https://dashboard.intents.fi/connect ?platform=woocommerce &site_url=https://shop.example.com &return_url=https://shop.example.com/wp-admin/admin-post.php?action=intentsfi_connect_return &state=… &code_challenge=BASE64URL(SHA256(code_verifier)) &code_challenge_method=S256 &mode=test ``` `return_url` must have the **same origin** as `site_url` (scheme, host and port), and both must be `https`. Anything else is refused before the consent screen shows. A platform whose admin can live on another origin (Magento) returns to a storefront route that only forwards `code` and `state` to the admin URL it saved when Connect was pressed. 2. **Come back.** After **Connect**, the browser arrives at `return_url?code=…&state=…`. Check `state` is exactly the one you stored for this admin, and spend it. After **Cancel** it arrives with `error=access_denied&state=…` instead. 3. **Exchange**, server to server, within 5 minutes: ```bash title="curl" curl https://api.intents.fi/v0/connect/token \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "code": "", "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", "site_url": "https://shop.northwood.example" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/connect/token", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "code": "", "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", "site_url": "https://shop.northwood.example" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/connect/token", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "code": "", "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", "site_url": "https://shop.northwood.example" }, ) response.raise_for_status() data = response.json() ``` The response carries `secret_key` (`ik_test_…`, or `ik_live_…` after go-live), `publishable_key`, `mode`, the `account` and `merchant`, and the `connection`. Check `mode` is the one you asked for, and store the keys like a password. 4. **Register your webhook** with the new key (`POST /v0/webhooks`, the `invoice.*` events) and store the `whsec_` it returns. A webhook registered with the connection's key is revoked with it. The code is single-use and lives 5 minutes, bound to the store and to your verifier; only its hash is stored. Every exchange spends it, right or wrong, and presenting a spent code revokes the connection it made. Failures are [`CONNECT_CODE_INVALID`](/docs/errors/CONNECT_CODE_INVALID) with a `details.reason`; a live request before go-live is [`LIVE_MODE_LOCKED`](/docs/errors/LIVE_MODE_LOCKED). Nothing secret travels in a URL except the one-time code. Never log the code, the verifier or the keys. ================================================================================================ # Example: Express — https://intents.fi/docs/checkout/examples/express ================================================================================================ One server file and one page. The webhook route takes the **raw** body with `express.raw()`, mounted before `express.json()`, because the signature covers the exact bytes we sent. **Ship the order on the `invoice.paid` webhook**, never on the pop-up's `onPaid`. This is [`examples/checkout-express`](https://github.com/devluke24/intentsfi/tree/main/examples/checkout-express), run in CI against a test key. ```bash npm install @intents-fi/sdk express ``` ```bash # .env # A test key while you build: dashboard.intents.fi → API keys → Test mode. INTENTS_SECRET_KEY=ik_test_... # The whsec_… shown when you added the webhook endpoint (Webhooks → Add an endpoint). INTENTS_WEBHOOK_SECRET=whsec_... ``` ## The server `server.js` ```js import { createInvoice, isTestEvent, verifyWebhook, WebhookSignatureError } from "@intents-fi/sdk"; import express from "express"; // Your order store. Here: memory. markPaid must be safe to call twice for one order. export const orders = new Map([ ["order_1001", { id: "order_1001", amount: "25.00", status: "pending" }], ]); const markPaid = (id) => { const order = orders.get(id); if (!order || order.status === "paid") return; // unknown, or already shipped: do nothing orders.set(id, { ...order, status: "paid" }); console.log(`order ${id} paid: ship it`); // …your fulfilment }; export const app = express(); // 3. The webhook, mounted BEFORE express.json(): verifyWebhook needs the raw bytes (a Buffer). app.post("/webhooks/intents", express.raw({ type: "application/json" }), async (req, res) => { try { const event = await verifyWebhook(req.body, req.headers, process.env.INTENTS_WEBHOOK_SECRET); // Ship only on a real invoice.paid; "Send test event" samples are acknowledged and ignored. if (event.type === "invoice.paid" && !isTestEvent(event)) markPaid(event.data.reference); res.sendStatus(204); // any 2xx; anything else is retried } catch (e) { if (e instanceof WebhookSignatureError) return res.status(400).send("bad signature"); throw e; } }); app.use(express.json()); app.use(express.static(new URL("./public", import.meta.url).pathname)); // 1. "Pay with crypto" + Place order: create the invoice. The amount comes from your records. app.post("/checkout", async (req, res) => { const order = orders.get(req.body.orderId); if (!order) return res.status(404).json({ error: "unknown order" }); const invoice = await createInvoice({ amount: order.amount, reference: order.id }); // reads INTENTS_SECRET_KEY res.json({ invoiceId: invoice.id, clientSecret: invoice.clientSecret }); }); if (process.argv[1] === new URL(import.meta.url).pathname) { app.listen(3600, () => console.log("http://localhost:3600")); } ``` ## The page `public/index.html`: the [Pay with crypto row](/docs/checkout/payment-option) beside your card option, and `IntentsCheckout.open()` when the order is placed. ```html Pay with crypto: Express example

$25.00

``` ## Try it 1. In the dashboard, switch to **Test mode**, create a secret key, and add a webhook endpoint for `invoice.paid` (a tunnel's URL for a local server). 2. `node --env-file=.env server.js`, open http://localhost:3600, pick **Pay with crypto** and pay in the pop-up. Test mode moves no money. 3. **Send test event** delivers a sample that the server acknowledges and ignores; **Resend** on the real delivery leaves the order paid once. ================================================================================================ # Example: Next.js — https://intents.fi/docs/checkout/examples/nextjs ================================================================================================ Three files and an order store. Create the invoice on your server, open the pop-up on your page, and **ship the order on the `invoice.paid` webhook**, never on the pop-up's `onPaid`. This is [`examples/checkout-nextjs`](https://github.com/devluke24/intentsfi/tree/main/examples/checkout-nextjs); CI runs it against a test key on every change, so what is below works as written. ```bash npm install @intents-fi/sdk @intents-fi/react ``` ```bash # .env.local # A test key while you build: dashboard.intents.fi → API keys → Test mode. INTENTS_SECRET_KEY=ik_test_... # The whsec_… shown when you added the webhook endpoint (Webhooks → Add an endpoint). INTENTS_WEBHOOK_SECRET=whsec_... ``` ## 1. Create the invoice `app/api/checkout/route.ts` ```ts import { createInvoice } from "@intents-fi/sdk"; import { orders } from "../../../lib/orders"; // 1. The customer chose "Pay with crypto" and placed the order: create the invoice for it. export async function POST(request: Request) { const { orderId } = (await request.json()) as { orderId: string }; const order = orders.get(orderId); if (!order) return Response.json({ error: "unknown order" }, { status: 404 }); // The amount comes from your own records, never from the browser. `reference` is your order // id: calling this twice for one order returns the same invoice. Reads INTENTS_SECRET_KEY. const invoice = await createInvoice({ amount: order.amount, reference: order.id }); return Response.json({ invoiceId: invoice.id, clientSecret: invoice.clientSecret }); } ``` ## 2. The option and the pop-up `app/page.tsx` ```tsx "use client"; import { PayButton, PaymentMethodOption } from "@intents-fi/react"; import { useState } from "react"; // 2. Your checkout: "Pay with crypto" beside your other methods; placing the order opens the pop-up. export default function Checkout() { const [method, setMethod] = useState("card"); const [invoice, setInvoice] = useState<{ invoiceId: string; clientSecret: string } | null>(null); async function placeOrder() { const res = await fetch("/api/checkout", { method: "POST", body: JSON.stringify({ orderId: "order_1001" }), }); setInvoice(await res.json()); } return (

$25.00

setMethod("crypto")} /> {method === "crypto" && !invoice ? ( ) : null} {invoice ? ( // onPaid only updates this page; the order ships from the webhook. location.assign("/?paid=1")} > Pay $25.00 ) : null}
); } ``` ## 3. Ship on the webhook `app/api/webhooks/intents/route.ts` ```ts import { isTestEvent, verifyWebhook, WebhookSignatureError } from "@intents-fi/sdk"; import { markPaid } from "../../../../lib/orders"; // 3. The only place an order is marked paid: a verified invoice.paid webhook. export async function POST(request: Request) { try { // The raw body: request.text(), never request.json(), or the signature cannot match. const event = await verifyWebhook( await request.text(), request.headers, process.env.INTENTS_WEBHOOK_SECRET, ); // "Send test event" sends samples that were never paid: acknowledge them, ship nothing. if (event.type === "invoice.paid" && !isTestEvent(event) && event.data.reference) { markPaid(event.data.reference, event.data.id); // idempotent: the same event can come twice } return new Response(null, { status: 204 }); // any 2xx; anything else is retried } catch (e) { if (e instanceof WebhookSignatureError) return new Response("bad signature", { status: 400 }); throw e; } } ``` `lib/orders.ts` stands in for your database: ```ts // Your order store. Here: memory. markPaid must be safe to call twice for one order. type Order = { id: string; amount: string; status: "pending" | "paid"; invoiceId?: string }; export const orders = new Map([ ["order_1001", { id: "order_1001", amount: "25.00", status: "pending" }], ]); export function markPaid(orderId: string, invoiceId: string): void { const order = orders.get(orderId); if (!order || order.status === "paid") return; // unknown, or already shipped: do nothing orders.set(orderId, { ...order, status: "paid", invoiceId }); // …ship it, email the customer, etc. } ``` ## Try it 1. In the dashboard, switch to **Test mode**, create a secret key, and add a webhook endpoint for `invoice.paid`. For a local server, register a tunnel's URL (`cloudflared tunnel`, `ngrok`). 2. `npm run dev`, pick **Pay with crypto**, place the order, and pay in the pop-up. Test mode moves no money. 3. **Send test event** in the dashboard delivers a sample `invoice.paid`: the handler answers 204 and ships nothing, because `isTestEvent(event)` is true. **Resend** on the real delivery: the order is still paid once. See [Server helpers](/docs/platform/server-sdk) and [Webhooks](/docs/platform/webhooks). ================================================================================================ # Example: plain PHP — https://intents.fi/docs/checkout/examples/php ================================================================================================ For custom PHP shops, and the shape WHMCS and PrestaShop modules follow. It uses [intents-php](/docs/platform/server-sdk#php-intents-php), one file you copy next to your code. **Ship the order on the `invoice.paid` webhook**, never on the pop-up's `onPaid`. This is [`examples/checkout-php`](https://github.com/devluke24/intentsfi/tree/main/examples/checkout-php), run in CI against a test key. Copy [`intents.php`](https://github.com/devluke24/intentsfi/blob/main/packages/php/intents.php) into the same folder, and set the environment: ```bash # A test key while you build: dashboard.intents.fi → API keys → Test mode. INTENTS_SECRET_KEY=ik_test_... # The whsec_… shown when you added the webhook endpoint (Webhooks → Add an endpoint). INTENTS_WEBHOOK_SECRET=whsec_... ``` ## 1. Create the invoice `checkout.php` ```php createInvoice(['amount' => $order['amount'], 'reference' => $order['id']]); echo json_encode(['invoiceId' => $invoice['id'], 'clientSecret' => $invoice['clientSecret']]); ``` ## 2. Ship on the webhook `webhook.php` ```php ['id' => 'order_1001', 'amount' => '25.00', 'status' => 'pending']]; } function mark_paid(string $id): void { $orders = load_orders(); if (!isset($orders[$id]) || $orders[$id]['status'] === 'paid') return; // already shipped $orders[$id]['status'] = 'paid'; // …and ship it file_put_contents(orders_file(), json_encode($orders), LOCK_EX); } ``` ## 3. The page `index.html` ```html Pay with crypto: PHP example

$25.00

``` ## Try it 1. In the dashboard, switch to **Test mode**, create a secret key, and add a webhook endpoint for `invoice.paid` pointing at `webhook.php` (a tunnel's URL for a local server). 2. `php -S localhost:3700`, open the page, pick **Pay with crypto** and pay in the pop-up. Test mode moves no money. 3. **Send test event** delivers a sample the endpoint acknowledges and ignores; **Resend** on the real delivery leaves the order paid once. ================================================================================================ # Headless checkout — https://intents.fi/docs/checkout/headless ================================================================================================ ```tsx "use client"; import { Qr, useCheckout } from "@intents-fi/react"; import { useRef } from "react"; export function Checkout({ invoiceId, clientSecret }: { invoiceId: string; clientSecret: string }) { const root = useRef(null); // devCheck: in development, every render checks the safety elements are on screen. const c = useCheckout(invoiceId, clientSecret, { devCheck: root }); const { required } = c; if (!c.invoice) return

{c.error ?? "Loading…"}

; return (

${c.invoice.amount}

{required.countdown && (

{required.countdown.label} {required.countdown.text}

)} {c.status === "pay" && ( )} {c.status === "choose" && (
    {(c.options ?? []).map((option) => (
  • ))}
)} {required.amount && (

Send exactly {required.amount.text}

)} {required.chainWarning && (

{required.chainWarning.text} {required.chainWarning.detail}

)} {required.refundField && (
{required.refundField.editable ? ( ) : (

{required.refundField.label}: {required.refundField.value}

)}
)} {required.address && (

To {required.address.address}

)} {required.qr && (
)} {c.status === "send-transfer" && ( )} {c.status === "status" &&

Payment on its way…

} {c.status === "paid" &&

Paid. Thank you.

}
); } ``` You render 100% of the UI; the hook holds the state and the actions. It is the same state machine the hosted page and `` run, calling the same public endpoints, so a headless checkout walks exactly the same states as the hosted one. The example above is the one in `packages/react/examples/next/app/headless`, which a test pays end to end. ## `useCheckout(invoiceId, clientSecret, options)` | Option | What it does | |---|---| | `apiBase` | where the hook calls the API. Defaults to `https://api.intents.fi`, which accepts browser calls from any origin; a same-origin proxy that forwards `/v0/checkout/*` unchanged also works | | `payer` | the customer's address, if you know it: options are ranked by what it holds (below) | | `onPaid(invoice)` | once, when the invoice is paid. For the page; fulfil from the webhook | | `onEvent(event)` | `{ type: "status", status, screen }` as the payment moves, and `{ type: "paid", checkout }` once | | `devCheck` | a ref to the element your checkout renders into. In development, every render runs `assertRequiredRendered` on it and logs any missing safety element by name | ## What the hook returns | Field | What it is | |---|---| | `invoice` | the public view of the invoice: price, merchant, status. `null` until loaded | | `loading`, `error` | loading the invoice, and the last error message | | `status` | the screen the default UI would show: `pay`, `choose`, `send-transfer`, `send-wallet`, `status`, `paid`, `underpaid`, `quote-expired`, `refunded`, `failed`, `dead-end-expired`, `dead-end-canceled` | | `mode` | `"transfer"` (send from an exchange or any wallet) or `"wallet"` (connect and sign) | | `options`, `optionsLoading` | the ranked "pay with" list, `null` until `listOptions()` has loaded it | | `selected` | the option the customer chose | | `attempt` | the active payment attempt, with its exact amount and deposit address | | `busy`, `walletPhase`, `progress` | an action is running; the wallet's phase (`idle`, `connecting`, `running`, `rejected`, `failed`, `submitted`) and its step progress | | `priceChange` | the new amount when the price moved between the list and the attempt (`409 QUOTE_DRIFT`), waiting for the customer's answer | | `required` | the customer-safety elements (below) | | `listOptions(mode?)` | load the "pay with" list for a way of paying | | `select(asset \| option, mode?)` | choose what to pay with. In wallet mode this connects the wallet and starts the attempt; in transfer mode it waits for the refund address and `pay()` | | `setRefundTo(address)` | set the refund address (also `required.refundField.onChange`) | | `pay()` | take the payment as far as this side can: in transfer mode, issue the deposit address; in wallet mode, run the wallet's steps; in test mode, complete the test payment | | `confirmPriceChange()`, `rejectPriceChange()` | answer `priceChange`: go ahead at the new amount, or back to the list | | `requote()` | get a fresh quote after the old one expired (`quote-expired`) | | `restart()` | start over on the same invoice; a new attempt replaces the old one | ## The safety elements you must render `required.keys` lists the elements the current state needs on screen, from `REQUIRED_KEYS`: | Key | What it carries | |---|---| | `amount` | `text` ("49.41 USDT", render it exactly), `amount`, `symbol`, `baseUnits` | | `chainWarning` | `text` ("Send USDT on TRON only."), `detail` (what happens to anything else), `symbol`, `chain` | | `address` | the deposit `address`, and a `memo` to show beside it when there is one | | `qr` | `value`, the payment URI to encode. `` from `@intents-fi/react` draws it | | `countdown` | `text` ("28:14", or "Time is up"), `label`, `expiresAt`, `msLeft`, `expired` | | `refundField` | `value`, `editable`, `onChange`, `valid`, `error`, `label`, `hint` | They are what stops a customer sending the wrong amount, on the wrong network, after the quote has expired, with no way back. Every customisation level shows them; headless is no exception. Each one is `null` when the current state does not need it, and each carries `props`: spread them on the element that shows it (`

`). The text is already formatted from the attempt's own `display`, so there is nothing to work out yourself. `assertRequiredRendered(root, c.required)` checks that every element in `required.keys` is inside `root`, is not hidden (`hidden`, `aria-hidden`, `display: none`, `visibility: hidden`, `opacity: 0`) and shows its value: the amount, the network's name, the full address, a drawn QR (`svg`, `canvas` or `img`), an input for an editable refund field. It throws a `RequiredElementsError` naming each problem; `checkRequiredRendered` returns the same list without throwing. Pass `devCheck` to run it on every render in development, and call it in your go-live test; the `go-live-checklist` [skill](/docs/agents/skills) checks for it too. ## The recommended option Pass the payer's address (the `payer` option, or the connected wallet) and the list is ranked by what they hold: ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/options \ -H 'x-client-secret: $CLIENT_SECRET' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/options", { method: "GET", headers: { "x-client-secret": clientSecret, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.get( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/options", headers={"x-client-secret": client_secret}, ) response.raise_for_status() data = response.json() ``` With `payer`, each option carries `balance` (base units, when it could be read) and `covers` (whether that balance pays the all-in amount). `recommended` is the cheapest option the payer is known to be able to pay with, so a customer holding USDT on Tron gets USDT on Tron preselected, even if another network is a few cents cheaper, and it is listed first. Balances are read on the payer's own network family only (an EVM address on the EVM chains, a Tron address on Tron, a Solana address on Solana), within 800 ms. An option whose balance could not be read shows without one and with `covers: true`: an unreadable balance never hides a way to pay. ## Test mode An invoice made with an `ik_test_` key has no deposit address and nothing to sign, so `required.address` and `required.qr` stay `null`. Tell the customer it is a test (the hosted page says "This is a test payment. No money moves and there is no address to send to.") and let `pay()` complete it: the invoice walks to paid and the real `invoice.paid` webhook fires. ## Without React: the raw API The hook is a thin layer over the public checkout endpoints. A client secret in `x-client-secret` authorises the writes; reads need only the invoice ID. The API answers browser calls to them from any origin. ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts \ -X POST \ -H 'x-client-secret: $CLIENT_SECRET' \ -H 'content-type: application/json' \ -d '{ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts", { method: "POST", headers: { "x-client-secret": clientSecret, "content-type": "application/json", }, body: JSON.stringify({ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.post( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts", headers={"x-client-secret": client_secret}, json={ "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "mode": "wallet", "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D", "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b" }, ) response.raise_for_status() data = response.json() ``` ```bash title="curl" curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw \ -H 'x-client-secret: $CLIENT_SECRET' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw", { method: "GET", headers: { "x-client-secret": clientSecret, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.get( "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw", headers={"x-client-secret": client_secret}, ) response.raise_for_status() data = response.json() ``` The attempt response carries a `display` object with every customer-safety element already formatted (the amount as a decimal string and in base units, the symbol, the network, the deposit address), so a headless client has nothing to format itself. Poll the attempt every two seconds while the page is visible and back off to ten after five minutes. ## Look There is no theme to set: it is your UI. Keep the safety elements legible, with text contrast of at least 4.5:1, and the checkout light. Keep the copy plain: "network fee", never "gas"; "payment", never "intent". ## Server side Headless is only the payment UI. Your server still creates the invoice with [`createInvoice`](/docs/platform/server-sdk) and fulfils on the verified `invoice.paid` webhook ([Verify and test webhooks](/docs/platform/verify-webhooks)), never on a status your page saw. If you are adding crypto beside existing payment methods, start from [Add crypto to your existing checkout](/docs/checkout/add-crypto). ================================================================================================ # Intents Checkout — https://intents.fi/docs/checkout/ ================================================================================================ Intents Checkout gets you paid. You create an **invoice** priced in USD; your customer pays with whatever they hold, on whatever chain they hold it; you receive one asset, a USD stablecoin or native Bitcoin, at your own address. Funds never pass through an Intents wallet, and you're told the invoice is paid by a signed `invoice.paid` webhook. You don't need [Intents Route](/docs/route) for any of this: Intents Checkout finds the route for every payment itself. ## Pick how you integrate Every option below creates the same invoice and fires the same webhooks, so you can start with one and move to another. | You have… | Use | Code | |---|---|---| | No website, or you want to sell something today | [Payment links](/docs/checkout/payment-links) | none | | WooCommerce, WHMCS, Magento, PrestaShop or OpenCart | the plugin for it: [WooCommerce](/docs/checkout/woocommerce), [WHMCS](/docs/checkout/whmcs), [Magento](/docs/checkout/magento), [PrestaShop](/docs/checkout/prestashop), [OpenCart](/docs/checkout/opencart) | none | | A backend that can create an invoice and redirect | the **hosted page**: [quickstart](/docs/checkout/quickstart) | a few lines | | A React or plain-JS front end and want to stay on your page | the [embedded widget](/docs/checkout/widget), themed with [Appearance](/docs/checkout/appearance) | a component | | A fully custom payment UI | [headless checkout](/docs/checkout/headless) | the most | | An AI agent that has to pay an invoice | [paying as an agent](/docs/checkout/agents) | one endpoint | Whichever you choose, the server side is the same three steps: create the invoice, send the customer to it, mark the order paid from the verified webhook. The [quickstart](/docs/checkout/quickstart) does all three by hand, or a coding agent does them for you with the [Intents Checkout setup prompt](/docs/agent-setup/checkout). ## Where the money lands Your payout wallet is one **settlement target**: an asset and an address you control. | Asset | Chains | |---|---| | USDC | Base, Arbitrum, Ethereum, Solana, Polygon | | USDT | Tron, Ethereum, Arbitrum, BNB Smart Chain | | BTC | Bitcoin (native): priced in USD, the BTC amount locked when the invoice is created ([how](/docs/checkout/settlement#settling-in-btc)) | Changing it takes the dashboard, a fresh email code and a 24-hour wait; no API key can do it. See [Settlement](/docs/checkout/settlement). ## Pricing and limits One fee: 0.4% of each completed payment, shown on every invoice as `fee.bps` and `fee.amount`. There is no fixed per-payment fee. | What | Bound | |---|---| | Invoice amount | $1.00 or more, in cents. There is no maximum beyond the format (15 digits before the point) | | Asset minimum | the route's own minimum for that asset; the options list hides assets the invoice doesn't clear | | USDT on Tron | invoices of $100 or more, for now: under that, Send manually shows it disabled with "Minimum $100 on Tron" | An amount outside them fails with [`AMOUNT_OUT_OF_RANGE`](/docs/errors/AMOUNT_OUT_OF_RANGE/). ## Test mode Test mode works as soon as you sign up. Test invoices settle to a placeholder test wallet against recorded fixtures, so no chain is touched, no money moves, and you don't need a wallet of your own yet. Use an `ik_test_` key ([keys](/docs/get-started)). ## Going live Live keys and live invoices open when the checklist on the dashboard home is done: 1. Verify your email. 2. Add your payout wallet. Until then, live calls fail with [`LIVE_MODE_LOCKED`](/docs/errors/LIVE_MODE_LOCKED/). Then swap `ik_test_` for `ik_live_`, register a live webhook endpoint, and pay yourself $5 for real on the chain your customers will use. The full list is in the [quickstart](/docs/checkout/quickstart#going-live). ================================================================================================ # Logo pack — https://intents.fi/docs/checkout/logo-pack ================================================================================================ [Download the logo pack (.zip)](https://pay.intents.fi/v1/brand/intents-fi-logo-pack.zip): the mark, the wordmark, the token strip and the "Pay with crypto" marks, for light and dark backgrounds, as SVG and PNG, each on a transparent background. It is also on the dashboard's **Branding** page. For a "Pay with crypto" option in your own checkout you may not need it: the [ready-made row](/docs/checkout/payment-option) already carries the marks. | File | For | SVG | PNG | |---|---|---|---| | Mark, light backgrounds | app icons, tight spaces | [mark-light.svg](https://pay.intents.fi/v1/brand/mark-light.svg) | [mark-light.png](https://pay.intents.fi/v1/brand/mark-light.png) (512 px) | | Mark, dark backgrounds | | [mark-dark.svg](https://pay.intents.fi/v1/brand/mark-dark.svg) | [mark-dark.png](https://pay.intents.fi/v1/brand/mark-dark.png) | | Wordmark, light backgrounds | "Powered by" lines | [wordmark-light.svg](https://pay.intents.fi/v1/brand/wordmark-light.svg) | [wordmark-light.png](https://pay.intents.fi/v1/brand/wordmark-light.png) | | Wordmark, dark backgrounds | | [wordmark-dark.svg](https://pay.intents.fi/v1/brand/wordmark-dark.svg) | [wordmark-dark.png](https://pay.intents.fi/v1/brand/wordmark-dark.png) | | Token strip, light backgrounds | USDT, USDC, ETH, SOL, BTC and "+1,000" | [icon-strip-light.svg](https://pay.intents.fi/v1/brand/icon-strip-light.svg) | [icon-strip-light.png](https://pay.intents.fi/v1/brand/icon-strip-light.png) | | Token strip, dark backgrounds | | [icon-strip-dark.svg](https://pay.intents.fi/v1/brand/icon-strip-dark.svg) | [icon-strip-dark.png](https://pay.intents.fi/v1/brand/icon-strip-dark.png) | | Pay with crypto mark, light backgrounds | three coins | [pay-with-crypto-mark-light.svg](https://pay.intents.fi/v1/brand/pay-with-crypto-mark-light.svg) | [pay-with-crypto-mark-light.png](https://pay.intents.fi/v1/brand/pay-with-crypto-mark-light.png) | | Pay with crypto mark, dark backgrounds | | [pay-with-crypto-mark-dark.svg](https://pay.intents.fi/v1/brand/pay-with-crypto-mark-dark.svg) | [pay-with-crypto-mark-dark.png](https://pay.intents.fi/v1/brand/pay-with-crypto-mark-dark.png) | | Pay with crypto wordmark, light backgrounds | the coins and "Pay with crypto" | [pay-with-crypto-wordmark-light.svg](https://pay.intents.fi/v1/brand/pay-with-crypto-wordmark-light.svg) | [pay-with-crypto-wordmark-light.png](https://pay.intents.fi/v1/brand/pay-with-crypto-wordmark-light.png) | | Pay with crypto wordmark, dark backgrounds | | [pay-with-crypto-wordmark-dark.svg](https://pay.intents.fi/v1/brand/pay-with-crypto-wordmark-dark.svg) | [pay-with-crypto-wordmark-dark.png](https://pay.intents.fi/v1/brand/pay-with-crypto-wordmark-dark.png) | | We accept crypto, light backgrounds | footers | [pay-with-crypto-accept-light.svg](https://pay.intents.fi/v1/brand/pay-with-crypto-accept-light.svg) | [pay-with-crypto-accept-light.png](https://pay.intents.fi/v1/brand/pay-with-crypto-accept-light.png) | | We accept crypto, dark backgrounds | | [pay-with-crypto-accept-dark.svg](https://pay.intents.fi/v1/brand/pay-with-crypto-accept-dark.svg) | [pay-with-crypto-accept-dark.png](https://pay.intents.fi/v1/brand/pay-with-crypto-accept-dark.png) | | Token marks alone | transparent, 80 × 20 | [token-marks.svg](https://pay.intents.fi/v1/brand/token-marks.svg) | | ## Rules - Call the option **Pay with crypto**, and put the price first. - Don't recolour, stretch, outline or add effects to any file. - The token marks belong to their issuers. They keep their own colours and always sit next to a name, never instead of one. - Leave clear space around the mark and the wordmark of at least half their height. Each file is served with a one-hour cache and open CORS, so you can link it directly. The coins are [web3icons](https://github.com/0xa3k5/web3icons) (MIT); the text is Inter (SIL OFL 1.1), drawn as outlines. ================================================================================================ # Magento — https://intents.fi/docs/checkout/magento ================================================================================================ **[Download Intents Checkout for Magento](https://intents.fi/integrations/magento/download)** (always the latest version) | Build | File | Released | Tested on | SHA-256 | |---|---|---|---|---| | Magento 2.4 1.0.1 | [`intentsfi-magento2-1.0.1.zip`](https://intents.fi/integrations/magento/download/intentsfi-magento2-1.0.1.zip) | 2026-11-26 | Magento Open Source 2.4.7–2.4.9, PHP 8.2–8.5 | `343dd193e51035fa323847e55b1f4abe3e4f26fd1df814c754f47a0579dd1235` | Each versioned file never changes once published, so its link and checksum are safe to pin. 1. Install the module, `IntentsFi_Checkout`. From the zip above, unzip it into `app/code/IntentsFi/Checkout`; with Composer, `composer require intentsfi/module-checkout`. Then: ```bash bin/magento module:enable IntentsFi_Checkout bin/magento setup:upgrade bin/magento cache:flush ``` 2. In Magento admin, open **Stores → Configuration → Sales → Payment Methods → Intents Checkout** and press **Connect intents.fi**. Sign in to (or sign up for) the dashboard and approve. You come back to the same page connected in **test mode**: the module saved a test key, registered its webhook URL and saved the webhook secret. Nothing to copy. ([How Connect works](/docs/checkout/connect).) 3. Set **Enabled** to Yes and **Save Config**. 4. Place an order. The hosted page shows a **Complete the test payment** button for a test invoice; press it, and the order is invoiced and moves to **Processing** when the webhook says the invoice is paid. 5. When the go-live checklist on the dashboard is done (a verified email and a payout wallet), press **Go live**. The live key replaces the test one only when that round trip finishes. Connect needs the store on `https://`. To set it up by hand instead, use **Enter keys manually**: 1. In [the dashboard](https://dashboard.intents.fi), check your [settlement](/docs/checkout/settlement) asset and address, and copy your **test** API key (`ik_test_…`). 2. Paste it into **API key**, and copy the **Webhook URL** the page shows. The **Mode** row reads *Test* or *Live* from the key's prefix. 3. Add that URL as a webhook endpoint for the same key, subscribed to the `invoice.*` events, either on the dashboard's **Webhooks** page or with the API, and paste the `whsec_…` secret it returns into **Webhook secret**: ```bash title="curl" curl https://api.intents.fi/v0/webhooks \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "url": "https://northwood.example/hooks/intents" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "url": "https://northwood.example/hooks/intents" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/webhooks", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "url": "https://northwood.example/hooks/intents" }, ) response.raise_for_status() data = response.json() ``` 4. **Save Config**, then press **Test connection**: it checks the saved key and shows the merchant, the mode and the settlement address it belongs to. The module is tested on Magento Open Source **2.4.7 and 2.4.8** with PHP 8.2 and 8.3, and on 2.4.9 with PHP 8.3, 8.4 and 8.5, with the standard (Luma-based) checkout. It has not been tested on Adobe Commerce yet. Hyvä Checkout is not supported yet. **The store currency must be USD.** Invoices are priced in USD and the module never converts, so the method stays hidden at checkout unless the website's base currency **and** the currency the customer is charged in are both USD. The configuration page says so, per store view. The method is also hidden while no valid secret key is saved. ## How a payment runs 1. The customer chooses the payment method (titled **Pay with crypto** unless you change it). The checkout shows the amount, then places the order at **Pending Payment** without charging anything. 2. The module creates an invoice for the order's grand total with `reference` = the order's increment ID plus a short key for your store (for example `000000042-1a2b3c4d`) and sends the customer to the hosted payment page. 3. The customer pays there; the module has no payment UI of its own. 4. intents.fi sends signed `invoice.*` webhooks to `https:///intentsfi/webhook`, and the module updates the order. `reference` is the API's idempotency key, so a reload or a second tab lands on the same invoice. The store key (eight characters derived from the store's base URL) keeps two stores on one intents.fi account apart: both may have an order `000000042`, and neither is ever sent to the other's invoice. An invoice that comes back made for a different order is never used. If the order total changes, or its invoice expires or is cancelled, the order gets a new invoice (`000000042-1a2b3c4d-r2`, then `-r3`) and the old one is cancelled through the API, after the order points at the new one. A payment that still lands on a replaced invoice puts the order **On Hold** with a comment, so a person decides. The customer coming back to the store never marks an order paid. Only the webhook does. Cancelling an order in Magento, by hand or through the pending-payment cleanup cron, also cancels its invoice, so it cannot be paid later. ## What each event does | Event | Order | |---|---| | `invoice.paid` | invoiced (offline capture), **Processing**, order email sent | | `invoice.paid` for an amount or currency that is not the order's | **On Hold** with a comment; never invoiced | | `invoice.paid` after the order was cancelled | a comment and an admin notification; never invoiced | | `invoice.underpaid` | **On Hold** with a comment; released and invoiced if the rest arrives | | `invoice.expired`, `invoice.canceled` | **Canceled**, if nothing was paid | | `invoice.processing` | an order comment | | `invoice.needs_review` | an order comment and an admin notification | Deliveries can repeat and arrive out of order. The module records each event ID in its own table, in the same database transaction as the order change, so a redelivery changes nothing. It also ranks events, so a late `invoice.expired` after `invoice.paid` changes nothing, while `invoice.paid` arriving before `invoice.processing` still completes the order. ## Settings | Setting | Notes | |---|---| | Enabled | offers the payment method at checkout | | Title | what the customer sees at checkout | | intents.fi account | **Connect intents.fi**; once connected, the business, the store, whether payment notifications work, **Go live** and **Disconnect** | | API key | `ik_test_…` or `ik_live_…`, stored encrypted. A publishable `pk_` key is refused on save | | Mode | read-only: *Test* or *Live*, from the key's prefix | | Webhook secret | the `whsec_…` returned when the endpoint was registered for that key, stored encrypted | | Webhook URL | read-only: `https:///intentsfi/webhook` | | Connection: **Test connection** | checks the saved key and reports the merchant and settlement address. Save first | | Applicable countries, Sort order | the standard Magento payment settings | Keys can be set per website. A webhook is accepted only if it was signed with the secret of the website the order belongs to. ## Going live Live mode needs a verified email and a payout wallet on your intents.fi account. Then: - **Connected:** press **Go live**. The live key and a live webhook replace the test ones, and the test connection is revoked. If the checklist is not done yet, the page says so and nothing changes. - **Keys entered manually:** register the webhook URL with the **live** key, paste the live API key and the live endpoint's secret, and save. **Mode** reads *Live*. Then place a real $5 order from a phone, on the network your customers use, and check it reaches Processing and the money reaches your address. ## Uninstalling Disconnect first if the store is connected, so its keys are revoked. Then, for a Composer install, `bin/magento module:uninstall IntentsFi_Checkout --remove-data` removes the module, its table and its settings (orders keep their payment details). For a zip install in `app/code`, disable the module, delete `app/code/IntentsFi/Checkout` and run `bin/magento setup:upgrade`. ## Troubleshooting - **Orders stay Pending Payment.** The webhook is not arriving or not verifying. Check the secret belongs to the same key, and that the store is reachable over `https` from the internet: intents.fi delivers only to public `https` URLs, and the settings page warns when the store is not served over HTTPS. A delivery whose signature does not verify gets a `401` and is retried. `var/log/intentsfi_checkout.log` shows each delivery; it never contains your key or secret. - **"Test connection" fails with `UNAUTHORIZED`.** The key is wrong, or it was revoked. The module checks the *saved* key, so save the settings first. - **Connect says "Connect needs your store on https://".** intents.fi only sends keys back to an `https` store. Serve the store over HTTPS, or enter keys manually. - **"This link has expired" after approving.** The request waits 30 minutes, and flushing Magento's cache in between forgets it. Press **Connect intents.fi** again. - **The payment method does not show at checkout.** The base or display currency is not USD, the method is not enabled, or no valid secret key is saved for the website. Questions: [support@intents.fi](mailto:support@intents.fi). ================================================================================================ # OpenCart — https://intents.fi/docs/checkout/opencart ================================================================================================ **[Download for OpenCart 4.x](https://intents.fi/integrations/opencart/download)** · **[Download for OpenCart 3.0.x](https://intents.fi/integrations/opencart/download/3)** (always the latest version) | Build | File | Released | Tested on | SHA-256 | |---|---|---|---|---| | OpenCart 4.x 1.0.0 | [`1.0.0/intentsfi.ocmod.zip`](https://intents.fi/integrations/opencart/download/1.0.0/intentsfi.ocmod.zip) | 2026-11-26 | OpenCart 4.0.2.3–4.1.0.4, PHP 8.1–8.2 | `1d89544e55c0f67cbc13e379f8f90210e75288015b0a4f6e71edc7bcda0041e2` | | OpenCart 3.0.x 1.0.0 | [`intentsfi-opencart3-1.0.0.ocmod.zip`](https://intents.fi/integrations/opencart/download/intentsfi-opencart3-1.0.0.ocmod.zip) | 2026-11-26 | OpenCart 3.0.3.9–3.0.5.1, PHP 7.4–8.2 | `09891563197dd9cda6f6e4bff47ccceb54d2ac8527f56b7daaf8771a0e6cff3d` | Each versioned file never changes once published, so its link and checksum are safe to pin. There are two packages, one per OpenCart line: | Package | OpenCart | |---|---| | `intentsfi.ocmod.zip` | 4.0.2.3 and 4.1.0.4 (tested) | | `intentsfi-opencart3-1.0.0.ocmod.zip` | 3.0.3.9, 3.0.4.1 and 3.0.5.1 (tested) | Download the one for your OpenCart above. The OpenCart Marketplace listing is in review. Keep the OpenCart 4 file name as it is: OpenCart 4 names the extension after the zip. 1. In OpenCart, go to **Extensions → Installer** and upload the package. Then go to **Extensions → Extensions**, choose **Payments**, and install **Intents Checkout**. Installing adds a **Payment review** order status. 2. Edit **Intents Checkout** and press **Connect intents.fi**. 3. Sign in to (or sign up for) the intents.fi dashboard and approve the connection. You come back to OpenCart connected in **test mode**, with your keys and payment notifications set up. Nothing to copy. 4. Turn **Status** on and save, then place an order. The hosted page shows a **Complete the test payment** button for a test invoice. Press it, and the order moves to **Processing** when the webhook says the invoice is paid. 5. When your account is ready for live payments (a verified email and a payout wallet), press **Go live**. The store switches to live mode only when that round trip finishes. See [Plugin Connect](/docs/checkout/connect). **Disconnect** revokes the keys Connect made, on intents.fi and in the store, at once. ### Enter keys manually Connect needs the store and its admin on the same address (the same `https://` and domain), and the storefront has to be reachable while you connect, so not in maintenance mode. If either is not the case, or you would rather paste keys: 1. In [the dashboard](https://dashboard.intents.fi), copy your **test** API key (`ik_test_…`). 2. Under **Enter keys manually**, paste it into **Secret API key** (the mode is read from its prefix) and copy the **Webhook URL** the page shows. 3. Add that URL as a webhook endpoint for your test key, subscribed to the `invoice.*` events, either on the dashboard's **Webhooks** page or with the API, and paste the `whsec_…` secret it returns into **Webhook secret**: ```bash title="curl" curl https://api.intents.fi/v0/webhooks \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "url": "https://northwood.example/hooks/intents" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "url": "https://northwood.example/hooks/intents" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/webhooks", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "url": "https://northwood.example/hooks/intents" }, ) response.raise_for_status() data = response.json() ``` 4. Save, then press **Test connection**: it checks the saved key and shows the merchant, the mode and the settlement address it belongs to. The webhook URL is: | OpenCart | Webhook URL | |---|---| | 4.x | `https:///index.php?route=extension/intentsfi/payment/intentsfi.webhook` | | 3.0.x | `https:///index.php?route=extension/payment/intentsfi/webhook` | **The store currency must be USD.** Invoices are priced in USD and nothing is converted, so the payment method is offered only when the store's default currency and the customer's currency are both USD. Otherwise it is hidden at checkout and the settings page says why. It is also hidden while no secret key is saved, and for carts with a subscription or recurring product. ## How a payment runs 1. The customer chooses **Pay with crypto**. The block below it leads with the amount to pay, and **Continue to payment** creates an invoice for the order total and sends them to the hosted payment page. The order gets the **awaiting payment** status (Pending unless you change it). 2. The customer pays there; the extension has no checkout UI of its own. 3. intents.fi sends signed `invoice.*` webhooks to the webhook URL, and the extension adds order history. The invoice's `reference` is `opencart--`, with `-test` added in test mode, where `` is a short tag derived from your store's address, so two stores on one account never share an invoice. It is the API's idempotency key, so a retried checkout lands on the same invoice. If the order total changes, or its invoice expires or is cancelled, the order gets a new invoice (`-r2`, then `-r3`) and the old one is cancelled through the API. Before a customer is sent to an invoice, the extension checks it belongs to this store and order, mode and amount. The customer coming back to the store never marks an order paid. Only the webhook does. ## What each event does | Event | Order | |---|---| | `invoice.paid` | **Paid** status (Processing unless you change it); the customer is told "Payment received" | | `invoice.paid` that needs a person | **Payment review**, with a comment saying why | | `invoice.underpaid`, `invoice.needs_review` | **Payment review**, with a comment | | `invoice.expired`, `invoice.canceled` | **Expired** / **Canceled**, if the order is still awaiting payment | | `invoice.processing` | a comment for you | A payment goes to **Payment review** rather than **Paid** when it arrived late (after the invoice expired or was cancelled), when intents.fi flagged it, when the amount or currency differs from what the order asks for now (for example after you edited the order), when it landed on an invoice the order has replaced, when you had already cancelled the order, or when the order was already paid. A Complete order keeps its status and gets the comment. Deliveries can repeat and arrive out of order. The extension stores each event ID and ranks events, so a late `invoice.expired` after `invoice.paid` changes nothing, while a late `invoice.paid` still reaches the order. ## Settings | Setting | Notes | |---|---| | intents.fi account | **Connect intents.fi**, or who the store is connected as, with **Go live** and **Disconnect** | | Secret API key | `ik_test_…` or `ik_live_…`; the mode comes from the prefix. Never shown again once saved; leave blank to keep it | | Webhook secret | the `whsec_…` returned when the endpoint was registered for the same mode | | Webhook URL | read-only, with a copy button | | Connection: **Test connection** | checks the saved key and reports the merchant and settlement address | | Order statuses | awaiting payment, paid, needs review, expired and canceled | | Status, Sort Order | as for any payment method | One key and one secret are in use at a time. **Go live** swaps them for live ones. If you entered keys manually, register the URL for the live key too and paste both the live key and its secret. ## Going live 1. Press **Go live** (or, with manual keys, register the webhook URL with the **live** key and paste the live key and its secret). 2. Place a real $5 order from a phone, on the network your customers use, and check it reaches Processing and the money reaches your address. ## Troubleshooting - **Orders stay Pending.** The webhook is not arriving or not verifying. Check the secret matches the key's mode, and that the store is reachable over `https` from the internet: intents.fi delivers only to public `https` URLs. A delivery whose signature does not verify gets a `401` and is retried. `storage/logs/intentsfi.log` shows each delivery. - **"Test connection" fails with `UNAUTHORIZED`.** The key is wrong, or it is a publishable `pk_` key. The extension needs a secret `ik_` key, and checks the *saved* one, so save first. - **The payment method does not show at checkout.** The currency is not USD, the method is not enabled, or no secret key is saved. - **"This order total is outside what this payment method accepts."** The API refused the amount (`AMOUNT_OUT_OF_RANGE`): the smallest payment is $1.00. The error's message in `storage/logs/intentsfi.log` says what it accepts. - **Connect comes back with "Live payments are not open for your account yet."** Finish the go-live checklist on the dashboard (a verified email and a payout wallet), then press **Go live** again. The store stays in test mode until then. - **Connect says payment notifications could not be set up.** intents.fi only delivers to an `https://` address the store answers on. Fix that, then press **Connect intents.fi** again. Questions: support@intents.fi. ================================================================================================ # Payment links — https://intents.fi/docs/checkout/payment-links ================================================================================================ A payment link is a URL with a price and a description that you can paste into a chat, an email or a bio. The price is either **fixed**, or **the customer chooses** it inside limits you set: a tip jar, a donation, pay what you want. Each visit creates its own invoice at that price, paid to your settlement address, with the usual webhooks. Nobody has to write any code. ```text https://pay.intents.fi/l/plink_… ``` ## Make one in the dashboard On [dashboard.intents.fi/links](https://dashboard.intents.fi/links), in live or test mode: | Field | Notes | |---|---| | **Price** | **A fixed price**, or **The customer chooses** | | **Price (USD)** | a fixed price like `49.00`: $1.00 or more, up to 8 digits before the point | | **Smallest amount**, **Largest amount** | when the customer chooses: the bounds their amount must fall in. The smallest is $1.00 or more; the largest has no limit beyond the same 8-digit format | | **Suggested amounts** | when the customer chooses, optional: up to 4 amounts inside the bounds, shown as one-tap buttons. The first is filled in to start | | **What it is for** | the description the customer sees, up to 200 characters | | **Send customers here after paying** | optional, an `https://` URL for the paid screen's return button | | **Let customers choose a quantity**, **Up to** | fixed price only, optional. The customer picks 1 to the maximum (10 unless you say, at most 100) and pays price × quantity | The table lists each link with its URL, price, how many invoices it has created and whether it is on. **Switch off** stops a link at once: its page answers "not found" and no new invoice can be made from it. Invoices it already created are not affected, and you can switch it back on. Owners, admins and developers can create and switch links; viewers can see them ([Team](/docs/platform/team)). Links belong to a mode: a test link creates test invoices, which pay with the **Complete the test payment** button and move no money, and its page says "This is a test link. No money moves." ## What the customer sees `https://pay.intents.fi/l/{linkId}` shows your name and logo, the price and the description, a **How many?** field if the link allows a quantity, and **Continue to payment**. That creates the invoice and takes the customer to the normal hosted checkout for it. When the customer chooses, the price is replaced by an amount field in dollars, your suggestions under it, and the bounds ("Between $1.00 and $500.00"). The button names the amount ("Continue with $10.00"). An amount outside the bounds, or with more than two decimals, is refused before an invoice is made, and the page says why in plain words. If you have your own checkout domain, the link page is served there too, and only for your own links. ## The invoice it creates Each visit's invoice is an ordinary invoice: - priced at the link's amount times the quantity, with the description (and `× 3` for a quantity of 3), or at the amount the customer chose, - paid to your default settlement address as it was when the invoice was created ([Settlement](/docs/checkout/settlement)), - expiring on the usual clock, - with `metadata.paymentLink` set to the link's ID and `metadata.quantity` to the quantity, so your webhook handler can tell where it came from. When the customer chose the amount, `metadata.amountType` is `"custom"` and the invoice's `amount` is what they chose. It fires the same `invoice.*` [webhooks](/docs/platform/webhooks) as any other invoice. Fulfil from `invoice.paid`, as always. The fee works exactly as on any invoice, on the amount the customer chose: you receive `settlement.amountNet`, that amount less 0.4%, and the fee is charged on top of the route. A $12.34 tip, as `invoice.paid` delivers it: ```json { "id": "evt_7NwQ2cLx9VbR4tKm", "type": "invoice.paid", "createdAt": "2026-11-25T14:02:41.000Z", "late": false, "data": { "id": "inv_8HtM3qWz6PxLc1Vn5Rb9Ky", "status": "paid", "mode": "live", "amount": "12.34", "currency": "USD", "description": "Tip jar", "settlement": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "address": "0x6A3fB91c7D8e45A2b0C1fE97D3a8B52c4e7F10dA", "amountExpected": "12340000", "amountNet": "12290640" }, "fee": { "bps": 40, "amount": "49360" }, "metadata": { "paymentLink": "plink_7wQ3pZ9mKd2XsRv5LcNb8tHy4gFa6jEu", "quantity": "1", "amountType": "custom" }, "…": "…" } } ``` Read the amount from `data.amount` (or `data.settlement.amountNet` for what you received), never from the link: every payment on a tip jar can be different. As always, a receiver must tolerate duplicates and events arriving out of order. ## The API, for your own link page Two public endpoints serve the link page, and you can call them from your own page instead. They accept browser calls from any origin. #### What a payment link sells, for the link page `GET /v0/links/{id}` | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ```bash title="curl" curl https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo", { method: "GET", }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.get( "https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo", ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | The link | | `404` | Unknown or off | #### One visit to a payment link: an invoice at the link's price, or the customer's amount `POST /v0/links/{id}/invoices` Takes the merchant's publishable key (pk_), or no key: the link ID is its capability, and a link can only create the invoice the merchant priced, or, on a `custom` link, one at an amount the customer chose inside the merchant's bounds. A key must match the link's account and mode. Body (optional JSON, schema `PaymentLinkInvoiceRequest`): `quantity`, `amount` (custom links, required there), `customerEmail`. | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ```bash title="curl" curl https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo/invoices \ -X POST ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo/invoices", { method: "POST", }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import httpx response = httpx.post( "https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo/invoices", ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `201` | Created; send the customer to `url` | | `400` | A bad quantity or amount, or a key from the other mode | | `404` | Unknown or off | | `422` | AMOUNT_OUT_OF_RANGE: outside the link's minimum and maximum | | `429` | Too many from this IP, or on this custom-amount link | The body is optional on a fixed link: `quantity` (1 to the link's maximum; only `1` unless the link allows a quantity) and `customerEmail` for a receipt. A link where the customer chooses (`amountType: "custom"` in `GET /v0/links/{id}`, with `minAmount`, `maxAmount` and `suggestedAmounts`) **requires** `amount`: a string in dollars with at most two decimals, like `"12.34"`, between `minAmount` and `maxAmount`. A JSON number is refused, because it has already been through a float. On a fixed link, `amount` is refused rather than ignored: the link's price is yours, not the caller's. On a custom link, `amount` in the `GET` answer is only the amount the page starts with. ```json { "amount": "12.34", "customerEmail": "fan@example.com" } ``` Send the customer to the `url` it returns, or mount the invoice in the [widget](/docs/checkout/widget) with its `invoiceId` and `clientSecret`. **No key is needed.** The link's ID is long and random, and it can only ever create the invoice you priced, so it is safe to share. A publishable key (`pk_…`) in `Authorization: Bearer` is accepted too, if it belongs to the link's account and mode: a key from another account gets `404`, and a key from the other mode gets `400 INVALID_REQUEST`. A secret `ik_` key never belongs in a browser. | Answer | When | |---|---| | `404 NOT_FOUND` | the link does not exist or is switched off. The two are indistinguishable on purpose | | `400 INVALID_REQUEST` | a quantity outside 1 to the maximum, or a key from the other mode. With `details.field: "amount"`: no amount on a link where the customer chooses, an amount that is not a two-decimal string, or any amount on a fixed link | | `422 AMOUNT_OUT_OF_RANGE` | the customer's amount is outside the link's bounds; `details` carries `min` and `max` ([AMOUNT_OUT_OF_RANGE](/docs/errors/AMOUNT_OUT_OF_RANGE)) | | `403 MERCHANT_RESTRICTED` | the merchant is not taking payments right now ([MERCHANT_RESTRICTED](/docs/errors/MERCHANT_RESTRICTED)) | | `429 RATE_LIMITED` | more than 30 invoices from one IP address in an hour, with or without a key; or, on a link where the customer chooses, more than 300 invoices on that link in an hour | ================================================================================================ # "Pay with crypto" option — https://intents.fi/docs/checkout/payment-option ================================================================================================ ```tsx import { PaymentMethodOption } from "@intents-fi/react"; setMethod("crypto")} /> ``` Your checkout already lists **Card** and **PayPal**. This is the row that goes next to them: a radio labelled **Pay with crypto**, the USDT, USDC, ETH, SOL and BTC marks with a count, and the line "Any token, any network". While it is selected, a short explainer sits under it: the exact price, how long it holds, and the automatic refund. It sits in your page and takes your page's font. For an express-checkout row there is a [button](#the-express-button), and for a footer ["We accept crypto"](#we-accept-crypto). Selecting it does not take a payment. When the customer confirms the order: 1. your server creates the invoice with [`createInvoice`](/docs/platform/server-sdk), using your order id as `reference`; 2. your page opens the payment pop-up with that invoice: `` or `` in React, or `IntentsCheckout.open()` anywhere else ([widget](/docs/checkout/widget)); 3. your server **ships the order on the `invoice.paid` webhook**, and only then. The pop-up's `onPaid` is for your page (close it, show a thank-you); anyone can fire it from a browser console. ## React ```tsx "use client"; import { CheckoutEmbed, PaymentMethodOption } from "@intents-fi/react"; import { useState } from "react"; export function PaymentMethods({ orderId }: { orderId: string }) { const [method, setMethod] = useState<"card" | "paypal" | "crypto">("card"); const [invoice, setInvoice] = useState<{ id: string; clientSecret: string } | null>(null); async function placeOrder() { if (method !== "crypto") return; // your card and PayPal flow // Your route: calls createInvoice({ amount, reference: orderId }) and returns id + clientSecret. const res = await fetch("/api/crypto-invoice", { method: "POST", body: JSON.stringify({ orderId }) }); setInvoice(await res.json()); } return (

Payment method setMethod("crypto")} amount="$49.00" /> {invoice ? ( location.assign("/thanks")} /> ) : null}
); } ``` It is a native radio inside a label, so it joins your group when it has the same `name` (`payment-method` by default), and the keyboard and screen readers treat it like your other rows. | Prop | Default | | |---|---|---| | `selected` | `false` | checked: the filled radio, the soft ground and the explainer | | `onSelect` | | called when the customer picks it | | `disabled` | `false` | dimmed and not selectable, e.g. under the $1.00 minimum; say why in `subtitle` ("Available on orders over $1.00"), which stays readable | | `name`, `value` | `payment-method`, `crypto` | the radio's group and value | | `theme` | `light` | `dark`, or `auto` to follow the visitor's system setting | | `subtitle` | "Any token, any network" | `false` hides it | | `more` | `1000` | the "+N" after the marks; `false` hides it | | `explainer` | `true` | the short explainer under the selected row; `false` leaves it out | | `amount` | | the order total as you show it ("$49.00"): "You pay exactly $49.00" | | `lockMinutes` | `30` | how long the price holds: your invoices' `expiresInSec` / 60 | | `appearance` | | `colorText`, `colorTextMuted`, `colorBackground`, `colorBackgroundHover`, `colorBorder`, `colorAccent`, `fontFamily`, `borderRadius` | Text colours must keep **4.5:1** contrast against the background, and `colorAccent` (the selected radio and the focus ring) 3:1. `colorBackgroundHover` is the hovered and selected ground, and the explainer's. A colour that fails is refused and the default is kept; you get the reason in `onAppearanceError`, or as a console warning. ## Plain HTML and CSS For sites without React. Load the stylesheet once, and put the row in your list: ```html

Pay with USDT, USDC, ETH, SOL and 1,000+ other tokens, from your wallet or an exchange. You'll choose how to pay in the next step.

You pay the exact order total. The price is locked for 30 minutes.

If anything goes wrong, you're refunded automatically.

``` Use the same `name` as your other payment radios. The selected style and the explainer need no JavaScript. Keep the label and the explainer together in `.ifpm-Item`, and put your order total in it: replace "You pay the exact order total." with `You pay exactly $49.00.` If your invoices expire sooner than 30 minutes, change that number too. Leave the explainer out if you'd rather not show it. Swap `--light` for `--dark` or `--auto` on both elements. To use your own colours, set the custom properties on the row and check their contrast yourself: ```css .ifpm-Option, .ifpm-Explainer, .ifpm-Express, .ifpm-Accept { --ifpm-text: #14213d; --ifpm-accent: #0e5a8a; --ifpm-radius: 12px; --ifpm-font: inherit; /* the default: your page's font */ } ``` Then, when the order is placed with this row selected, create the invoice on your server and open the pop-up: ```html ``` In a narrow row the strip shortens to two marks, then to the count alone, so the words never wrap into it. The colours default to the checkout's own tokens (`--c-bg`, `--c-ink`, `--c-muted`, `--c-rule`, `--c-soft`, `--c-accent`), so a page that sets those restyles every piece at once. ## The express button For an express-checkout row, next to Apple Pay and PayPal. It is a plain button. On click, your page asks your server for the invoice and opens the pop-up, as above. ```tsx import { ExpressButton } from "@intents-fi/react"; Crypto {/* in a three-up row */} ``` ```html ``` It is ink-filled. Add `ifpm-Express--line` (React: `variant="line"`) for an outlined button that matches outlined neighbours. Add `ifpm-Express--block` (`block`) to share the row's width, and use the shorter label "Crypto" there. ## We accept crypto For a footer, or a row of the ways you take payment: ```tsx import { AcceptStrip, TokenStrip } from "@intents-fi/react"; {/* the coins and the count alone */} ``` ```html We accept crypto ``` The strip reads as one image to a screen reader: "USDT, USDC, ETH, SOL, BTC and 1,000 more". ## States | State | How you get it | Looks like | |---|---|---| | Default | `selected={false}` / an unchecked radio | an empty ring, hairline border | | Hover | the pointer over it | the soft fill, a darker ring | | Selected | `selected` / `checked` | the soft fill, the radio filled in `colorAccent`, and the explainer under it | | Disabled | `disabled` | radio, name and coins dimmed, not selectable; the subtitle (your reason) stays readable | | Dark | `theme="dark"` / `ifpm-Option--dark` (`auto` follows the system) | the dark checkout ground, light text | ## Logo pack The marks, the wordmark, the token strip and the "Pay with crypto" marks, for light and dark backgrounds, are in the [logo pack](/docs/checkout/logo-pack). Using it in a full checkout: [Add crypto to your existing checkout](/docs/checkout/add-crypto), and the [Next.js](/docs/checkout/examples/nextjs), [Express](/docs/checkout/examples/express) and [PHP](/docs/checkout/examples/php) examples. ================================================================================================ # PrestaShop — https://intents.fi/docs/checkout/prestashop ================================================================================================ **[Download Intents Checkout for PrestaShop](https://intents.fi/integrations/prestashop/download)** (always the latest version) | Build | File | Released | Tested on | SHA-256 | |---|---|---|---|---| | PrestaShop 1.0.0 | [`intentsfi-prestashop-1.0.0.zip`](https://intents.fi/integrations/prestashop/download/intentsfi-prestashop-1.0.0.zip) | 2026-11-26 | PrestaShop 8.1–9.0, PHP 7.2–8.4 | `b302f4830566e95108b7d87c08b378ad424ef88ff78c1fdaf2c7c8f9aa9751a8` | Each versioned file never changes once published, so its link and checksum are safe to pin. 1. Download the zip above and upload it under **Modules → Module Manager → Upload a module**. The module is called **Intents Checkout**. 2. Open the module's **Configure** page and press **Connect intents.fi**. 3. Sign in to (or sign up for) [the dashboard](https://dashboard.intents.fi) and approve the connection. You come back to the Configure page connected in **test mode**, with your keys and payment notifications set up. Nothing to copy. See [Plugin Connect](/docs/checkout/connect). 4. Place an order with **Pay with crypto**. The hosted page shows a **Complete the test payment** button for a test invoice; press it, and the order moves to **Payment accepted** when the webhook says the invoice is paid. 5. When your account is ready for real payments (a verified email and a payout wallet), press **Go live**. The shop switches to live mode only when that round trip finishes. Connect needs the back office and the shop on the same `https://` address. If it can't be used, enter the keys manually instead: 1. In the dashboard, check your [settlement](/docs/checkout/settlement) asset and address, and copy your **test** API key (`ik_test_…`). 2. On the Configure page, copy the **Webhook URL** it shows. 3. Add that URL as a webhook endpoint for the same key, subscribed to the `invoice.*` events, either on the dashboard's **Webhooks** page or with the API, and note the `whsec_…` secret it returns: ```bash title="curl" curl https://api.intents.fi/v0/webhooks \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "url": "https://northwood.example/hooks/intents" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "url": "https://northwood.example/hooks/intents" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/webhooks", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "url": "https://northwood.example/hooks/intents" }, ) response.raise_for_status() data = response.json() ``` 4. Paste the key into **API key** and the secret into **Webhook secret**, press **Save**, then press **Test connection**: it shows the merchant, the mode and the settlement address the key belongs to. The module needs PrestaShop 8.1 to 9.0 and PHP 7.2 or later. It has no dependencies and adds no overrides. **The cart currency must be USD.** Invoices are priced in USD and the module never converts, so **Pay with crypto** is only offered to a customer shopping in USD. The Configure page says why the method may be hidden: no USD currency in the shop, a default currency other than USD (the method is then offered only to customers who switch to USD), or USD unticked under **Payment → Preferences → Currency restrictions**. The method is also hidden until both the API key and the webhook secret are saved, because without the secret no order could ever be marked paid. ## How a payment runs 1. The customer chooses **Pay with crypto**. The module places the order as **Awaiting crypto payment**, creates an invoice for the order total with `reference` set to the PrestaShop order reference plus a short tag for your shop (`XKBKNABJK-1a2b3c4d`), and sends the customer to the hosted payment page. The tag keeps two shops on one key from ever sharing a reference, and an invoice whose metadata names another order is never used. 2. The customer pays there; the module has no checkout UI of its own. 3. intents.fi sends signed `invoice.*` webhooks to `/module/intentsfi/webhook`, and the module updates the order. `reference` is the API's idempotency key, so a retried payment lands on the same invoice. A customer who left before paying finds a **Complete your payment** link on the order confirmation and order detail pages. If the order total changed in the back office, or its invoice expired or was cancelled, that link creates a new invoice (`XKBKNABJK-1a2b3c4d-r2`, then `-r3`) and the old one is cancelled through the API. A payment that still lands on a replaced invoice puts the order **on hold** and flags it for review. The customer coming back to the shop never marks an order paid. Only the webhook does. A cart that PrestaShop splits into several orders (several carriers) gives them one reference, one invoice for their combined total, and one payment. ## What each event does | Event | Order | |---|---| | `invoice.paid` | **Payment accepted**, with the invoice ID as the payment's transaction ID | | `invoice.paid` for an amount the order no longer comes to | **Crypto payment on hold**, flagged for review | | `invoice.paid` on a replaced invoice | **Crypto payment on hold**, flagged for review | | `invoice.underpaid` | **Crypto payment on hold**; the customer can pay the rest from the same page | | `invoice.expired`, `invoice.canceled` | **Canceled**, if nothing was paid | | `invoice.processing` | a private message | | `invoice.needs_review` | a private message, flagged for review | Every event that is acted on adds a private message to the order, which the customer never sees. Flagged orders are listed on the Configure page and marked on the order page until you press **Mark as checked**. Deliveries can repeat and arrive out of order. The module records each event ID once, so a redelivery is a no-op, and it ranks events, so a late `invoice.expired` after `invoice.paid` changes nothing while a late `invoice.paid` still pays a cancelled order. An order on hold because money arrived is never cancelled by a later expiry: a person decides. ## Settings | Setting | Notes | |---|---| | API key | `ik_test_…` or `ik_live_…`. The prefix sets the mode: test keys move no funds. Never shown again once saved | | Webhook secret | the `whsec_…` returned when the webhook URL was registered for that key | | Webhook URL | read-only: `https:///module/intentsfi/webhook` | | **Test connection** | checks the saved key and reports the merchant, mode and settlement address | | **Connect intents.fi** / **Go live** / **Disconnect** | the Connect round trip for test and live keys, and revoking them | One key and one secret are active at a time. Connect fills them in; entered manually, the secret must belong to the endpoint registered on that key. Switching from test to live replaces both. After **Go live** the module still accepts webhooks signed for its test connection, so a test payment already in flight is still recorded. **Disconnect** revokes the keys Connect made (test and live) on intents.fi and removes them from the shop; a key you entered manually is left alone. Uninstalling the module revokes Connect's keys too. ## Going live 1. Press **Go live** on the Configure page. intents.fi checks your account has a verified email and a payout wallet, and says what is missing if not. Entering keys manually instead: register the webhook URL on the **live** key, then paste the live key and its webhook secret, and save. 2. Place a real $5 order from a phone, on the network your customers use, and check it reaches **Payment accepted** and the money reaches your address. ## Uninstalling Uninstalling revokes the keys Connect made and deletes the module's settings and its table linking orders to payments. Paid orders are not affected. The two order states are handled as follows: - A state that no order has ever been in, **Awaiting crypto payment** or **Crypto payment on hold**, is deleted. - A state that orders use is kept but hidden, so those orders keep their history. Reinstalling the module brings the same state back. ## Troubleshooting - **Orders stay Awaiting crypto payment.** The webhook is not arriving or not verifying. Check the secret belongs to the key you saved, and that the shop is reachable over `https` from the internet: intents.fi delivers only to public `https` URLs. A delivery whose signature does not verify gets a `401` and is retried. **Advanced Parameters → Logs**, filtered on `intentsfi`, shows each delivery. - **"Test connection" fails with `UNAUTHORIZED`.** The key is wrong, or it is a publishable `pk_` key. The module needs a secret `ik_` key. - **The payment method does not show at checkout.** See the currency notes above, and check both the key and the secret are saved. - **Maintenance mode** does not block webhooks: payments still land while the shop is closed. Support is by email only: [support@intents.fi](mailto:support@intents.fi). ================================================================================================ # Intents Checkout quickstart — https://intents.fi/docs/checkout/quickstart ================================================================================================ Three things: create an invoice, send the customer to the `url` it comes back with, and handle the `invoice.paid` webhook. Everything below runs against a `ik_test_` key, so no money moves. No account yet? [Sign up](https://dashboard.intents.fi/signup) with Google, GitHub, Discord, X, your wallet or email; setup hands you a test key in a couple of minutes. See the [Intents Checkout overview](/docs/checkout#going-live) for going live. ## 1. Create an invoice An invoice is priced in USD. The customer pays in whatever they hold; you receive one settlement asset, a USD stablecoin or native Bitcoin, at your own address. ```bash title="curl" curl https://api.intents.fi/v0/invoices \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'x-intents-affiliate: ' \ -H 'content-type: application/json' \ -d '{ "amount": "49.00", "settlement": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "address": "0x6A3fB91c7D8e45A2b0C1fE97D3a8B52c4e7F10dA" }, "reference": "order_1042", "description": "Pro plan — 1 month", "customerEmail": "ana@example.com", "successUrl": "https://northwood.example/thanks" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/invoices", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "amount": "49.00", "settlement": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "address": "0x6A3fB91c7D8e45A2b0C1fE97D3a8B52c4e7F10dA" }, "reference": "order_1042", "description": "Pro plan — 1 month", "customerEmail": "ana@example.com", "successUrl": "https://northwood.example/thanks" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/invoices", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "amount": "49.00", "settlement": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "address": "0x6A3fB91c7D8e45A2b0C1fE97D3a8B52c4e7F10dA" }, "reference": "order_1042", "description": "Pro plan — 1 month", "customerEmail": "ana@example.com", "successUrl": "https://northwood.example/thanks" }, ) response.raise_for_status() data = response.json() ``` The response (a real test-mode invoice; the client secret is cut short): ```json { "id": "inv_9Q8t8jmDz9rSqE_Bds4rz96cuUZUf4wb", "status": "open", "mode": "test", "amount": "49.00", "currency": "USD", "reference": "order_1042", "description": null, "customerEmail": null, "settlement": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "address": "0x362239F4334464f68445691F6358B7cad827E431", "amountExpected": "49000000", "amountNet": "48804000" }, "fee": { "bps": 40, "amount": "196000" }, "absorbRouteCost": false, "priceLock": null, "url": "https://pay.intents.fi/c/inv_9Q8t8jmDz9rSqE_Bds4rz96cuUZUf4wb", "successUrl": null, "cancelUrl": null, "metadata": {}, "overpaid": false, "needsReview": false, "payer": null, "txs": { "origin": [], "settlement": [], "refund": [] }, "channel": null, "attempts": [], "expiresAt": "2026-11-25T16:09:51.509Z", "paidAt": null, "createdAt": "2026-11-25T15:39:51.520Z", "updatedAt": "2026-11-25T15:39:51.520Z", "clientSecret": "inv_9Q8t8jmDz9rSqE_Bds4rz96cuUZUf4wb_secret_…" } ``` Three fields to keep: - **`id`** — your handle on the invoice from here on. - **`url`** — where you send the customer. Nothing to build. - **`clientSecret`** — shown **once**, and only needed if you build your own checkout. We keep a hash of it and cannot tell it to you later. `amountExpected` and `amountNet` are integer strings in the settlement asset's base units, not decimals: `49000000` is $49.00 of a six-decimal stablecoin. Do the maths in `BigInt`, never a float. If you [settle in BTC](/docs/checkout/settlement#settling-in-btc) they are sats, locked from live quotes when the invoice is created (`priceLock`), so match your orders on `amount`, the USD price. ### `reference` is your idempotency key `reference` is your own order ID, unique per merchant and mode (test and live keys never share one). Sending the same one twice returns `200` with the invoice that already exists instead of creating a second one, so a retried create can never charge a customer twice. On a replay `clientSecret` comes back `null`, because it is stored as a hash. Use a fresh reference for a genuine retry: `order_1042.2`. ## 2. Send the customer to the checkout Redirect to `invoice.url`. The hosted page handles the whole payment: picking a token, showing a QR code and the exact amount, warning about the chain, taking a refund address, counting down to expiry and showing the paid state. ```ts const invoice = await createInvoice(cart); await db.orders.update(cart.id, { invoiceId: invoice.id }); return Response.redirect(invoice.url, 303); ``` Pass `successUrl` on create and the page sends the customer back to you when it is done. Do not treat a return to `successUrl` as proof of payment: it only means the browser came back. The webhook is the proof. ## 3. Find out when it is paid Register an endpoint once, subscribed to the invoice events: ```bash title="curl" curl https://api.intents.fi/v0/webhooks \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "url": "https://northwood.example/hooks/intents" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "url": "https://northwood.example/hooks/intents" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/webhooks", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "url": "https://northwood.example/hooks/intents" }, ) response.raise_for_status() data = response.json() ``` Then verify and handle. The signature scheme and the retry behaviour are on the [webhooks page](/docs/platform/webhooks); the short version: ```ts import { createHmac, timingSafeEqual } from "node:crypto"; export async function POST(request: Request) { const body = await request.text(); // the raw bytes, not the parsed JSON const header = request.headers.get("x-intents-signature") ?? ""; if (!verify(process.env.INTENTS_WEBHOOK_SECRET!, body, header)) { return new Response("bad signature", { status: 400 }); } const event = JSON.parse(body); if (event.type === "invoice.paid") { // Duplicates and out-of-order delivery are normal. Make this idempotent. await fulfil(event.data.reference, { invoiceId: event.data.id, late: event.late === true }); } return new Response(null, { status: 204 }); } function verify(secret: string, body: string, header: string): boolean { const parts = Object.fromEntries(header.split(",").map((kv) => kv.split("="))); const timestamp = Number(parts.t); if (!Number.isInteger(timestamp) || !parts.v1) return false; if (Math.abs(Date.now() / 1000 - timestamp) > 300) return false; const expected = createHmac("sha256", secret).update(`${timestamp}.${body}`).digest("hex"); const a = Buffer.from(expected, "hex"); const b = Buffer.from(parts.v1, "hex"); return a.length === b.length && timingSafeEqual(a, b); } ``` `invoice.paid` fires when the money has settled to your address, and only then. The `data` of every invoice event is byte-for-byte what `GET /v0/invoices/{id}` returns, so there is one shape to parse. ### If you would rather poll ```bash title="curl" curl https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` Poll no faster than every two seconds while a customer is watching, and back off to ten seconds after five minutes. The invoice carries its own expiry, so there is nothing to time out yourself. ## 4. The states you have to handle | Status | What happened | What to do | |---|---|---| | `open` | nothing sent yet | wait | | `processing` | money seen, not settled | wait; do not fulfil | | `underpaid` | less arrived than asked | the customer can top up against the same address until expiry | | `paid` | settled to your address | fulfil | | `expired` | nobody paid in time | create a new invoice with a new reference | | `canceled` | you called it off | nothing | **Returned payments arrive minus network costs.** When a payment can't complete (it came in after expiry, or short and never topped up), it goes back to the payer's refund address, less the network costs of sending it back. In a live test, 2.5 USDT sent came back as 2.2 USDT. The payment page says so next to the refund address field. Two flags ride along on a paid invoice: - **`overpaid`** — more than 0.5% too much arrived. The money is yours; what to refund is your call. - **`needsReview`** — a human should look. Usually a late payment: it settled after expiry, so the invoice is `paid` and `invoice.paid` carries `late: true`. You decide whether to fulfil. Both show in the [dashboard](https://dashboard.intents.fi/invoices), and `needsReview` emails you. ## 5. Cancel what you no longer want ```bash title="curl" curl https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw/cancel \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw/cancel", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw/cancel", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` Only an `open` invoice can be cancelled. Anything else returns [`INVOICE_NOT_OPEN`](/docs/errors/INVOICE_NOT_OPEN). ## Going live 1. Swap `ik_test_` for `ik_live_`, and register a live webhook endpoint — endpoints are per mode. 2. Check the settlement address on the [dashboard](https://dashboard.intents.fi) against the one in your wallet, character by character. 3. Make your webhook handler idempotent, and store `invoice.id` against your own order. 4. Pay yourself $5 for real, from a phone, on the chain your customers will actually use. ## What this does not do - No custody. The money goes customer → protocol → your address. We never hold it. - No chargebacks. A settled payment is settled. - No fiat payout. You receive a USD stablecoin or native Bitcoin at your own address, and choose your own off-ramp. ================================================================================================ # Settlement — https://intents.fi/docs/checkout/settlement ================================================================================================ Every payment arrives as one asset, at an address you control: for example USDC on Base, USDT on Tron, or native Bitcoin. That pair is your **settlement target**. The money goes from the customer's payment straight to that address; Intents never holds it, so there is no balance to withdraw and no payout to wait for. | Asset | Chains | |---|---| | USDC | Base, Arbitrum, Ethereum, Solana, Polygon | | USDT | Tron, Ethereum, Arbitrum, BNB Smart Chain | | BTC | Bitcoin (native), [priced in USD](#settling-in-btc) | You can register more than one target (USDC on Base and USDT on Tron, say) and mark one as the **default**. An invoice uses the default unless your `POST /v0/invoices` names another target you have already registered; a key can choose between your registered targets, but can never name an address of its own. ## Invoices snapshot the address Each invoice records its settlement address when it is created and pays to that address, whatever happens to your settings afterwards. A change never touches an invoice that is already open, and the `settlement` field on the invoice always says where its money is going. ## Changing the address Changing where your money lands is the one thing a stolen credential must never be able to do, so it takes more than any other setting: 1. **Only in the dashboard.** Sign in at [dashboard.intents.fi/settlement](https://dashboard.intents.fi/settlement) as an **owner** or **admin** ([Team](/docs/platform/team)), choose the asset, enter the new address, and choose whether it becomes your default. 2. **A fresh email code.** We email a six-digit code to the address you signed in with. It is good for 10 minutes and five tries, and for this one change. 3. **A 24-hour wait in live mode.** The new address takes effect 24 hours after you ask. Until then the old one keeps receiving every new invoice. Nothing has to run at the 24-hour mark: the change lands on time even if nobody is signed in. 4. **An email with a one-click cancel**, sent the moment you ask to every owner and admin on the account and to the account's notification address, not only to you. If you did not ask for the change, open the link: one click cancels it, with no sign-in. Then sign in, review your team and API keys, and email [support@intents.fi](mailto:support@intents.fi). If that email cannot be sent, the change is cancelled again before the dashboard answers, and it says so. A pending change can also be cancelled from the settlement page by an owner or admin. A cancelled change never takes effect. **One change at a time.** While a live change is waiting out its 24 hours, asking for another answers `409` [SETTLEMENT_CHANGE_PENDING](/docs/errors/SETTLEMENT_CHANGE_PENDING). Cancel the pending one first. That stops a second change from hiding behind the first one's email. ## Test mode In test mode a change applies immediately, with no cooling period, and only to **test** invoices. Your live targets are untouched, so you can rehearse a change, or point test payments at a different address, without waiting and without affecting real payments. It still takes the email code, and the notification email is still sent. ## There is no API for it No API key, secret or publishable, can change a settlement address: - `PATCH /v0/merchant` with a `settlement` field answers `403` [SESSION_REQUIRED](/docs/errors/SESSION_REQUIRED). Remove the field; everything else on the merchant profile can still be changed with a secret key. - Any `/v0/merchant/settlement…` path answers `403 SESSION_REQUIRED` too, on every method. - The dashboard's own settlement endpoints refuse an API key with `403 SESSION_REQUIRED` even when a valid dashboard session comes with it, and refuse a team member below admin with `403` [FORBIDDEN](/docs/errors/FORBIDDEN). `GET /v0/merchant` with a secret key shows the targets in effect (`settlements`) and the default (`settlement`), so your code can check them. The WooCommerce plugin's **Test connection** shows it too. ## Settling in BTC You can be paid in native Bitcoin, at your own Bitcoin address. Choose **BTC on Bitcoin** as your payout wallet in the dashboard (setup, go-live, or the Settlement page), with the same fresh email code and 24-hour wait as any other address change. Your prices stay in USD; what changes is how much BTC an invoice is for. **Which addresses.** Any mainnet Bitcoin address: | Type | Starts with | |---|---| | Native SegWit (P2WPKH, P2WSH) | `bc1q…` | | Taproot (P2TR) | `bc1p…` | | Legacy (P2PKH) and nested SegWit (P2SH) | `1…`, `3…` | Every address is checked against its own checksum when you save it, so a mistyped character is refused there and then (`settlement.address is not a valid Bitcoin address`) rather than later. Testnet addresses (`tb1…`, `m…`, `n…`, `2…`) are refused. An all-uppercase `BC1…` address, the form QR codes use, is accepted and stored in lowercase. **How an invoice is priced.** - **The BTC amount is locked from live quotes** when the invoice is created: what the invoice's USD amount buys in BTC right now, asked of every route to Bitcoin, paid to your address. The invoice records it in `settlement.amountExpected` (in sats, 8 decimals) and in `priceLock` (`rateUsd`, the USD price of one BTC it was locked at, and `lockedAt`). - **If the quotes disagree by more than 3%, or none come back,** the invoice isn't created. You get [`503 PRICE_UNAVAILABLE`](/docs/errors/PRICE_UNAVAILABLE/), and retrying a few seconds later usually works. We never price an invoice from a guess. - **When a customer starts paying,** the lock is checked against fresh live quotes. If BTC has moved more than 2% and nothing has been paid yet, the invoice is re-locked at today's price, so the customer pays your USD price, not yesterday's. Once money is on its way, the lock never changes, and a top-up after an underpayment keeps it too. - **You receive the locked amount less the 0.4% fee,** exactly: `settlement.amountNet`, in sats. The fee is charged inside the payment, as on any invoice, and `fee.amount` is in sats too. The lock is the market rate for USDC → BTC, so it includes that route's own cost, typically well under 1%. **Reading a BTC invoice.** `amount` is always the USD price. Everything under `settlement` and `fee.amount` is in sats, so `"155187"` is 0.00155187 BTC, never $155,187. Match your orders on `amount` and `currency`, not on `settlement.*`. The dashboard, the CSV export (`settlement_symbol`, `locked_rate_usd`), the fee statement and the emails show both: the sats with all 8 places, and the USD they were priced at. **What a customer sees.** The price, in USD, first, then how to pay it in the token they choose: any supported token on any supported chain, BTC included. A customer paying in BTC sends it to the payment's own Bitcoin deposit address (Send manually); connecting a wallet isn't offered for BTC paying a BTC invoice. They pay the locked sats, the 0.4% fee and a small network fee on top: a $100 invoice locked at 155187 sats asked 157095 on 2026-11-27, and the merchant received the 154566-sat net. Test-mode invoices settling in BTC use a fixed test rate ($60,000 a coin), labelled as a test rate, and never call a provider. ## Absorbing the route cost By default the customer pays the route cost: an invoice for $49.00 might ask for 49.18 USDT, so you receive exactly $49.00. Turn on `absorbRouteCost` and a customer paying in USDC or USDT pays exactly the invoice amount instead, 49.00 USDT for a $49.00 invoice, and you receive what's left once the route cost is taken: typically a few cents less. ```bash curl -s -X PATCH https://api.intents.fi/v0/merchant \ -H "authorization: Bearer $INTENTS_SECRET_KEY" \ -H 'content-type: application/json' \ -d '{"absorbRouteCost": true}' ``` - **Only stablecoin payments.** It applies when the customer pays with USDC or USDT on a chain Intents Checkout settles on. Every other asset is priced as before, with the route cost on top. - **At most 1%.** If the best route would cost you more than 1% of the invoice, the payment falls back to the default and the customer pays the route cost. A thin route or a stablecoin trading off its peg never costs you more than that. - **New invoices only.** Each invoice records the setting when it's created, as it records the settlement address, so turning it on or off never re-prices an invoice that's already open. The invoice's `absorbRouteCost` field says which applies. Once such a payment has paid the invoice, `settlement.amountNet` (and the "payment received" email) shows what the route delivered, not the invoice amount; `settlement.amountExpected` stays the invoice amount. The settlement transaction is linked from the invoice's `txs.settlement`. ## Before you go live Check the settlement address in the dashboard against the one in your own wallet, character by character, and send a small real payment to it first. Payments are sent straight to that address, so a wrong one cannot be reversed by us. ================================================================================================ # WHMCS — https://intents.fi/docs/checkout/whmcs ================================================================================================ **[Download Intents Checkout for WHMCS](https://intents.fi/integrations/whmcs/download)** (always the latest version) | Build | File | Released | Tested on | SHA-256 | |---|---|---|---|---| | WHMCS 1.0.1 | [`intentsfi-whmcs-1.0.1.zip`](https://intents.fi/integrations/whmcs/download/intentsfi-whmcs-1.0.1.zip) | 2026-11-26 | WHMCS (not yet tested on a live install), PHP 8.3 (unit tests only) | `4b77c4b1dcd2b357dc88147d379eadb3631bc3fe616507dff05d7db84892acf3` | Each versioned file never changes once published, so its link and checksum are safe to pin. 1. Download the zip above and unzip it **onto your WHMCS root**. It adds `modules/gateways/intentsfi.php`, `modules/gateways/intentsfi/` and `modules/gateways/callback/intentsfi.php`. 2. In WHMCS admin, **System Settings → Payment Gateways → All Payment Gateways**, activate **Intents Checkout**. 3. Press **Connect to Intents**, sign in to (or sign up for) the dashboard and approve. You come back to WHMCS connected in **test mode**, with the key and the payment notifications set up. Nothing to copy. See [Plugin Connect](/docs/checkout/connect) for what a connection can do. 4. Open an unpaid USD invoice as a client and press **Pay $… with crypto**. On the hosted page, a test invoice has a **Complete the test payment** button. Press it, and the WHMCS invoice is marked Paid when the webhook arrives. The module has not yet been tested on a live WHMCS install, so we don't name a WHMCS version: its unit tests run against WHMCS function stubs on PHP 8.3. It needs a public `https` System URL so webhooks can reach it. It costs 0.4% of each completed payment, with no per-payment limit; test mode is free. ### Enter keys manually instead 1. In [the dashboard](https://dashboard.intents.fi), check your [settlement](/docs/checkout/settlement) asset and address, and copy your **test** API key (`ik_test_…`). 2. Paste it into **Test secret key**, and copy the read-only webhook URL shown in the settings: `https:///modules/gateways/callback/intentsfi.php`. 3. Add that URL as a webhook endpoint for the same key, subscribed to the `invoice.*` events, either on the dashboard's **Webhooks** page or with the API, and paste the `whsec_…` secret it returns into **Test webhook secret**: ```bash title="curl" curl https://api.intents.fi/v0/webhooks \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "url": "https://northwood.example/hooks/intents" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "url": "https://northwood.example/hooks/intents" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/webhooks", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "url": "https://northwood.example/hooks/intents" }, ) response.raise_for_status() data = response.json() ``` 4. Leave **Test mode** on, **Save Changes**, and press **Test connection**. The status line also shows the mode and the settlement wallet payments go to. The settings hold a test pair and a live pair; **Test mode** picks which one is used, and with it off and no live key nothing falls back to the test key. A key in the wrong slot, or a publishable `pk_` key, is refused. A key you paste over a connected one wins, and **Disconnect** never touches it. There is no fee setting. **Invoices must be in USD.** On an invoice in any other currency, the client sees a message to choose another payment method instead of the button, and the settings page lists the currencies affected. Nothing is converted. Leave **Convert To For Processing** unset for this gateway: an invoice WHMCS converts for processing is refused rather than recorded in the wrong currency. ## How a payment runs 1. When a client opens an unpaid invoice, the module creates an invoice for the balance due with `reference = whmcs--` (`…-test` in test mode) and shows the pay button. Later views reuse it. 2. The client pays on the hosted page. The module takes no part in this step. 3. intents.fi sends signed `invoice.*` webhooks to the callback URL. Only `invoice.paid` adds a payment, through `addInvoicePayment`, with the intents.fi invoice ID as the transaction ID. `` is a short hash of your System URL, so two WHMCS installs on one account never share a reference, and an invoice that belongs to another install or WHMCS invoice is never linked or paid. The `-test` suffix keeps test and live references apart at a glance in the dashboard. If the WHMCS balance changes, or the invoice expires or is cancelled, the next view creates a new invoice (`-r2`, then `-r3`) and the old one is cancelled through the API. While a payment is on its way, no second invoice is offered. ## What each event does | Event | WHMCS | |---|---| | `invoice.paid` | `checkCbInvoiceID`, `checkCbTransID`, `logTransaction`, then `addInvoicePayment` for the invoice amount | | `invoice.processing`, `invoice.underpaid` | a Gateway Log entry | | `invoice.expired`, `invoice.canceled` | a Gateway Log entry. The WHMCS invoice stays Unpaid, and the next view starts a new payment | | `invoice.needs_review` | a Gateway Log entry marked **Needs review** | Deliveries can repeat and arrive out of order. The module records each event ID, never records the same payment twice (`checkCbTransID` checks again), and ranks events. So a late `invoice.expired` after `invoice.paid` changes nothing, while a late `invoice.paid` still records the payment. The module does not record the payment itself, and logs **Needs review** instead, when: - the paid amount, mode or currency differs from what it asked for - the WHMCS invoice is no longer Unpaid (for example, it was paid another way or cancelled) - the payment landed on an invoice the WHMCS invoice has since replaced Check these entries in **Billing → Gateway Log** and add the payment by hand if it is right. ## Refunds There is no refund button. The API has no merchant-initiated refund: a payment that fails is returned to the client automatically, and you refund a completed one from your own wallet, then record it in WHMCS. ## Going live Live payments need a verified email and a payout wallet in the dashboard. 1. Press **Go live** on the gateway's settings and approve. WHMCS switches to live only when that round trip finishes. Before the two steps are done, you are told what is missing and stay in test mode. Go live fills the live key and secret and turns **Test mode** off; the test pair stays. 2. With manual keys instead: register the webhook URL for the **live** key, paste the live key and its secret into the live fields, untick **Test mode**, then **Save Changes**. 3. Pay a real $5 invoice from a phone, on the network your clients use, and check that WHMCS marks it Paid and that the money reaches your address. **Disconnect** revokes the keys and webhooks Connect made, clears those fields and turns **Test mode** back on. You can also disconnect from the dashboard: **Integrations → Connected stores**. ## Troubleshooting - **Invoices stay Unpaid after paying.** The webhook is not arriving or not verifying. Check that the secret is for the same key, and that the System URL is reachable over `https` from the internet. A delivery whose signature does not verify gets a `400` and is retried, and nothing is recorded. **Billing → Gateway Log** shows each delivery. - **Test connection or the status line says the key check failed.** The key is wrong or revoked. Press **Connect to Intents** again, or paste a current key. - **Connect says the System URL is needed.** Set **System Settings → General Settings → System URL** to this site's `https` address. - **Pressing a Connect button says your role is not allowed.** Connect is for admins whose role can configure payment gateways. - **Clients see "available for invoices in US dollars only".** The invoice is not in USD, or WHMCS is converting it for processing. Support is by email: [support@intents.fi](mailto:support@intents.fi). ================================================================================================ # Embedded widget — https://intents.fi/docs/checkout/widget ================================================================================================ ```tsx import { PayButton } from "@intents-fi/react"; router.push("/thanks")} appearance={{ variables: { colorAccent: "#3D5A80", borderRadius: 12 } }} /> ``` The same screens as the hosted page, rendered in your app: a modal sheet from ``, or inline from ``. Create the invoice on your server (the [quickstart](/docs/checkout/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. ```bash npm install @intents-fi/react ``` ## Inline instead of a modal ```tsx import { CheckoutEmbed } from "@intents-fi/react"; ``` ## Props `` takes these. `` 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](/docs/checkout/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` | | `` 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` is not proof of payment `onPaid` fires once, when the invoice is paid, so the page can say thank you. Fulfil the order from the `invoice.paid` [webhook](/docs/platform/webhooks) only: a callback in a browser can be faked, a signed webhook cannot. ## `apiBase` and your own origin 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. ## The ranked list and `payer` 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](/docs/checkout/headless) describes the same ranking on the API. ## Appearance `appearance` is modelled on Stripe's Appearance API: `variables` for the theme, `rules` for per-element overrides keyed by stable `.ifc-*` class names. ```tsx ``` 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](/docs/checkout/appearance) lists every variable, the allowed properties and the class names. ## What you cannot hide 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](/docs/checkout/headless). ## Wallets 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: ```ts 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. ## Any other site: `checkout.js` 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: ```html ``` | 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 `` 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. ## Test it 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](/docs/agents/mcp) `send_test_webhook` does the same from your terminal. ## Next to your other payment methods If your checkout already lists Card and PayPal, put the [Pay with crypto option](/docs/checkout/payment-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](/docs/checkout/add-crypto). Whatever `onPaid` does on the page, ship the order on the verified `invoice.paid` webhook only ([Verify and test webhooks](/docs/platform/verify-webhooks)). ================================================================================================ # WooCommerce — https://intents.fi/docs/checkout/woocommerce ================================================================================================ **[Download Intents Checkout for WooCommerce](https://intents.fi/integrations/woocommerce/download)** (always the latest version) | Build | File | Released | Tested on | SHA-256 | |---|---|---|---|---| | WooCommerce 0.1.1 | [`intents-checkout-crypto-payments-for-woocommerce-0.1.1.zip`](https://intents.fi/integrations/woocommerce/download/intents-checkout-crypto-payments-for-woocommerce-0.1.1.zip) | 2026-11-26 | WordPress 6.5+, WooCommerce 8.9+, PHP 8.0+ | `867bec09c1c4cfec897c25764e29655288385b5248fa1c0a71dce60da5a5fe61` | Each versioned file never changes once published, so its link and checksum are safe to pin. The zip is the build WordPress.org is reviewing. Once the directory listing is approved you can install it from **Plugins → Add New** by searching for Intents Checkout instead. 1. **Install the plugin.** **Plugins → Add New → Upload Plugin**, choose the zip you downloaded, then activate **Intents Checkout**. WooCommerce must be active first. 2. **Click Connect intents.fi.** In **WooCommerce → Settings → Payments → Intents Checkout**, press **Connect intents.fi**, sign in to the [dashboard](https://dashboard.intents.fi) (or sign up: a business name and a country are enough to start) and approve. You land back in WordPress showing **Connected as _your business_ · Test mode** and **Payment notifications: connected ✓**. The plugin made its test key and registered its own webhook: nothing to copy. How it works: [Plugin Connect](/docs/checkout/connect). 3. **Pick your payout.** USDC or USDT on the chain you choose, to your own wallet: the payout wallet is a row of the dashboard's go-live checklist (see [Settlement](/docs/checkout/settlement)). Test mode needs no wallet, so you can do this last. 4. **Place a test order.** Tick **Enable Intents Checkout**, save, and press **Place a test order**. The hosted page shows a **Complete the test payment** button for a test invoice; press it, and the order moves to **Processing** when the webhook says the invoice is paid. When the go-live checklist is done, press **Go live** in the plugin. It gets live keys and a live webhook the same way, and only then switches off test mode. **Disconnect** (in the plugin, or **Integrations** in the dashboard) revokes the store's keys and webhooks at once. ### Entering keys manually Connect needs your WordPress admin and your store on the same `https://` address. If they are not, or you prefer to paste keys: 1. In [the dashboard](https://dashboard.intents.fi), copy your **test** API key (`ik_test_…`). 2. Under **Enter keys manually**, paste it into **Test API key**, and copy the **Webhook URL** the settings page shows. 3. Add that URL as a webhook endpoint for your test key, subscribed to the `invoice.*` events, either on the dashboard's **Webhooks** page or with the API, and paste the `whsec_…` secret it returns into **Test webhook secret**: ```bash title="curl" curl https://api.intents.fi/v0/webhooks \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "url": "https://northwood.example/hooks/intents" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "url": "https://northwood.example/hooks/intents" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/webhooks", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "url": "https://northwood.example/hooks/intents" }, ) response.raise_for_status() data = response.json() ``` 4. **Save changes**, then press **Test connection**: it checks the saved key for the selected mode and shows the merchant, the mode and the settlement address it belongs to. The plugin needs WordPress 6.4+, PHP 8.0+ and WooCommerce 8.9+. It supports High-Performance Order Storage (HPOS) and both the Cart and Checkout **blocks** and the classic shortcode checkout. **The store currency must be USD.** Invoices are priced in USD, so the payment method stays hidden at checkout while the store currency is anything else (the settings page says so), and also while no API key is saved for the selected mode. ## How a payment runs 1. The customer chooses the payment method (titled **Pay with crypto** unless you change it). The plugin creates an invoice for the order total with `reference = order_-` and sends the customer to the hosted payment page. 2. The customer pays there; the plugin has no checkout UI of its own. 3. intents.fi sends signed `invoice.*` webhooks to `/wp-json/intentsfi/v1/webhook`, and the plugin updates the order. `reference` is the API's idempotency key, so a retried checkout lands on the same invoice. The site code is a short hash of your store's address, so two stores on one intents.fi account never share a reference even when their order numbers match. As a backstop, the plugin only uses an invoice created for this order on this store (its `metadata.wc_order_key` and `wc_site_url`): one made for any other order is never used, even if it is paid, and the order gets a reference of its own instead, with a note saying so. If the order total changes, or its invoice expires or is cancelled, the order gets a new invoice (`…-r2`, then `-r3`) and the old one is cancelled through the API. A payment that still lands on a replaced invoice puts the order **On hold** with a note and an admin notice, so a person decides. The customer coming back to the store never marks an order paid. Only the webhook does. Test and live invoices never share a `reference`, so an order first sent to a test invoice and paid after you switch to live mode gets a new live invoice; the test one is never reused. ## What each event does The plugin reads `data`, the invoice as it is when the webhook is delivered, not only the event type. An order is marked paid only when the event is `invoice.paid` **and** `data.status` is `paid`. | Event | Order | |---|---| | `invoice.paid` | `payment_complete()`: **Processing** (or **Completed** for virtual goods) | | `invoice.paid` with `late: true` (paid after the invoice expired or was canceled) | **On hold**, with a note and an admin notice, even if the order was already **Cancelled**: the money is in your wallet, so you decide whether to fulfil it or refund it from your wallet | | `invoice.paid` whose `data.status` is not `paid` | never marked paid: an order note and an admin notice, for a person to check | | `invoice.paid` for an invoice the order has moved off (`-r2`, `-r3`) | **On hold**, with a note naming both amounts and an admin notice | | `invoice.expired`, `invoice.canceled` | **Cancelled**, if nothing was paid. Never an order that is paid, **On hold** or **Refunded**, and never when `data.status` shows the invoice was paid after all | | `invoice.processing`, `invoice.underpaid` | an order note; the order stays unpaid | | `invoice.needs_review` | an order note and an admin notice | Deliveries can repeat and arrive out of order. The plugin remembers each event ID on the order and ranks events, so a duplicate does nothing, and a late `invoice.processing` or `invoice.expired` after `invoice.paid` only adds a note. A webhook whose `data.mode` is not the mode of the secret that verified it is ignored. ## Settings | Setting | Notes | |---|---| | Enable/Disable | offers the payment method at checkout | | Test mode | uses the test key and test secret; no real money moves | | Test / Live API key | `ik_test_…` / `ik_live_…`, stored as passwords | | Test / Live webhook secret | the `whsec_…` returned when the endpoint was registered for that mode | | Webhook URL | read-only, with a copy button: `https:///wp-json/intentsfi/v1/webhook` | | Title, Description | what the customer sees at checkout | | Connection: **Test connection** | checks the saved key for the selected mode and reports the merchant and settlement address. Save first | Endpoints are per mode: register the URL once for the test key and once for the live key, and paste each one's own secret. A webhook is checked against the secret of the mode in effect and then the other one, so an invoice created just before you switch modes still completes its order. ## Going live 1. Register the webhook URL with the **live** key and paste its secret into **Live webhook secret**. 2. Paste the live API key, then turn **Test mode** off. 3. Place a real $5 order from a phone, on the network your customers use, and check it reaches Processing and the money reaches your address. ## Troubleshooting - **Orders stay Pending payment.** The webhook is not arriving or not verifying. Check the secret matches the mode, and that the store is reachable over `https` from the internet: intents.fi delivers only to public `https` URLs, and the settings page warns when the site is not served over HTTPS. A delivery whose signature does not verify gets a `401` and is retried. **WooCommerce → Status → Logs**, source `intentsfi-checkout`, shows each delivery. - **"Test connection" fails with `UNAUTHORIZED`.** The key is wrong for the mode, or it is a publishable `pk_` key. The plugin needs a secret `ik_` key. It checks the *saved* key, so save the settings first. - **The payment method does not show at checkout.** The store currency is not USD, the method is not enabled, or no API key is saved for the selected mode. ================================================================================================ # ADDRESS_BLOCKED — https://intents.fi/docs/errors/ADDRESS_BLOCKED ================================================================================================ The payer address or the refund address could not be accepted for this payment. Every payment attempt screens both addresses before a deposit address or a transaction exists. An address is refused if it is flagged, and also if it could not be checked at all (for example, the screening service timed out). Refusing at this point costs a retry, never money. No funds have moved. `details.field` says which address was refused (`payer` or `refundTo`). `details.retryable` is `true` when the check could not be completed, so the same request may succeed in a moment. ## What to do - If `details.retryable` is `true`, try again after a short wait. - Otherwise ask the customer to pay from a different wallet, or to give a different refund address. - Intents Route callers can see this code from a provider too (deBridge and Relay block flagged addresses). The same advice applies. ## Example response ```json { "error": { "code": "ADDRESS_BLOCKED", "message": "…" } } ``` ================================================================================================ # AFFILIATE_CLOSE_BLOCKED — https://intents.fi/docs/errors/AFFILIATE_CLOSE_BLOCKED ================================================================================================ You can't close your affiliate profile while commission is pending, available or held, or a payout is on its way. Closing would leave money we owe you with nowhere to go. ## What to do - Wait for your pending commission to become available and be paid out by the 5th of a month (payouts need $50 or more available, and a payout wallet). - Held commission is reviewed by support: email support@intents.fi. - Then close the profile again. ## Example response ```json { "error": { "code": "AFFILIATE_CLOSE_BLOCKED", "message": "…" } } ``` ================================================================================================ # AFFILIATE_CLOSED — https://intents.fi/docs/errors/AFFILIATE_CLOSED ================================================================================================ This affiliate profile is closed. Closing is final: the profile can't change, earn or add links, and its code stays reserved so it never points at someone else. ## What to do - Your payout history stays visible in the dashboard. - To join again, email support@intents.fi. ## Example response ```json { "error": { "code": "AFFILIATE_CLOSED", "message": "…" } } ``` ================================================================================================ # AFFILIATE_CODE_LOCKED — https://intents.fi/docs/errors/AFFILIATE_CODE_LOCKED ================================================================================================ Your affiliate code was already changed once. A code can be changed one time only, so links and plugin settings that use either code keep working. ## What to do - Keep using your current code; your previous one still resolves to you. - If you really need a different code, email support@intents.fi. ## Example response ```json { "error": { "code": "AFFILIATE_CODE_LOCKED", "message": "…" } } ``` ================================================================================================ # AFFILIATE_CODE_TAKEN — https://intents.fi/docs/errors/AFFILIATE_CODE_TAKEN ================================================================================================ That code is already someone's code, or a code someone used before. A code points at exactly one affiliate, so a code that was changed keeps resolving to its owner and can't be reused. ## What to do - Try a different code: 6 to 16 lowercase letters, digits or hyphens. - Your current code keeps working until you change it. ## Example response ```json { "error": { "code": "AFFILIATE_CODE_TAKEN", "message": "…" } } ``` ================================================================================================ # AFFILIATE_EXISTS — https://intents.fi/docs/errors/AFFILIATE_EXISTS ================================================================================================ You already have an affiliate profile. Each sign-in has one, with one code and one link. ## What to do - Open Affiliate in the dashboard to see your link, affiliate ID and earnings. - To change your display name, website or code, edit the profile instead (`PATCH /v0/affiliate/me`). ## Example response ```json { "error": { "code": "AFFILIATE_EXISTS", "message": "…" } } ``` ================================================================================================ # AFFILIATE_LINK_EXISTS — https://intents.fi/docs/errors/AFFILIATE_LINK_EXISTS ================================================================================================ You already have a tracked link with that sub-ID. Each sub-ID is one link, so its clicks, signups and earnings add up in one place. ## What to do - Pick a different sub-ID for the new link, or use the existing link. - Removing a link keeps its past clicks; you can then add it again with the same sub-ID. ## Example response ```json { "error": { "code": "AFFILIATE_LINK_EXISTS", "message": "…" } } ``` ================================================================================================ # AFFILIATE_REQUIRED — https://intents.fi/docs/errors/AFFILIATE_REQUIRED ================================================================================================ This sign-in isn't an affiliate yet, so there is no affiliate profile, link or earnings to show. ## What to do - Join the affiliate program from Affiliate in the dashboard (or intents.fi/affiliate). It takes a display name and the affiliate terms. - Signed in with a different email before? Sign in with the one you joined with. ## Example response ```json { "error": { "code": "AFFILIATE_REQUIRED", "message": "…" } } ``` ================================================================================================ # AFFILIATE_SUSPENDED — https://intents.fi/docs/errors/AFFILIATE_SUSPENDED ================================================================================================ This affiliate profile is suspended, so it can't change its profile, links or payout wallet. A suspended profile earns no new commission and isn't included in payouts. ## What to do - Email support@intents.fi from the address you signed in with to ask why, or to appeal. - Your earnings and payout history stay visible in the dashboard. ## Example response ```json { "error": { "code": "AFFILIATE_SUSPENDED", "message": "…" } } ``` ================================================================================================ # ALREADY_ONBOARDED — https://intents.fi/docs/errors/ALREADY_ONBOARDED ================================================================================================ The signed-in user already belongs to an account, so a second one was not created. Setup step 1 creates exactly one account per person. Refusing a second one keeps a double click, or a second tab, from leaving two half-set-up accounts behind. ## What to do - Open the dashboard: your existing account and its setup are there. `details.accountId` names it. - Need a separate account for another business? Email support@intents.fi. ## Example response ```json { "error": { "code": "ALREADY_ONBOARDED", "message": "…" } } ``` ================================================================================================ # AMOUNT_OUT_OF_RANGE — https://intents.fi/docs/errors/AMOUNT_OUT_OF_RANGE ================================================================================================ The amount is below what we will invoice, outside a payment link's own bounds, or outside what the chosen route will carry. There is no maximum invoice amount. - **At invoice creation:** below $1. The error's `details` carries `min`. - **On a payment link where the customer chooses the amount:** the amount they chose is outside the link's smallest and largest amounts. `details.min` and `details.max` are the link's bounds. When you make such a link, the smallest amount must be at least $1, the largest at least the smallest, and the suggested amounts must sit between them. - **At payment:** outside what the provider will quote for that asset at that size, for example below its minimum, which is a cost floor rather than a policy. ## What to do - For a small amount, price it at $1 or more. - On a payment link, ask the customer for an amount between `details.min` and `details.max`. - At payment time, offer the customer another asset. The options endpoint hides assets whose minimum exceeds the invoice amount, so this is rare in a checkout built on it. ## Example response ```json { "error": { "code": "AMOUNT_OUT_OF_RANGE", "message": "…" } } ``` ================================================================================================ # CONNECT_CODE_INVALID — https://intents.fi/docs/errors/CONNECT_CODE_INVALID ================================================================================================ A store plugin tried to exchange a Connect code for its keys, and the code can't be used. `details.reason` says why (see [Plugin Connect](/docs/checkout/connect) for the flow): | `reason` | What happened | |---|---| | `unknown` | No such code was issued. | | `used` | The code was already exchanged. A code works once, and only once. | | `expired` | More than 5 minutes passed between approving and exchanging. | | `verifier` | The `code_verifier` is not the one the code's `code_challenge` was made from. | | `site` | The `site_url` is not the store the code was issued to. | Every exchange spends the code, right or wrong, so a code that leaked can't be tried twice. If a code that was already exchanged is presented again, the connection it made is **revoked** (its keys and webhooks stop at once): only someone replaying the code would send it a second time. ## What to do - **Merchants:** press **Connect intents.fi** in your store's settings again. It takes a few seconds, and nothing from the failed attempt is left behind. - **Plugin authors:** make a fresh `state` and `code_verifier` for every attempt, keep the verifier on your server, exchange the code as soon as the browser comes back, send the same `site_url` you put in the request, and never retry an exchange with the same code. ## Example response ```json { "error": { "code": "CONNECT_CODE_INVALID", "message": "…" } } ``` ================================================================================================ # EMAIL_CHANGED — https://intents.fi/docs/errors/EMAIL_CHANGED ================================================================================================ Your dashboard session's email address is not the one on your intents.fi account. The address was changed at sign-in (for example with a new email on your login), and the change has not been confirmed with us yet. Until it is, the dashboard keeps using the address that was proven: confirmation codes and security emails still go there, and these actions wait: - asking for a confirmation code - changing your payout wallet or settlement address - replacing (rolling) a live API key - inviting a team member or accepting an invite Nothing else is affected: invoices, payments and webhooks keep working. ## What to do - Open **Settings › Email** in the dashboard (`/account/email`). We email a code to your current address, then one to the new address. Enter both and the new address becomes your account email. - If you did not change your email, do not enter any code. Reset your password, sign out of every device, and email `support@intents.fi`. The response's `details` carries `email` (the current account address) and `pendingEmail` (the address waiting to be confirmed). ## Example response ```json { "error": { "code": "EMAIL_CHANGED", "message": "…" } } ``` ================================================================================================ # FORBIDDEN — https://intents.fi/docs/errors/FORBIDDEN ================================================================================================ You are signed in to the dashboard, but your team role does not allow this action. Roles, from most to least access: **owner**, **admin**, **developer**, **viewer**. Owners and admins manage settlement addresses and the team. Developers manage API keys and webhooks. Viewers can read but not change anything. `details.allowed` lists the roles that may do what you tried. ## What to do - Ask an owner or admin on your team to make the change, or to give you a role that can. - An invite only works for the email address it was sent to. Sign in with that address to accept it. - An admin cannot grant the owner role or change an owner. Only an owner can, and the last owner of an account cannot be removed or demoted. ## Example response ```json { "error": { "code": "FORBIDDEN", "message": "…" } } ``` ================================================================================================ # Error codes — https://intents.fi/docs/errors/ ================================================================================================ Every intents.fi error has the same body: ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`. It is stable; `message` is written for a human and may be reworded, and the HTTP status is not specific enough on its own — three different codes return `422`. Some errors carry `details` with the field or the values that were wrong, and a provider failure carries `provider`. | Code | HTTP | Page | |---|---|---| | `ADDRESS_BLOCKED` | 403 | [ADDRESS_BLOCKED](/docs/errors/ADDRESS_BLOCKED) | | `AFFILIATE_CLOSE_BLOCKED` | 409 | [AFFILIATE_CLOSE_BLOCKED](/docs/errors/AFFILIATE_CLOSE_BLOCKED) | | `AFFILIATE_CLOSED` | 403 | [AFFILIATE_CLOSED](/docs/errors/AFFILIATE_CLOSED) | | `AFFILIATE_CODE_LOCKED` | 409 | [AFFILIATE_CODE_LOCKED](/docs/errors/AFFILIATE_CODE_LOCKED) | | `AFFILIATE_CODE_TAKEN` | 409 | [AFFILIATE_CODE_TAKEN](/docs/errors/AFFILIATE_CODE_TAKEN) | | `AFFILIATE_EXISTS` | 409 | [AFFILIATE_EXISTS](/docs/errors/AFFILIATE_EXISTS) | | `AFFILIATE_LINK_EXISTS` | 409 | [AFFILIATE_LINK_EXISTS](/docs/errors/AFFILIATE_LINK_EXISTS) | | `AFFILIATE_REQUIRED` | 404 | [AFFILIATE_REQUIRED](/docs/errors/AFFILIATE_REQUIRED) | | `AFFILIATE_SUSPENDED` | 403 | [AFFILIATE_SUSPENDED](/docs/errors/AFFILIATE_SUSPENDED) | | `ALREADY_ONBOARDED` | 409 | [ALREADY_ONBOARDED](/docs/errors/ALREADY_ONBOARDED) | | `AMOUNT_OUT_OF_RANGE` | 422 | [AMOUNT_OUT_OF_RANGE](/docs/errors/AMOUNT_OUT_OF_RANGE) | | `CONNECT_CODE_INVALID` | 400 | [CONNECT_CODE_INVALID](/docs/errors/CONNECT_CODE_INVALID) | | `EMAIL_CHANGED` | 403 | [EMAIL_CHANGED](/docs/errors/EMAIL_CHANGED) | | `FORBIDDEN` | 403 | [FORBIDDEN](/docs/errors/FORBIDDEN) | | `INVOICE_EXPIRED` | 410 | [INVOICE_EXPIRED](/docs/errors/INVOICE_EXPIRED) | | `INVOICE_NOT_OPEN` | 409 | [INVOICE_NOT_OPEN](/docs/errors/INVOICE_NOT_OPEN) | | `LIVE_MODE_LOCKED` | 403 | [LIVE_MODE_LOCKED](/docs/errors/LIVE_MODE_LOCKED) | | `MERCHANT_RESTRICTED` | 403 | [MERCHANT_RESTRICTED](/docs/errors/MERCHANT_RESTRICTED) | | `NO_ROUTE_FOR_ASSET` | 422 | [NO_ROUTE_FOR_ASSET](/docs/errors/NO_ROUTE_FOR_ASSET) | | `NOT_IMPLEMENTED` | 501 | [NOT_IMPLEMENTED](/docs/errors/NOT_IMPLEMENTED) | | `PRICE_UNAVAILABLE` | 503 | [PRICE_UNAVAILABLE](/docs/errors/PRICE_UNAVAILABLE) | | `SESSION_REQUIRED` | 403 | [SESSION_REQUIRED](/docs/errors/SESSION_REQUIRED) | | `SETTLEMENT_ASSET_UNSUPPORTED` | 422 | [SETTLEMENT_ASSET_UNSUPPORTED](/docs/errors/SETTLEMENT_ASSET_UNSUPPORTED) | | `SETTLEMENT_CHANGE_PENDING` | 409 | [SETTLEMENT_CHANGE_PENDING](/docs/errors/SETTLEMENT_CHANGE_PENDING) | | `SETTLEMENT_REQUIRED` | 422 | [SETTLEMENT_REQUIRED](/docs/errors/SETTLEMENT_REQUIRED) | | `STEP_UP_REQUIRED` | 403 | [STEP_UP_REQUIRED](/docs/errors/STEP_UP_REQUIRED) | | `TEST_MODE_ONLY` | 403 | [TEST_MODE_ONLY](/docs/errors/TEST_MODE_ONLY) | | `TRANSFER_MODE_UNAVAILABLE` | 422 | [TRANSFER_MODE_UNAVAILABLE](/docs/errors/TRANSFER_MODE_UNAVAILABLE) | Intents Route codes that are not listed above (`NO_ROUTE`, `QUOTE_EXPIRED`, `QUOTE_DRIFT`, `UNTRUSTED_EXECUTION_TARGET`, `PROVIDER_ERROR`, `PROVIDER_TIMEOUT`, `RATE_LIMITED`) are in the table on the [Route overview](/docs/route#errors-you-will-meet). ## The Intents Checkout ones worth handling explicitly - [`INVOICE_EXPIRED`](/docs/errors/INVOICE_EXPIRED) — create a new invoice with a new reference - [`INVOICE_NOT_OPEN`](/docs/errors/INVOICE_NOT_OPEN) — you cancelled, or it is already paid - [`AMOUNT_OUT_OF_RANGE`](/docs/errors/AMOUNT_OUT_OF_RANGE) — below the $1 minimum, outside a link's bounds, or below a provider's minimum - [`NO_ROUTE_FOR_ASSET`](/docs/errors/NO_ROUTE_FOR_ASSET) — nothing can move that token right now; offer another Everything else is either a mistake in the request, which the message names, or something only we can fix — in which case email [support@intents.fi](mailto:support@intents.fi) with the response body. ================================================================================================ # INVOICE_EXPIRED — https://intents.fi/docs/errors/INVOICE_EXPIRED ================================================================================================ The invoice passed its `expiresAt` and is now `expired`. An expired invoice cannot be paid or cancelled. ## An invoice's lifetime Invoices expire on their own clock — 30 minutes by default, `expiresInSec` on create (300 s to 86 400 s). An attempt that has already been detected keeps its invoice alive for a 10-minute grace, so an in-flight deposit still settles. ## What to do Create a new invoice. Reuse your own order ID as the `reference` only if you want the old invoice back: `reference` is unique per merchant and mode, so the same value returns the expired invoice rather than a fresh one. For a retry, use a new reference (`order_1042.2`) or leave it out. ## Late payments If a deposit lands after expiry and still completes, the invoice becomes `paid` with `needsReview: true`, and `invoice.paid` arrives with `late: true`. The money is yours; you decide whether to fulfil. ## Example response ```json { "error": { "code": "INVOICE_EXPIRED", "message": "…" } } ``` ================================================================================================ # INVOICE_NOT_OPEN — https://intents.fi/docs/errors/INVOICE_NOT_OPEN ================================================================================================ The invoice is in a status that does not allow what you asked for. Cancelling works while an invoice is `open` or `underpaid`. It is refused once the invoice is `paid`, `canceled`, or `processing` — a `processing` invoice has a payment in flight, and we never write off an invoice a customer is part-way through paying. ## What to do Read the invoice and act on its status: ```bash curl https://api.intents.fi/v0/invoices/inv_… -H "Authorization: Bearer $INTENTS_SECRET_KEY" ``` - `paid` — nothing to do; fulfil the order. - `processing` — wait. You will get `invoice.paid` (or `invoice.underpaid`) when it resolves. - `canceled` — already done. - `expired` — see [`INVOICE_EXPIRED`](INVOICE_EXPIRED.md). To stop accepting payment for an order you no longer want to fulfil, cancel it before a customer starts paying, and refund any late payment yourself (we never hold the funds). ## Example response ```json { "error": { "code": "INVOICE_NOT_OPEN", "message": "…" } } ``` ================================================================================================ # LIVE_MODE_LOCKED — https://intents.fi/docs/errors/LIVE_MODE_LOCKED ================================================================================================ Live mode isn't open for this account yet. It opens when all three go-live rows are done: 1. **Your email is confirmed.** Signing in with Google, or with GitHub, Discord or Microsoft on a verified address, does it automatically; otherwise enter the code we email you. 2. **Your payout wallet is set.** 3. **Your account review is done.** It starts when you sign up and usually takes one business day. The error's `details.missing` lists what is left: `email`, `payout_wallet` and/or `review`. ## What to do - Open the dashboard home: the go-live checklist shows each row and what to do about it. - Test mode is never locked. Keep building with `ik_test_` keys meanwhile. ## Example response ```json { "error": { "code": "LIVE_MODE_LOCKED", "message": "…" } } ``` ================================================================================================ # MERCHANT_RESTRICTED — https://intents.fi/docs/errors/MERCHANT_RESTRICTED ================================================================================================ The merchant account cannot transact, or cannot be created. - **`status: restricted` or `closed`.** No new invoices and no new payments. Existing paid invoices are unaffected: we never held the funds. - **At onboarding, a business we cannot serve,** under the acceptable-use rules in our Terms of Service. ## What to do Email [support@intents.fi](mailto:support@intents.fi) — support is email only, and a human reads it. Include your merchant ID (`mer_…`). If the account was restricted, the reason is already in your inbox. ## Example response ```json { "error": { "code": "MERCHANT_RESTRICTED", "message": "…" } } ``` ================================================================================================ # NO_ROUTE_FOR_ASSET — https://intents.fi/docs/errors/NO_ROUTE_FOR_ASSET ================================================================================================ No provider would quote a route from the asset the customer chose to your settlement asset, for this amount, right now. Unlike Intents Route's `NO_ROUTE`, this is scoped to one invoice and one source asset: other assets usually still work. Causes are a pair no provider covers, every provider failing or rate- limiting at once, or an amount outside what the route supports (that is [`AMOUNT_OUT_OF_RANGE`](AMOUNT_OUT_OF_RANGE.md) when we can tell). It is also the answer, before anything is quoted, for an asset that **cannot pay this invoice at all**. That covers a token on Bitcoin or NEAR (they pay in their native coin only), an asset only Mayan routes (Intents Checkout is exact-output only), and the settlement asset itself. `POST …/attempts`, `POST …/agent` and `GET …/options?assets=` all refuse these with `details: { field, asset }`, in live and test mode alike. `GET /v0/checkout/{invoiceId}/assets` never lists them. *Raised from Phase C1, when payment attempts ship.* ## What to do Offer another asset. `GET /v0/checkout/{invoiceId}/options` only lists assets that quoted, and `GET …/assets` only lists assets that can pay, so a checkout built on them rarely sees this. It shows up when a quote expires between listing and paying, or when a hard-coded asset is not payable. Re-read `options`, or search `assets`, and let the customer pick again. ## Example response ```json { "error": { "code": "NO_ROUTE_FOR_ASSET", "message": "…" } } ``` ================================================================================================ # NOT_IMPLEMENTED — https://intents.fi/docs/errors/NOT_IMPLEMENTED ================================================================================================ The endpoint exists and its request and response shapes are final, but the implementation behind it has not shipped yet. This is how the Intents Checkout endpoints (`SPEC-checkout.md` §4.3) answer between session C1-0, which published their contracts, and session C1a, which builds the payment engine. The shapes are in `/v0/openapi.json` and in the generated SDK types from the moment the contract lands, so an integration can be written, typed and tested against fixtures before the engine is live. `details.session` names the session that implements it. ```json { "error": { "code": "NOT_IMPLEMENTED", "message": "GET /v0/checkout/{invoiceId} is not implemented yet; its request and response shapes are final", "details": { "session": "C1a (payment engine)" } } } ``` ## What to do Build against the published shape and the fixtures, not against the live endpoint: - `@intents-fi/checkout-fixtures` ships one example payload per endpoint and per invoice and attempt state, plus MSW handlers, so an app runs end to end with no API at all. - The request schema is enforced already. A malformed body returns `400 INVALID_REQUEST` from this endpoint today, exactly as it will once the engine is live. Nothing about the request or response changes when the implementation lands. If this code appears on an endpoint you expected to work, the deployment is behind the SDK you are using: check `GET /health` for the running version. ## Example response ```json { "error": { "code": "NOT_IMPLEMENTED", "message": "…" } } ``` ================================================================================================ # PRICE_UNAVAILABLE — https://intents.fi/docs/errors/PRICE_UNAVAILABLE ================================================================================================ An invoice settling in BTC couldn't be priced just now. An invoice in BTC is priced in USD, so the amount of BTC is locked from live quotes when the invoice is created, and checked again when the customer starts paying. This error means no route quoted, or the quotes disagreed by more than 3%. Either way, no reliable price could be set, so nothing was created and nothing was charged. ## What to do - Retry in a few seconds. `details.retryable` is `true`, and it's usually a provider being slow or briefly unavailable. - If it keeps happening, create the invoice settling in a USD stablecoin instead, which never needs a price. A customer who sees this while paying can simply try again. Their invoice is unchanged. ## Example response ```json { "error": { "code": "PRICE_UNAVAILABLE", "message": "…" } } ``` ================================================================================================ # SESSION_REQUIRED — https://intents.fi/docs/errors/SESSION_REQUIRED ================================================================================================ This action can only be taken from the intents.fi dashboard by a signed-in team member. An API key was sent, and API keys are never allowed here. The routes that answer this way are the ones a stolen key must not reach: changing a settlement address (where your money lands), managing team members, and creating or revoking API keys. The API refuses a key on them even when a valid dashboard session comes with it, so a leaked key can never redirect a payout. ## What to do - Make the change from `dashboard.intents.fi` instead. A settlement change also asks for a fresh email code and takes effect 24 hours later, with a cancel link in the email. - If your integration called `PATCH /v0/merchant` with a `settlement` field, remove that field. Everything else on the merchant profile can still be changed with a secret key. ## Example response ```json { "error": { "code": "SESSION_REQUIRED", "message": "…" } } ``` ================================================================================================ # SETTLEMENT_ASSET_UNSUPPORTED — https://intents.fi/docs/errors/SETTLEMENT_ASSET_UNSUPPORTED ================================================================================================ The asset you asked to be settled in is not one you can be settled in. Two causes: 1. **Not a settlement asset.** You can be settled in USDC on Base, Arbitrum, Ethereum, Solana and Polygon; USDT on Tron, Ethereum, Arbitrum and BNB Smart Chain; or native BTC on Bitcoin (`bip122:000000000019d6689c085ae165831e93/slip44:0`), whose amount is [locked from live quotes](/docs/checkout/settlement#settling-in-btc) when the invoice is created. The error's `details.supported` lists them. 2. **Not registered for your merchant account.** `settlement` on `POST /v0/invoices` chooses between the targets you have already registered. An API key can never introduce a new address. ## What to do - Price and settle in one of the supported assets, or - add the settlement target in the dashboard first. That takes a session with fresh email OTP and the new address waits out a 24-hour cooling period, because a key that could redirect a payout would drain you if it leaked. Omit `settlement` entirely to use your default target. ## Example response ```json { "error": { "code": "SETTLEMENT_ASSET_UNSUPPORTED", "message": "…" } } ``` ================================================================================================ # SETTLEMENT_CHANGE_PENDING — https://intents.fi/docs/errors/SETTLEMENT_CHANGE_PENDING ================================================================================================ A settlement address change is already in flight for this asset, inside its 24-hour cooling period. Changing where your money lands is the one action a stolen key must never be able to take. So it takes a dashboard session with fresh email OTP, the new address takes effect 24 hours later, and you get an email at request time with a one-click cancel. Until then the old address stays in effect, and invoices created now snapshot the old address. *Raised from Phase C2, when settlement changes ship in the dashboard.* ## What to do - Wait for the pending change, or cancel it from the email or the dashboard and request again. - Test mode has no cooling period, so integration testing is not blocked. Invoices already open are never affected: each one snapshots its settlement address at creation. ## Example response ```json { "error": { "code": "SETTLEMENT_CHANGE_PENDING", "message": "…" } } ``` ================================================================================================ # SETTLEMENT_REQUIRED — https://intents.fi/docs/errors/SETTLEMENT_REQUIRED ================================================================================================ A live invoice was asked for, but this merchant has no payout wallet yet. New accounts start without one: test mode works straight away against a test wallet (no real money), and the payout wallet is one row of the go-live checklist on your dashboard home. Nothing live can be created until it is set, so no payment is ever taken with nowhere to send it. ## What to do - Open the dashboard home and add your payout wallet in the go-live checklist. The first wallet takes effect at once; later changes take an email code and a 24-hour wait. - Building and testing? Use a test key (`ik_test_`): test invoices never need a payout wallet. ## Example response ```json { "error": { "code": "SETTLEMENT_REQUIRED", "message": "…" } } ``` ================================================================================================ # STEP_UP_REQUIRED — https://intents.fi/docs/errors/STEP_UP_REQUIRED ================================================================================================ Changing your affiliate payout wallet needs a fresh email code, and this request didn't carry a valid one: it was missing, wrong, expired or already used. Your first payout wallet takes effect at once. Every later change is the one action someone with your browser session must not be able to take quietly, so it needs a six-digit code we email to your sign-in address. ## What to do - Ask for a code (in the dashboard, or `POST /v0/affiliate/step-up`), then send the change again with `stepUpCode` set. - A code is good for ten minutes, once only, and dies after five wrong tries. Ask for a new one if it has expired. - A wallet changed less than 24 hours before a payout run waits until the next month's run. ## Example response ```json { "error": { "code": "STEP_UP_REQUIRED", "message": "…" } } ``` ================================================================================================ # TEST_MODE_ONLY — https://intents.fi/docs/errors/TEST_MODE_ONLY ================================================================================================ This action only works in test mode, and it was asked of a live key or a live-mode webhook endpoint. Today that is one thing: a **test event with a sample invoice** (`invoice.paid`, `invoice.processing` and so on), from `POST /v0/webhooks/{id}/test` or **Send test event** in the dashboard. A sample invoice is made up: nothing was paid. It is only sent to test-mode endpoints so that a live receiver can never be handed something shaped like a paid invoice that was not paid. ## What to do - Call `POST /v0/webhooks/{id}/test` with an `ik_test_` key, for an endpoint registered with that key. - In the dashboard, switch to **Test mode** and send the test event from the test endpoint. - To check that a **live** endpoint is reachable and verifies signatures, send it the `webhook.test` ping instead: it carries no invoice. ## Example response ```json { "error": { "code": "TEST_MODE_ONLY", "message": "…" } } ``` ================================================================================================ # TRANSFER_MODE_UNAVAILABLE — https://intents.fi/docs/errors/TRANSFER_MODE_UNAVAILABLE ================================================================================================ You asked to pay an invoice in `transfer` mode with an asset no provider will take at a deposit address. Transfer mode is "send from an exchange or any wallet": the customer gets an address, a QR code and an exact amount. It needs a provider that hands out a deposit address for that asset. Wallet mode, where the customer's connected wallet signs a transaction, works for more assets. *Raised from Phase C1, when payment attempts ship.* ## What to do - Offer the customer `wallet` mode for this asset, or - offer an asset whose `modes` include `transfer`. `GET /v0/checkout/{invoiceId}/options` returns `modes` per asset, so a checkout that reads it never shows a combination that cannot be paid. ## Example response ```json { "error": { "code": "TRANSFER_MODE_UNAVAILABLE", "message": "…" } } ``` ================================================================================================ # Account and API keys — https://intents.fi/docs/get-started ================================================================================================ ```bash export INTENTS_SECRET_KEY=ik_test_… # never in a browser, never in a repo ``` One account and one set of keys work for both products. This page is the shared part; after it, go to your product: [Intents Checkout quickstart](/docs/checkout/quickstart) to get paid, or [Route quickstart](/docs/route/quickstart) to swap and move funds across chains. To have a coding agent do it, see [build with your AI agent](/docs/agent-setup). ## Your account [Sign up](https://dashboard.intents.fi/signup) with Google, GitHub, Discord, X, your wallet or email. Setup asks a few questions about your business and hands you a test key. Already have an account? [Log in](https://dashboard.intents.fi/login). Intents Checkout merchants also go through a short go-live checklist before they can take real payments; it's on the [Intents Checkout overview](/docs/checkout#going-live). ## The four keys There are four kinds, and each is shown once when it is made. Make them on the [keys page](https://dashboard.intents.fi/keys) (Developers → API keys): | Key | Prefix | Use it for | |---|---|---| | Secret, test | `ik_test_` | server-side calls in test mode | | Secret, live | `ik_live_` | server-side calls with real money | | Publishable, test | `pk_test_` | browser-safe Intents Checkout calls in test | | Publishable, live | `pk_live_` | browser-safe Intents Checkout calls in live | A **secret** key belongs on your server and nowhere else. A **publishable** key is safe in a browser: it cannot read your invoices or create a custom one. No key of any kind can change an Intents Checkout settlement address. That needs a dashboard session with a fresh email code and a 24-hour wait, which is the one defence that matters if a key leaks. Send a key as `authorization: Bearer `. Keys are listed, created, rolled and revoked in the [dashboard](https://dashboard.intents.fi/keys). Rolling gives you a new key and keeps the old one working for 24 hours, so you can swap it without downtime. ## Test mode and live mode A key's prefix decides the mode; there is no header to set and no way to mix them. - **Intents Checkout** has a full test mode. A test invoice quotes and settles against recorded fixtures: no chain is touched and no money moves, so you can run the whole flow in CI. Live keys open once the [go-live checklist](/docs/checkout#going-live) is done; until then they fail with [`LIVE_MODE_LOCKED`](/docs/errors/LIVE_MODE_LOCKED/). - **Intents Route** has no test mode. Quotes and orders are real with either key, because they come from the protocols themselves. Nothing moves until your user's own wallet signs a step, so develop with small amounts. A test invoice is invisible in live mode and the other way round. The dashboard has one toggle at the top that switches everything at once. ## What a mistake looks like Every error from either product has the same body: ```json { "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } } ``` Switch on `code`, never on `message` or on the HTTP status alone. Each code has a page under [/errors](/docs/errors/) saying what to do about it. ## Next - [Intents Checkout quickstart](/docs/checkout/quickstart) — create an invoice and get it paid - [Route quickstart](/docs/route/quickstart) — quote, execute and track a cross-chain swap - [Webhooks](/docs/platform/webhooks) — find out when something changes without polling ================================================================================================ # Server helpers — https://intents.fi/docs/platform/server-sdk ================================================================================================ ```ts import { createInvoice, verifyWebhook, WebhookSignatureError } from "@intents-fi/sdk"; // Your server, when the customer picks "Pay with crypto": const invoice = await createInvoice({ amount: "42.00", reference: order.id }); // → invoice.url for a redirect, or invoice.id + invoice.clientSecret for the pop-up // Your webhook route: const event = await verifyWebhook(rawBody, request.headers, process.env.INTENTS_WEBHOOK_SECRET); if (event.type === "invoice.paid") await markPaid(event.data.reference); ``` **Ship the order only on the `invoice.paid` webhook.** The browser's `onPaid` callback, the pop-up's `paid` message and the redirect to your thank-you page are for the customer's screen. Anyone can fire them from a browser console; only a verified webhook comes from us. ## createInvoice `createInvoice(params, options?)` is `POST /v0/invoices` with one rule added: **`reference` is required**. Pass your own order id. Calling it twice for the same order (a retried request, a double click, a refreshed page) returns the same invoice rather than a second one. The repeat carries `clientSecret: null`, because the secret is only shown once: keep the first one, or use `url`. | Option | Default | |---|---| | `apiKey` | `INTENTS_SECRET_KEY`. Use an `ik_test_` key while you build | | `baseUrl` | `INTENTS_API_URL`, else `https://api.intents.fi` | | `fetch` | the global `fetch` | | `client` | an existing `createClient()` instance, instead of the three above | It throws `IntentsError` with the API's error code (`INVALID_REQUEST`, `UNAUTHORIZED`, …). Every field is the generated `CreateInvoiceRequest` type: ```bash title="curl" curl https://api.intents.fi/v0/invoices \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'x-intents-affiliate: ' \ -H 'content-type: application/json' \ -d '{ "amount": "49.00", "settlement": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "address": "0x6A3fB91c7D8e45A2b0C1fE97D3a8B52c4e7F10dA" }, "reference": "order_1042", "description": "Pro plan — 1 month", "customerEmail": "ana@example.com", "successUrl": "https://northwood.example/thanks" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/invoices", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "amount": "49.00", "settlement": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "address": "0x6A3fB91c7D8e45A2b0C1fE97D3a8B52c4e7F10dA" }, "reference": "order_1042", "description": "Pro plan — 1 month", "customerEmail": "ana@example.com", "successUrl": "https://northwood.example/thanks" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/invoices", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "amount": "49.00", "settlement": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "address": "0x6A3fB91c7D8e45A2b0C1fE97D3a8B52c4e7F10dA" }, "reference": "order_1042", "description": "Pro plan — 1 month", "customerEmail": "ana@example.com", "successUrl": "https://northwood.example/thanks" }, ) response.raise_for_status() data = response.json() ``` ## verifyWebhook `verifyWebhook(rawBody, headers, secret, { toleranceSeconds? })` checks the `X-Intents-Signature` HMAC and that its timestamp is within five minutes, then returns the event, typed. It throws `WebhookSignatureError`; its `reason` is one of `raw_body_required`, `missing_secret`, `missing_signature`, `malformed_signature`, `timestamp_out_of_tolerance`, `signature_mismatch` or `invalid_payload`. Answer `400` when it throws and do nothing else. ### It needs the raw body The signature covers the bytes we sent. A framework that has parsed the JSON for you has thrown those bytes away, and a re-serialised body never verifies. **Next.js (App Router)** ```ts export async function POST(request: Request) { const raw = await request.text(); try { const event = await verifyWebhook(raw, request.headers, process.env.INTENTS_WEBHOOK_SECRET); // … } catch (e) { if (e instanceof WebhookSignatureError) return new Response("bad signature", { status: 400 }); throw e; } return new Response("ok"); } ``` **Express.** Mount `express.raw` on the webhook route, before any `express.json()`: ```ts app.post("/webhooks/intents", express.raw({ type: "application/json" }), async (req, res) => { const event = await verifyWebhook(req.body, req.headers, process.env.INTENTS_WEBHOOK_SECRET); // req.body is a Buffer here res.sendStatus(200); }); ``` **Hono** ```ts app.post("/webhooks/intents", async (c) => { const event = await verifyWebhook(await c.req.text(), c.req.raw.headers, c.env.INTENTS_WEBHOOK_SECRET); return c.text("ok"); }); ``` It runs on WebCrypto, so the same call works in Node 18+, edge runtimes and Workers. ### The event types ```ts type WebhookEvent = InvoiceEvent | WebhookPingEvent; // event.type: "invoice.processing" | "invoice.underpaid" | "invoice.paid" | "invoice.expired" // | "invoice.canceled" | "invoice.needs_review" | "webhook.test" ``` Switching on `event.type` narrows `event.data` to the invoice (the same shape as `GET /v0/invoices/{id}`), or to the ping. Three small helpers: | Helper | True when | |---|---| | `isFinal(event)` | the invoice will not change again: `paid`, `expired` or `canceled` | | `isInvoiceEvent(event)` | it is an `invoice.*` event, not the `webhook.test` ping | | `isTestEvent(event)` | it came from **Send test event**: a ping, or a sample invoice (`sample: true`). Acknowledge it, never ship on it | ### What it does not do for you - **Duplicates.** The same event can arrive twice: a retry, or **Resend** in the dashboard, which re-sends the same `event.id`. `verifyWebhook` accepts both, because both are genuine. Make `markPaid` idempotent, or record `event.id` and skip one you have seen. - **Order.** Events can arrive out of order. Act on `event.data.status`, and never move an order backwards. ## PHP The same two calls for PHP, in one file with no framework: [intents-php](/docs/platform/server-sdk-php). See [Verify and test webhooks](/docs/platform/verify-webhooks) for duplicates, ordering and the test tools, and [Webhooks](/docs/platform/webhooks) for the events and the retry schedule. The whole flow is in [Add crypto to your existing checkout](/docs/checkout/add-crypto). ================================================================================================ # PHP helper (intents-php) — https://intents.fi/docs/platform/server-sdk-php ================================================================================================ ```php require __DIR__ . '/intents.php'; $intents = new \IntentsFi\Intents(getenv('INTENTS_SECRET_KEY')); $invoice = $intents->createInvoice(['amount' => '42.00', 'reference' => $orderId]); ``` One file, no framework, no Composer needed: copy [`intents.php`](https://github.com/devluke24/intentsfi/blob/main/packages/php/intents.php) next to your code, or `composer require intents-fi/intents-php`. PHP 7.4 or later; `createInvoice` needs the `curl` extension. The WooCommerce, WHMCS and PrestaShop plugins check signatures with the same code. **Ship the order only on a verified `invoice.paid` webhook.** The customer landing on your thank-you page, or the pop-up saying it is done, is for their screen. ## createInvoice ```php $intents = new \IntentsFi\Intents(getenv('INTENTS_SECRET_KEY')); // ik_test_… while you build $invoice = $intents->createInvoice([ 'amount' => '42.00', // USD, from your own records 'reference' => $orderId, // required: a repeat returns the same invoice 'successUrl' => 'https://shop.example/thanks', ]); // $invoice['id'], $invoice['url'] (hosted page), $invoice['clientSecret'] (for the pop-up) ``` The API origin defaults to `INTENTS_API_URL`, else `https://api.intents.fi`; pass it as the second constructor argument to override. Errors throw `\IntentsFi\ApiError`, with the API's code in `->errorCode` (`INVALID_REQUEST`, `UNAUTHORIZED`, …) and the HTTP status in `->status`. `getInvoice($id)` returns the same shape a webhook's `data` carries. ## verifyWebhook ```php try { $event = \IntentsFi\Intents::verifyWebhook( file_get_contents('php://input'), // the raw body, never a re-encoded one $_SERVER, // reads HTTP_X_INTENTS_SIGNATURE getenv('INTENTS_WEBHOOK_SECRET') ); } catch (\IntentsFi\WebhookSignatureError $e) { http_response_code(400); exit; } if ($event['type'] === 'invoice.paid' && !\IntentsFi\Intents::isTestEvent($event)) { mark_paid($event['data']['reference']); // must be safe to run twice } http_response_code(204); ``` `$headers` may be `$_SERVER`, `getallheaders()`, any header array in any letter case, or the header value itself. It checks the HMAC and that the timestamp is within five minutes (the fourth argument changes the window). `WebhookSignatureError->reason` is one of `missing_secret`, `missing_signature`, `malformed_signature`, `timestamp_out_of_tolerance`, `signature_mismatch` or `invalid_payload`, the same values as the [TypeScript helper](/docs/platform/server-sdk). | Helper | True when | |---|---| | `Intents::isFinal($event)` | the invoice will not change again: paid, expired or canceled | | `Intents::isTestEvent($event)` | it came from **Send test event**: acknowledge it, never ship on it | ## A complete example [Example: plain PHP](/docs/checkout/examples/php): a checkout endpoint, a webhook endpoint and one page, run in CI against a test key. [Verify and test webhooks](/docs/platform/verify-webhooks) covers duplicates, ordering and testing your receiver. ================================================================================================ # Team — https://intents.fi/docs/platform/team ================================================================================================ Everyone who signs in to [dashboard.intents.fi](https://dashboard.intents.fi) does so as themselves, with their own email address, and acts for an account with one of four roles. The same roles apply to every intents.fi product. The team is managed at [dashboard.intents.fi/team](https://dashboard.intents.fi/team). ## Roles From most to least access: | | Owner | Admin | Developer | Viewer | |---|:-:|:-:|:-:|:-:| | See invoices, payments, settings | yes | yes | yes | yes | | Change the [settlement](/docs/checkout/settlement) address | yes | yes | | | | Manage the team (invite, change roles, remove) | yes | yes | | | | Attach a custom checkout domain | yes | yes | | | | Change notification settings | yes | yes | | | | Create and revoke API keys | yes | yes | yes | | | Manage webhook endpoints | yes | yes | yes | | | Create and switch off [payment links](/docs/checkout/payment-links) | yes | yes | yes | | | Edit [branding](/docs/checkout/appearance) | yes | yes | yes | | | Make or change an owner | yes | | | | The actions that move money or decide who is in the account are owner and admin only. A developer can build (keys, webhooks, payment links, branding), and a viewer can only look. The dashboard hides what your role cannot do; the API refuses it anyway. ## Invites An owner or admin invites someone by email address, with a role: - **The invite lasts 7 days** and works once. - **Only the invited address can accept it.** The person signs in with that email address; an invite link forwarded to anyone else is refused with `403` [FORBIDDEN](/docs/errors/FORBIDDEN). - **Nobody can grant a role above their own**, and only an owner can invite an owner. An admin can invite admins, developers and viewers. - Inviting the same address again replaces the earlier invite, so there is one live link per person. An open invite can be revoked from the team page. Someone already on the team cannot be invited again. ## Changing roles and removing people An owner or admin can change a member's role or remove them, with two limits: - **Only an owner can change an owner**, including making someone an owner or removing one. - **An account always has an owner.** The last owner cannot be removed or given another role: make someone else an owner first. That request answers `400 INVALID_REQUEST`. ## What the API answers Team management, API keys and settlement changes are dashboard-only. They take a signed-in session, never an API key: | Answer | When | |---|---| | `403` [SESSION_REQUIRED](/docs/errors/SESSION_REQUIRED) | an API key was sent to one of these routes, even alongside a valid session | | `403` [FORBIDDEN](/docs/errors/FORBIDDEN) | you are signed in, but your role cannot do this. `details.allowed` lists the roles that can | | `400 INVALID_REQUEST` | the change would leave the account with no owner, or the person is already a member | If you need something your role does not allow, ask an owner or admin on your team. ================================================================================================ # Verify and test webhooks — https://intents.fi/docs/platform/verify-webhooks ================================================================================================ A webhook is how you learn an invoice is paid, so your receiver is the most important code in the integration. It has five jobs: 1. **Verify the signature** over the raw body. 2. **Reject stale deliveries** (older than five minutes). 3. **Survive duplicates**: the same event can arrive twice. 4. **Survive disorder**: events can arrive out of order. 5. **Answer 2xx fast**, or you will be sent it again. Then test all five without paying anything: **Send test event**, **Resend**, and the delivery detail. ## 1. Verify the signature Every delivery carries `X-Intents-Signature: t=,v1=`, where `v1` is `HMAC-SHA256(secret, ".")` with your endpoint's `whsec_…` secret. Use the helper: ```ts import { verifyWebhook, WebhookSignatureError } from "@intents-fi/sdk"; const event = await verifyWebhook(rawBody, headers, process.env.INTENTS_WEBHOOK_SECRET); ``` It throws `WebhookSignatureError` (answer `400`) and otherwise returns the typed event. The signature covers the **exact bytes** we sent, so read the body before anything parses it: | Framework | Raw body | |---|---| | Next.js (App Router) | `await request.text()` | | Express | `express.raw({ type: "application/json" })` on the route, before `express.json()`; `req.body` is a Buffer | | Hono | `await c.req.text()` | | PHP | `file_get_contents('php://input')` ([intents-php](/docs/platform/server-sdk-php)) | A body parsed and re-serialised has different bytes and never verifies. `reason` tells you which check failed: `raw_body_required` and `signature_mismatch` are the usual ones while you build. ## 2. The five-minute window `t` is signed too, so a captured delivery cannot be replayed under a new timestamp. Anything more than five minutes from your clock is rejected with `timestamp_out_of_tolerance`. If every delivery fails that way, your server's clock is wrong; fix NTP rather than widening the window. ## 3. Duplicates The same event can reach you more than once: a retry after your endpoint timed out, or a **Resend** from the dashboard, which re-sends the **same event id** on purpose. Both are genuine, so `verifyWebhook` accepts both. Your fulfilment has to make the second one harmless: ```ts async function markPaid(orderId: string) { const order = await db.orders.get(orderId); if (order.status === "paid") return; // already shipped: do nothing await db.orders.update(orderId, { status: "paid" }); await ship(order); } ``` Or record `event.id` and skip one you have seen. ## 4. Out-of-order delivery `invoice.paid` can land before `invoice.processing`, because a retry can arrive after a later event. Treat **`event.data.status`** as the truth and `event.type` as the reason you were woken, and never move an order backwards. ## 5. Answer fast Any 2xx is a success. Anything else, or no answer in five seconds, is retried: 8 attempts over about 23 hours. Do slow work after you answer, or queue it. Answer 2xx for event types you don't handle, too. ## Test your receiver ### Send test event **Webhooks** in the dashboard › your endpoint › pick an event type › **Send test event**. We deliver it now, signed with the endpoint's real secret, and show you the body we sent and what your endpoint answered. - On a **test-mode** endpoint it is a **sample invoice** in the state you picked, marked `sample: true`, with `evt_test_` / `inv_test_` ids and a `sample_…` reference. Your receiver should verify it, answer 2xx and **ship nothing**: `isTestEvent(event)` is true. - On a **live-mode** endpoint it is the `webhook.test` ping, which carries no invoice. From code, with a test key: `POST /v0/webhooks/{id}/test` with `{ "type": "invoice.paid" }`, or `sdk.webhooks.test(id, { type })`. A live key gets [`TEST_MODE_ONLY`](/docs/errors/TEST_MODE_ONLY). ### Resend Every row in the delivery log has **Resend**: the same event, to the same endpoint, now, with the same event id. It is a real duplicate, so use it after a test payment to check that your order ships once. ### The delivery detail Click an event in the log to see, for its latest attempt: - the **request body** exactly as we signed and sent it, - the **response status and body** your endpoint returned (the first 2 KB), - how long it took, when, and the error if there was no answer. That is usually enough to see why a delivery failed: a `400` with `signature_mismatch` from your own handler means a parsed body; a timeout means slow work before the answer. ## Checklist - [ ] Signature verified over the raw body; `400` when it fails - [ ] Sample events acknowledged and ignored - [ ] A resent `invoice.paid` ships nothing twice - [ ] Status read from `event.data.status` - [ ] 2xx within five seconds, for every type See [Webhooks](/docs/platform/webhooks) for the event types and payloads, and the [examples](/docs/checkout/add-crypto) for receivers that do all of the above. ================================================================================================ # Webhooks — https://intents.fi/docs/platform/webhooks ================================================================================================ ```ts import { verifyWebhook, WebhookSignatureError } from "@intents-fi/sdk"; export async function POST(request: Request) { let event; try { // The raw body: request.text(), never a parsed and re-serialised object. event = await verifyWebhook(await request.text(), request.headers, process.env.INTENTS_WEBHOOK_SECRET); } catch (e) { if (e instanceof WebhookSignatureError) return new Response("bad signature", { status: 400 }); throw e; } if (event.type === "invoice.paid") await markPaid(event.data.reference); // safe to run twice return new Response("ok"); } ``` **Ship the order only on `invoice.paid`.** The browser's `onPaid` / `paid` event is for the page. [Server helpers](/docs/platform/server-sdk) has `verifyWebhook` for Express and Hono, and [intents-php](/docs/platform/server-sdk-php) for PHP. [Verify and test webhooks](/docs/platform/verify-webhooks) is the step-by-step guide to a receiver that survives duplicates and disorder. Verify against the **raw request body**, byte for byte. Parse the JSON after, never before: a re-serialised body has a different signature. ## Register an endpoint ```bash title="curl" curl https://api.intents.fi/v0/webhooks \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "url": "https://northwood.example/hooks/intents" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "url": "https://northwood.example/hooks/intents" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/webhooks", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "url": "https://northwood.example/hooks/intents" }, ) response.raise_for_status() data = response.json() ``` The `secret` comes back only here. Endpoints are per mode: a `ik_test_` key registers a test endpoint, and it never sees live events. #### GET /v0/webhooks `GET /v0/webhooks` ```bash title="curl" curl https://api.intents.fi/v0/webhooks \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/webhooks", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Active webhooks | #### DELETE /v0/webhooks/{id} `DELETE /v0/webhooks/{id}` | Parameter | In | Required | Notes | |---|---|---|---| | `id` | path | yes | | ```bash title="curl" curl https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw \ -X DELETE \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw", { method: "DELETE", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.delete( "https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` | Status | Means | |---|---| | `200` | Deleted | ### From the dashboard **Webhooks** in the dashboard adds and deletes endpoints for the mode you're viewing, without a key. It can also **rotate the secret**, **send a test event**, show each delivery in full, and **resend** one. A new or rotated `whsec_` secret is shown once. A rotated secret takes effect at once, so the old one stops verifying, retries included. ## Test your receiver ### Send a test event Pick an event type and we deliver it now, signed with the endpoint's real secret, outside the retry queue. The result shows the body we sent and what your endpoint answered. - **Test-mode endpoints** get a **sample invoice** in the state the event describes: `invoice.paid` carries a paid invoice, `invoice.underpaid` one with `amountRemaining`, and so on. It is shaped exactly like a real delivery, but it is made up: the envelope has `sample: true`, the event id starts `evt_test_`, the invoice id `inv_test_` (which `GET /v0/invoices/{id}` does not know), and `reference` is `sample_…`, so it cannot match one of your orders. - **Live-mode endpoints** only ever get the `webhook.test` ping, which carries no invoice. A live receiver is never handed something shaped like a paid invoice that was not paid. Asking for a sample on a live endpoint is refused with [`TEST_MODE_ONLY`](/docs/errors/TEST_MODE_ONLY). From code, with a test key, for an endpoint that key registered: ```bash title="curl" curl https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw/test \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw/test", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw/test", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` `type` defaults to `invoice.paid`; `webhook.test` sends the ping. The response says whether your endpoint answered 2xx, and carries `requestBody` and `responseBody` (the first 2 KB). A test event doesn't count towards an endpoint's failures and isn't retried. ```json { "id": "evt_test_9f2c41d07ab3e815", "type": "invoice.paid", "createdAt": "2026-11-25T09:30:00.000Z", "sample": true, "data": { "id": "inv_test_4b7e1a90c3d25f68", "status": "paid", "mode": "test", "reference": "sample_0d93c7e2a41b8f56", "…": "…" } } ``` Acknowledge it with a 2xx and **do not fulfil anything**: `isTestEvent(event)` in [the SDK](/docs/platform/server-sdk) is true for both kinds. The ping looks like this: ```json { "id": "evt_test_1c8a5e2d07f94b36", "type": "webhook.test", "createdAt": "2026-11-17T09:30:00.000Z", "data": { "endpointId": "wh_2KpR8wNdL5qTbXvZ", "mode": "live", "message": "A test event from intents.fi. Nothing was paid." } } ``` A receiver that switches on `type` should ignore types it doesn't know, since `webhook.test` is one of them. ### Delivery detail and Resend Each row in the delivery log opens to the **request body** exactly as we signed and sent it, the **response status and body** (truncated to 2 KB), how long it took and when, for its latest attempt. **Resend** delivers the same event to the same endpoint again, now. It carries the **same event `id`**, so it is exactly what a duplicate looks like: use it to check your receiver is safe to receive an event twice. `data` is the invoice as it is at the moment of sending, like every retry. A resend that fails is retried on the normal schedule below. ## The signature Every delivery carries: ```http X-Intents-Signature: t=1794666272,v1=4f1c…9ab2 ``` - `t` — when we signed, in Unix seconds - `v1` — `HMAC-SHA256(secret, ".")`, hex Reject anything more than five minutes old, and compare in constant time. `v1` is a version: a new scheme would arrive as `v2` alongside it, so match on the prefix rather than taking the first value. ## The events | Event | When it fires | |---|---| | `invoice.processing` | the first deposit has been seen | | `invoice.underpaid` | part of the money arrived; the payload carries `amountRemaining` | | `invoice.paid` | the settlement transaction confirmed. **Only this means paid** | | `invoice.expired` | the invoice expired with nothing completed | | `invoice.canceled` | you cancelled it | | `invoice.needs_review` | a human should look: a late payment, a payment to a superseded address, or a status we could not map | | `order.updated` | an Intents Route order changed status. Intents Checkout merchants never get this for a payment attempt's order | The body is always the same shape: ```json { "id": "evt_6LqB9vZtHd3nMwCx", "type": "invoice.paid", "createdAt": "2026-11-14T10:03:12.000Z", "late": false, "data": { "id": "inv_3QkR7mVt9zLpXdB2hJn6Yw", "status": "paid", "…": "…" } } ``` `data` is byte-for-byte what `GET /v0/invoices/{id}` returns, so one parser covers every invoice event and the polling path. `late` only appears on `invoice.paid`, and only when the payment settled after expiry. ### "Detected" is not an event A deposit that has been seen but not settled is `invoice.processing`, and it is not a reason to fulfil an order. Nothing but `invoice.paid` means the money is yours. ## Retries A delivery is a success on any 2xx. Anything else — a 4xx, a 5xx, a timeout at five seconds, a TLS failure — is retried, up to **8 attempts over about 23 hours**: | Attempt | After | |---|---| | 2 | 1 minute | | 3 | 5 minutes | | 4 | 30 minutes | | 5 | 1 hour | | 6 | 3 hours | | 7 | 6 hours | | 8 | 12 hours | After five consecutive failures we email you, and again daily while it keeps failing. The [delivery log](https://dashboard.intents.fi/webhooks) shows every attempt with its response status and error. ## What a receiver has to tolerate 1. **Duplicates.** The same event can arrive more than once: a retry after a timeout, or a **Resend** from the dashboard, which re-sends the same `event.id` on purpose. Key on `event.id`, or make the work idempotent. 2. **Out-of-order delivery.** `invoice.paid` can land before `invoice.processing`. Use `data.status`, and ignore an event that would move an order backwards. 3. **Unknown event types.** Return 2xx for a type you do not handle, or you will be retried for a day over an event you did not want. Answer in under five seconds — queue the work and return `204` — or the delivery times out and you get a duplicate. ## URL rules - `https` only, with no credentials in the URL. - A public host. Private, loopback, link-local and CGNAT addresses are refused at registration and checked again before every delivery, so a redirect cannot be used to reach inside our network. - Local development: use a tunnel (`cloudflared tunnel`, `ngrok`) and register the tunnel's URL. ## Instead of webhooks Poll `GET /v0/invoices/{id}`. Every status change is reflected there, so polling and webhooks give you the same information; webhooks just save you the requests. Poll no faster than every two seconds while a customer is watching, and back off to ten seconds after five minutes. ================================================================================================ # Intents Route — https://intents.fi/docs/route/ ================================================================================================ Intents Route is for apps that move **their users' own funds** between tokens and chains: wallets, dApps, swap and bridge UIs, agents. One request quotes every intent protocol we route through — NEAR Intents, Across, Relay, deBridge, Mayan, LI.FI and UniswapX — and ranks the answers. The winning quote becomes an execution plan that the **user's own wallet** signs, and one order status covers every protocol from there. If you want to *get paid* rather than move a user's funds, you want [Intents Checkout](/docs/checkout) instead: it uses Route internally and you never call these endpoints. ## The flow | Step | Call | SDK | |---|---|---| | 1. Quote every protocol | [`POST /v0/quotes`](/docs/api/post-quotes) | `client.quotes.create()` | | 2. Turn the best quote into a plan | [`POST /v0/orders`](/docs/api/post-orders) | `client.orders.create()` | | 3. The user's wallet runs the steps | `evm_tx`, `svm_tx`, `tvm_tx`, `transfer` or `eip712_sign` | `executeOrder()` | | 4. Hand back each hash or signature | [`POST /v0/orders/{id}/submit`](/docs/api/post-orders-id-submit) | done by `executeOrder()` | | 5. Follow it to the end | [`GET /v0/orders/{id}`](/docs/api/get-orders-id) or the `order.updated` webhook | `waitForCompletion()` | `swap()` in `@intents-fi/sdk` does all five in one call. The [quickstart](/docs/route/quickstart) walks through it, or a coding agent can wire it in with the [Route setup prompt](/docs/agent-setup/route). ## What it guarantees - **Non-custodial.** intents.fi never signs, never holds a key and never holds funds. The plan is executed by the user's wallet; we only quote, check and track. - **Allowlisted targets.** Every transaction in a plan goes to a contract on our allowlist for that protocol and chain, or the order is refused with `UNTRUSTED_EXECUTION_TARGET`. - **One status model.** `awaiting_user → submitted → pending_deposit → processing`, ending in `completed`, `refunded`, `failed` or `expired`, whatever the protocol calls it. - **Failover.** A protocol that errors, times out or rate-limits is skipped and another serves the request. [Route status](/docs/status) shows how that is going, live. ## Assets and amounts - Assets are CAIP-19 IDs (`eip155:8453/erc20:0x8335…` is USDC on Base) or the `alias:address` shorthand (`base:0x8335…`, `solana:native`). [`GET /v0/chains`](/docs/api/get-chains) lists the chains and their aliases, [`GET /v0/assets`](/docs/api/get-assets) the assets on one chain. - Amounts are **integer strings in base units**. Use `BigInt`, never a float. - `from.amount` asks for an exact input; `to.amount` with `tradeType: "EXACT_OUTPUT"` asks for an exact output. ## Keys and test mode Any secret key works ([keys](/docs/get-started)), and keep it on your server: a browser app calls your own backend, which calls the API. Route has **no test mode** — quotes come from the protocols themselves — but nothing moves until the user's wallet signs, so develop with small amounts. ## Errors you will meet | Code | HTTP | What to do | |---|---|---| | `NO_ROUTE` | 404 | No protocol can do this pair or amount. `details.errors` says why each one declined; try another amount or asset | | `UNSUPPORTED_ASSET` | 400 | The asset ID isn't one we route. Check it against `GET /v0/assets` | | `QUOTE_EXPIRED` | 410 | The quote's `expiresAt` passed. Quote again | | `QUOTE_DRIFT` | 409 | The fresh price is worse than the quote by more than `driftToleranceBps` (default 15). The body carries the fresh quote: show it, and create the order again if the user accepts | | `UNTRUSTED_EXECUTION_TARGET` | 502 | A protocol returned a contract we don't trust. Nothing was built; quote again or exclude that protocol | | `PROVIDER_ERROR`, `PROVIDER_TIMEOUT` | 502, 504 | The protocol failed on its side. Retry, or quote again for another protocol | | `RATE_LIMITED` | 429 | Back off and retry | | [`ADDRESS_BLOCKED`](/docs/errors/ADDRESS_BLOCKED) | 403 | An address in the request is on a sanctions or abuse list | Every error has the same body; switch on `error.code` ([errors](/docs/errors/)). ================================================================================================ # Intents Route quickstart — https://intents.fi/docs/route/quickstart ================================================================================================ Four things: keep your key on the server behind a small proxy, quote, let the user's wallet run the plan, and follow the order to the end. Route has no test mode — quotes are real — but nothing moves until the user's wallet signs, so try it with a small amount. No account yet? [Sign up](https://dashboard.intents.fi/signup?product=route) and make a secret key on the [keys page](https://dashboard.intents.fi/keys). See [account and API keys](/docs/get-started). ## 1. Install the SDK ```bash npm install @intents-fi/sdk viem # viem for EVM wallets npm install @solana/web3.js # only if you execute on Solana ``` ## 2. Keep the key on the server A browser app never holds the secret key. Proxy the five endpoints a swap needs through your own backend and add the key there. In Next.js, `app/api/intents/[...path]/route.ts`: ```ts const ALLOWED = [/^v0\/quotes$/, /^v0\/orders$/, /^v0\/orders\/[\w-]+(\/submit)?$/, /^v0\/chains$/, /^v0\/assets$/]; async function proxy(req: Request, ctx: { params: Promise<{ path: string[] }> }) { const path = (await ctx.params).path.join("/"); if (!ALLOWED.some((re) => re.test(path))) { return Response.json({ error: { code: "NOT_FOUND", message: "Not proxied" } }, { status: 404 }); } const url = new URL(`https://api.intents.fi/${path}`); url.search = new URL(req.url).search; const res = await fetch(url, { method: req.method, headers: { "content-type": "application/json", authorization: `Bearer ${process.env.INTENTS_API_KEY}` }, ...(req.method !== "GET" && { body: await req.text() }), }); return new Response(res.body, { status: res.status, headers: { "content-type": "application/json" } }); } export const GET = proxy; export const POST = proxy; ``` Then, in the browser: ```ts import { createClient } from "@intents-fi/sdk"; export const client = createClient({ apiKey: "proxied", baseUrl: `${location.origin}/api/intents` }); ``` ## 3. Quote every protocol ```bash title="curl" curl https://api.intents.fi/v0/quotes \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "from": { "asset": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831", "amount": "100000000" }, "to": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" }, "sender": "0x15AAB9098125C5A728CA818B31620a902C25f764", "recipient": "0x9b3c1f4A6D2E5b70CA18F4D3e9B2A7C641FD8E05", "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764" }' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/quotes", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "from": { "asset": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831", "amount": "100000000" }, "to": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" }, "sender": "0x15AAB9098125C5A728CA818B31620a902C25f764", "recipient": "0x9b3c1f4A6D2E5b70CA18F4D3e9B2A7C641FD8E05", "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764" }), }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.post( "https://api.intents.fi/v0/quotes", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "from": { "asset": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831", "amount": "100000000" }, "to": { "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" }, "sender": "0x15AAB9098125C5A728CA818B31620a902C25f764", "recipient": "0x9b3c1f4A6D2E5b70CA18F4D3e9B2A7C641FD8E05", "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764" }, ) response.raise_for_status() data = response.json() ``` Every protocol that can do the swap answers, ranked; `best` is the ID of the top one, and `errors` says why each of the others declined. Show the user `output.amountMin` — the least they will receive — and not only `amountExpected`, and the `fees` and `etaSeconds` of the quote they pick. A quote lasts until its `expiresAt`, often under a minute. Re-quote rather than hold one. ## 4. Execute in the user's wallet `swap()` quotes, creates the order from the best quote (or the one `pick` returns), runs each step in the user's wallet, reports every hash back, and waits for the end: ```ts import { swap } from "@intents-fi/sdk"; const order = await swap( client, { from: { asset: "arbitrum:0xaf88d065e77c8cc2239327c5edb3a432268e5831", amount: "10000000" }, // 10 USDC to: { asset: "base:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913" }, sender: account, recipient: account, }, { evm: { walletClient } }, // and/or { solana: { publicKey, signAndSendTransaction, connection } } { onQuote: (q) => console.log("route", q.provider), onStep: (e) => console.log(e.step.kind, e.status, e.txHash), onTransferRequired: (t) => showDepositAddress(t), // for chains the wallet can't send on (BTC…) onUpdate: (o) => console.log(o.status), }, ); console.log(order.status); // completed, refunded, failed or expired ``` To show the quotes first and let the user choose, call `client.quotes.create()` yourself, then `swap()` with `pick: (qs) => qs.find((q) => q.id === chosenId)`. ### The same thing without the SDK `POST /v0/orders` with the `quoteId` returns `execution.steps`, run in order: | `kind` | What the wallet does | Then | |---|---|---| | `evm_tx` | send `tx` on `chainId` (an `approve` comes first when needed) | `POST /v0/orders/{id}/submit` with `txHash` | | `svm_tx` | sign and send the Solana transaction | submit the `txHash` | | `eip712_sign` | sign `typedData` | submit the `signature` | | `transfer` | send exactly `amount` of `asset` to `to`, with `memo` if set | submit the `txHash` | If the price moved more than `driftToleranceBps` (default 15) since the quote, `POST /v0/orders` answers `409 QUOTE_DRIFT` with the fresh quote; show it and create the order again if the user accepts. Never sign or send a transaction for the user, and never ask for a private key. ## 5. Track it to the end ```bash title="curl" curl https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' ``` ```ts title="TypeScript" const response = await fetch("https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, }, }); if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`); } const data = await response.json(); ``` ```python title="Python" import os import httpx response = httpx.get( "https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, ) response.raise_for_status() data = response.json() ``` The status is the same for every protocol: | Status | Means | |---|---| | `awaiting_user` | the plan is out; the wallet hasn't acted yet | | `submitted` | we have the hash or signature | | `pending_deposit` | waiting for the deposit to land | | `processing` | the protocol is filling it | | `completed` | delivered to `recipient`; `output.amountActual` is what arrived | | `refunded` | the protocol couldn't fill it and sent the input back | | `failed` | it failed; `failReason` says why | | `expired` | nobody acted before the plan expired | Poll every few seconds, or register a webhook for `order.updated` on the [webhooks page](/docs/platform/webhooks) and follow `data.status`. ## Next - [Route overview](/docs/route) — what Route guarantees, and the errors you will meet - [Route status](/docs/status) — live success rates per protocol - [API reference](/docs/api) — every field of every endpoint ================================================================================================ # Route status — https://intents.fi/docs/status ================================================================================================ Your checkout should not depend on one network. intents.fi quotes every protocol it routes through for every payment and swap, so when one is slow, down or more expensive, another fills the order. This page shows how that is going, from the same orders and quotes the API serves. ## The JSON ```bash curl https://api.intents.fi/v0/status curl "https://api.intents.fi/v0/status?window=7d" ``` No key is needed. The same document is at `https://intents.fi/docs/status.json`. It is recomputed at most once a minute, it is aggregates only — no addresses, amounts or order IDs — and test-mode traffic is left out. The MCP server's `get_route_status` tool returns it too. ```json { "state": "operational", "window": "24h", "generatedAt": "2026-11-14T12:00:00.000Z", "since": "2026-11-13T12:00:00.000Z", "protocols": [ { "provider": "near-1click", "orders": { "completed": 412, "refunded": 3, "failed": 1 }, "successRate": 0.9904, "quotes": 5210, "quoteErrors": 38, "quoteErrorRate": 0.0072, "wins": 2304, "p50LatencyMs": 840, "state": "operational" } ], "vsNearIntents": { "compared": 4980, "medianImprovementBps": 4.5, "betterShare": 0.5374, "nearUnavailable": 211 }, "failovers": { "count": 57, "recent": [ { "at": "2026-11-14T11:52:10.000Z", "failed": "relay", "code": "PROVIDER_TIMEOUT", "servedBy": "near-1click", "fromChain": "eip155:42161", "toChain": "intents:tron" } ] }, "history": [ { "provider": "near-1click", "days": [ { "date": "2026-08-16", "state": "no_data" }, { "date": "2026-11-13", "state": "operational" } ] } ] } ``` `history` carries 90 entries per protocol, oldest first; the example is cut to two. ## What the figures mean - **Success rate** — per protocol, over orders that reached a final state in the window: completed ÷ (completed + refunded + failed). An order nobody paid for expires and is not counted. - **Quote errors** — quote requests that failed for a reason on the protocol's side: an error, a timeout or a rate limit. "No route for this pair" is not an error. - **Median improvement vs NEAR Intents** — for every request NEAR Intents also quoted, how much better intents.fi's chosen quote was than NEAR's own, in basis points of NEAR's amount: more out for a swap with a fixed input, less in for a payment with a fixed output. 0 means NEAR Intents was already the best. The ranking can weigh speed as well as price, so a single request can come out slightly negative; the median is what matters. - **Served when NEAR alone could not** — requests NEAR Intents did not quote and another protocol did. A NEAR-only checkout would have had nothing to show. - **Failover event** — a protocol failed on its side and another served the request instead. - **The last 90 days** — `history`: each protocol's state for each of the last 90 complete UTC days, judged by the same bar as the live table over that day's own orders and quotes. A day is recorded once it is over. A day nothing was routed on, or one that was not recorded, is `no_data` (grey on the page): it is never counted as up. The history is the same for both windows, and empty until the first day has been recorded. ## States | `state` | Means | |---|---| | `operational` | every protocol with enough traffic to judge is above the bar | | `degraded` | at least one protocol is below it: under 90% success over 5 or more finished orders, or over 25% quote errors over 20 or more requests. Payments keep routing through the others | | `no_data` | nothing was routed in the window | Each protocol carries the same three states, so an agent can skip a degraded one itself. Questions about a figure: [support@intents.fi](mailto:support@intents.fi).