# x402-rs

x402-rs is an open-source Rust implementation of the [x402 protocol](https://x402.org) — the HTTP-native payment standard built on status code 402. When a client requests a paid resource, the server responds with 402 Payment Required, the client signs a payment payload, and a facilitator verifies and settles it on-chain. x402-rs covers both ends of the wire plus the facilitator itself.

x402-rs is Apache 2.0 licensed, production-proven, and compatible with the Coinbase reference SDK (TypeScript, Python, Go, Java). It is the foundation of [FareSide](https://fareside.com), a hosted x402 facilitator service.

Source: https://github.com/x402-rs/x402-rs

## Crate Family

### Server — accept payments
- **x402-axum** ([crates.io](https://crates.io/crates/x402-axum) | [docs.rs](https://docs.rs/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** ([crates.io](https://crates.io/crates/x402-reqwest) | [docs.rs](https://docs.rs/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** ([crates.io](https://crates.io/crates/x402-facilitator-local) | [docs.rs](https://docs.rs/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](https://fareside.com/docs/build-your-own-facilitator).

### Chain support
- **x402-chain-eip155** ([crates.io](https://crates.io/crates/x402-chain-eip155) | [docs.rs](https://docs.rs/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** ([crates.io](https://crates.io/crates/x402-chain-solana) | [docs.rs](https://docs.rs/x402-chain-solana)): Solana support with SPL token transfers.
- **x402-chain-aptos** *(git only)*: Aptos support. Git-only dependency due to upstream Aptos crates.

### Core
- **x402-types** ([crates.io](https://crates.io/crates/x402-types) | [docs.rs](https://docs.rs/x402-types)): Protocol types, CAIP-2 chain identifiers, facilitator traits, and shared utilities. The foundation every other crate builds on.

## Testnet Facilitator

A free testnet facilitator is available at [facilitator.x402.rs](https://facilitator.x402.rs). Point your middleware at it to start accepting testnet payments immediately — no wallet setup required. 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.

## Links

- GitHub: https://github.com/x402-rs/x402-rs
- Testnet facilitator: https://facilitator.x402.rs
- FareSide (production infrastructure): https://fareside.com
- x402 protocol spec: https://x402.org
- Telegram: https://t.me/faresidehq
- X / Twitter: https://x.com/x402rs