Skip to main content

Public facilitator

The public facilitator at https://public-facilitator.xdcai.tech verifies and settles x402 payments for an API that you host yourself. Your server asks it "is this payment real?" and "settle it", and it does the on-chain work and pays the gas.

Every payment has two sides, and the docs are split the same way. A seller hosts the API and gets paid. A buyer (a person or an agent) calls it and pays. Sellers need a key and possibly credits; buyers need neither.

Your dashboard for it is at xdcai.tech/account/facilitator: seller API keys, prepaid credits, usage, and settlement history.

Do you actually need it

Three different things on XDC AI can take money for an API call, and only one of them is this.

You want toUseYou manage
Be a seller without writing payment codeGatewayNothing. Point it at your API and it handles 402, verification and settlement
Be a seller from your own serverPublic facilitator (this section)A seller API key, and the verify, settle and polling calls
Run the whole payment layer yourselfBuild a facilitatorEverything, including gas

Most people should use the gateway. It requires no key, no credits, and no polling loop, and your service gets listed in the marketplace. Use the public facilitator when you want the payment logic inside your own application.

:::note Buyers need nothing here A buyer or an agent paying for a call needs no account, no API key, and no credits. They hold USDC and sign a payment. Everything in this section is the seller side. If you are the buyer rather than the seller, read the buyer guide. :::

How a paid call works

buyer requests your resource
your server answers 402 with the price
buyer signs an EIP-3009 authorization and repeats the request
your server calls POST /verify
your server calls POST /settle
your server polls GET /settlements/{id} until it confirms on-chain
your server returns the paid content

The buyer signs but never submits a transaction, so they never need XDC for gas. Settlement is submitted and paid for by the facilitator.

Constants

These are fixed for XDC mainnet and your code should treat them as given.

ItemValue
Facilitatorhttps://public-facilitator.xdcai.tech
Networkeip155:50 (XDC mainnet)
Schemeexact
x402 version2
USDC0xfA2958CB79b0491CC627c1557F441eF849Ca8eb1
USDC decimals6, so 10000 is 0.01 USDC
EIP-712 token nameUSDC
EIP-712 token version2

:::warning The EIP-712 name is USDC, not USD Coin USD Coin produces a different domain separator, and every signature then fails to recover. This is the most common integration failure on XDC. :::

Your seller wallet

The facilitator keys your account by the address your API is paid at, not by an email or a user id. Your keys, credits and settlement history all hang off that address, which is why the dashboard asks for it before it can show you anything.

Credits

A confirmed settlement can draw down a prepaid credit balance. Verify calls are always free, and so are /supported, /health, /ready and /v1/status.

If your credits run out, /settle returns 403 insufficient_facilitator_credits. That is a billing state on your account. It does not mean the buyer's payment was bad, and your API should not tell them it was. The same is true of 403 seller_plan_inactive.

You buy credits with USDC on XDC, paying from your XDC AI smart wallet or any wallet you have linked. Credits are a fixed unit: 1 credit = 0.001 USDC. See Credits and top-ups for the full flow, which wallets can pay, and what a payment held for review means.