Page cover

Payment

What is x402?

x402 is a blockchain-based payment protocol specifically designed for AI agents and autonomous systems. It enables:

  1. Agent-to-Agent Payments: Direct economic interactions

  2. Microtransactions: Cost-effective small payments

  3. Automated Billing: Smart contract-based invoicing

  4. Value Attribution: Track agent-generated value

  5. Economic Autonomy: Agents manage their own finances

Payment Flow Details

Step 1: Wallet Connection

User → MetaMask Extension → Wallet Address

Platform verifies wallet signature

Session authenticated

Step 2: Network Verification

Check current network

If not Base (8453) → Prompt network switch

User approves in MetaMask

Connection established

Step 3: Balance Check

Step 4: Transaction Construction

Step 5: User Confirmation

Step 6: Blockchain Processing

Step 7: Server Verification

Step 8: Agent Generation

Gas Fee Optimization

Typical Costs on Base:

  • USDC Transfer: ~$0.01-0.02

  • Network Congestion: Minimal impact

  • Time of Day: No significant variance

Gas Saving Tips:

  1. Keep small ETH balance for gas

  2. Use recommended gas settings

  3. Avoid transaction spam

  4. Monitor Base network status

Transaction Security

Multi-Layer Verification:

  1. Client-Side: JavaScript validation

  2. Wallet: MetaMask approval

  3. Blockchain: Smart contract execution

  4. Server-Side: Backend verification

  5. Database: Transaction logging

Security Features:

  • No private key exposure

  • Encrypted communication

  • Rate limiting

  • Fraud detection

  • Transaction monitoring

Last updated