x402
Stablecoin payments over HTTP 402, stewarded by the x402 Foundation.
Pre-release · planned API
In development
This rail is being implemented against the core v2 contract. Option names below may change; this page will be updated with a tested example when it ships.
x402 lets a client pay for an HTTP request with a signed stablecoin payment. The server responds 402 with payment requirements, the client retries with a payment payload, and a facilitator verifies and settles it.
import { x402 } from "@tollstile/x402";
createTollstile({
rails: [
x402({
payTo: process.env.X402_PAY_TO,
network: "base",
facilitator: process.env.X402_FACILITATOR_URL,
}),
],
});Schemes
| Scheme | Status | Use |
|---|---|---|
exact | Planned v0.1 | A fixed price per call |
upto | Planned v0.2 | Authorize a ceiling, settle what the handler actually used |
upto uses the authorization flow with upTo() prices and payment.fulfill({ amount }). See Charge for usage.
What Tollstile adds
- The server's price, asset, network, and recipient are checked against config — never taken from the payload.
- Proofs are recorded in the ledger and accepted once.
- Settlement and failures follow the lifecycle, including
unknownand reconciliation. - The same route can also accept MPP.
Details subject to the specification
Option names and capability values will be finalized against the current x402 specification before release.