x402 payments in Rust

A family of open-source crates covering the full x402 protocol stack — server middleware, client automation, facilitator, and multi-chain support. Auditable, self-hostable, and running in production.

Powering x402 efforts of

Polygon Aptos Oasis Network SecondState and more

Built in Rust

Memory-safe, zero-cost abstractions. No GC pauses under load, no hidden allocations. Designed for the transaction volume that billions of autonomous agents will generate.

Every chain, one API

EVM networks (Ethereum, Base, Polygon, Arbitrum), Solana, and Aptos — each with a dedicated crate and a shared protocol interface. Add a chain without changing your application logic.

Works with any x402 client

Pure x402 protocol — fully compatible with the Coinbase reference SDK. TypeScript, Python, Go, Java clients speak to x402-rs servers with no adapter, no glue. One open spec. Every compliant implementation interoperates.

The x402-rs crate family

Apache 2.0. Implements the open x402 spec — compatible with the Coinbase reference SDK and all compliant clients in TypeScript, Python, Go, and Java.

All crates on GitHub

Server — accept payments

x402-axum Tower middleware for Axum. Gate any route behind a payment with one `.layer()` call. Handles 402 responses, payment verification, and replay protection.

Client — make payments

x402-reqwest reqwest wrapper that detects 402 responses, signs and submits payment, and retries the original request — entirely transparent to calling code.

Facilitator — run your own

x402-facilitator-local The core library powering facilitator.x402.rs. Provides payment verification, on-chain settlement, and a pluggable chain/scheme registry. Wrap it with any HTTP server to build a fully custom facilitator.

Chain support

x402-chain-eip155 EVM support — Ethereum, Base, Polygon, Arbitrum, and any EIP-155 network. Covers ERC-3009, Permit2, and smart-wallet signatures (EIP-1271, EIP-6492).
x402-chain-solana Solana support with SPL token transfers.
x402-chain-aptos Aptos support. Git-only dependency due to upstream Aptos crates.
git only

Core

x402-types Protocol types, CAIP-2 chain identifiers, facilitator traits, and shared utilities. The foundation every other crate builds on.

Both ends of the wire

x402-rs covers the full round-trip — the API that demands payment and the agent that pays it.

Server — x402-axum
Client / Agent — x402-reqwest
Free testnet facilitator

facilitator.x402.rs

Test against real settlement infrastructure from day one — no wallet setup, no config. Point your middleware at https://facilitator.x402.rs and you're accepting testnet payments immediately.

Supports Base Sepolia, Arbitrum Sepolia, Polygon Amoy, Ethereum Sepolia, Solana Devnet, Monad Testnet, Sei Testnet, and more. Moving to mainnet is a one-line config change.

Open facilitator.x402.rs

Ready for mainnet?

The same infrastructure runs in production via FareSide. Your integration code doesn't change — just the facilitator URL.