Documentation

FastAPI

FastAPI Sandbox and Live

Test FastAPI payment policies on Base Sepolia and safely activate live settlement on Base.
Last reviewed August 9, 2026

Sandbox

Sandbox uses test USDC on Base Sepolia (eip155:84532). Set ACCESS402_MODE=sandbox while developing and confirm that protected routes return the expected x402 v2 challenge.

Deployment-controlled mode

The FastAPI server environment is authoritative:

  • ACCESS402_MODE=sandbox selects Base Sepolia.
  • ACCESS402_MODE=live selects Base mainnet.

The dashboard has no mode switch. It shows the last mode authenticated and synchronized by the deployment.

Switching modes

The installation ID and API key do not change between modes. Change ACCESS402_MODE, restart the deployment, and verify the synchronized dashboard status and next x402 challenge.

Verification checklist

  • Confirm the production API origin is included in the installation's authorized URL list.
  • Confirm the challenge shows Base, the intended price, and the project wallet.
  • Test invalid, expired, and repeated payment submissions.
  • Confirm a successful transaction appears once in activity and usage.
  • Keep Live disabled in preview or staging deployments unless intentionally testing mainnet.