x402 facilitators: what they do and how a server picks one
An x402 server does not need its own chain node, and a buyer does not send a transaction. Between them sits a facilitator: a service the server asks to check a signed payment and to put it on chain.
The three endpoints
The same three on every network:
GET /supported: the schemes and networks it settles. A server reads it to learn which rails it can offer.POST /verify: given a signed payment and the offer it answers, is the payment valid? Right asset, right amount, right recipient, and still in its validity window.POST /settle: submit the payment on chain and report the transaction.
The server holds no buyer key at any point. The buyer signs an authorization for exactly the amount in the offer; the facilitator submits it. On an EVM chain that authorization is EIP-3009, so the facilitator pays the network fee and the paying wallet needs only the stablecoin, no gas token.
When each one is called
- The agent calls a paid route with no payment and gets
402with the offer. - The agent signs the payment and sends the call again.
- The server asks the facilitator to verify it.
- The server runs the route.
- Only when the answer is a success does the server ask the facilitator to settle. An answer with an error status cancels settlement, so a failed x402 call is not charged (a payment that lands late is repaid after on-chain proof). Some calls are paid before they run; a failed one can be retried free with the same payment, or is refunded.
The step-by-step headers are in how x402 works.
One rail, more than one facilitator
Agent402 reads each facilitator's /supported at boot. One that
fails the check drops only its own rail from the offer: the other rails, and
the free proof-of-work tier, keep working. Where a network has more than one
facilitator, a settlement the first one cannot complete is tried on the next.
The rails on offer right now are at
/api/rails, and every 402 lists its
live accepts per network.
A timeout is not a failure
A settle call can end without an answer while the transfer still lands. A server that reads the timeout as "not paid" and answers an error has charged a buyer and told them it did not, so a settle that ends in doubt is checked against the chain before it is believed. On Agent402, a payment that lands after the call was answered with an error is recorded as owed back to the paying wallet and repaid after on-chain proof; the refunds page has the rule and a lookup for one transaction.
Running your own
You can run a facilitator yourself. The repository ships one for Stellar in
facilitator/: it joins the official x402 packages for Stellar, serves the
three endpoints above, settles one payment at a time (its signer account has
one sequence number), and confirms each settlement on chain. It is what this
service runs for its own Stellar rail. Setup, the access controls and the
timeouts are on the Stellar facilitator page.
A server points at a facilitator with one setting, FACILITATOR_URL; the
full list of settings is in the configuration reference.