This is the Python implementation of the x402 REST API sample using FastAPI.
See Stripe's x402 documentation for more information.
- Python 3.10+
- uv package manager
make- Stripe account with crypto payments enabled
- EVM wallet with testnet USDC
- Create a crypto deposit address:
stripe post /v1/crypto/deposit_addresses --live --stripe-version 2026-10-28.preview -d network=base- Configure environment variables:
cp ../../../.env.template .env
# Edit .env with your credentials:
# - STRIPE_SECRET_KEY
# - TEMPO_DEPOSIT_ADDRESS (from step 1)
# - CDP_API_KEY_ID (from Coinbase Developer Platform)
# - CDP_API_KEY_SECRET (from Coinbase Developer Platform)- Install dependencies:
make installmake runmake lint— run lint and formatting checks without changing filesmake format— apply automatic formatting fixesmake typecheck— run the sample's type checker or build validationmake test— run the automated test suitemake ci— run the full local CI sequence (install,lint,typecheck, andtest)
purl http://localhost:4242/paid