/v0/invoicesCreate an invoice
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
Section titled “Authentication”A secret key (ik_) as a Bearer token. The prefix sets the mode: _test_ or _live_. Publishable keys (pk_) cannot call it.
Parameters
Section titled “Parameters”x-intents-affiliateOptional · headerStore 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
Section titled “Body parameters”amountstringRequiredPrice in the invoice currency, e.g. "49.00"
currencyUSDOptionalsettlementobjectOptionalChoose between the merchant's registered settlement targets. API keys cannot introduce a new address (§8.3).
settlement.assetstringRequiredsettlement.addressstringRequiredreferencestringOptionalThe merchant's own ID. Unique per merchant and mode, and the idempotency key.
descriptionstringOptionalcustomerEmailstringOptionalsuccessUrlstringOptionalcancelUrlstringOptionalexpiresInSecintegerOptionalmetadataobjectOptional
Responses
Section titled “Responses”- 200An invoice with this
referencealready exists in this mode; it is returned unchanged - 201Invoice created.
clientSecretis shown only here.
Request
Section titled “Request”curl https://api.intents.fi/v0/invoices \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'x-intents-affiliate: <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" }'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();import osimport 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
Section titled “Errors”{ "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } }Switch on code, not on the message: every code has a page under Error codes. Base URL https://api.intents.fi; the whole reference is on one page.