* Fix extra: null incompatibility between Python facilitator and TypeScript Zod schema * fix optional strings * fixed outdated eth_account._utils.typed_transactions import
x402 Advanced Facilitator Examples (Python)
FastAPI facilitator service demonstrating advanced x402 patterns including all-networks support, bazaar discovery, and lifecycle hooks.
Prerequisites
- Python 3.10+
- uv (install via docs.astral.sh/uv)
- EVM private key with Base Sepolia ETH for transaction fees
- SVM private key with Solana Devnet SOL for transaction fees
Setup
- Copy
.env-localto.env:
cp .env-local .env
- Fill required environment variables:
EVM_PRIVATE_KEY- Ethereum private keySVM_PRIVATE_KEY- Solana private keyPORT- Server port (optional, defaults to 4022)
- Install dependencies:
uv sync
- Run the server:
uv run python all_networks.py # All supported networks with optional chain configuration
uv run python bazaar.py # Bazaar discovery extension
Available Examples
| Example | Command | Description |
|---|---|---|
all_networks |
uv run python all_networks.py |
All supported networks with optional chain configuration |
bazaar |
uv run python bazaar.py |
Bazaar discovery extension for cataloging x402 resources |
API Endpoints
GET /supported
Returns supported networks and schemes.
POST /verify
Verifies a payment signature.
POST /settle
Settles a verified payment by broadcasting the transaction on-chain.
Network Identifiers
Networks use CAIP-2 format:
eip155:84532— Base Sepoliaeip155:8453— Base Mainnetsolana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1— Solana Devnetsolana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp— Solana Mainnet