← Build your first x402 service

Free lesson~9 minFresh · 2026-07-22 Path: Build your first x402 service

Anatomy of a 402 challenge

Which fields a client must read: amount, payTo, network, asset contract, skill binding.

Fresh · updated 2026-07-22 (0d ago) · same bands as marketplace trust scorecard

This lesson is free and complete. You do not need to buy a skill to understand the material.

Required mental model


A 402 body is a **machine invoice**, not marketing copy.


Fields to treat as authoritative


  • maxAmountRequired / amount — atomic USDC (6 decimals)
  • payTo — treasury address
  • network / chain id — Base 8453
  • asset / assetContract — USDC on Base
  • skill / skill_id — binds payment intent to product

  • Client checklist


  • 1. Parse JSON (not HTML error pages)
  • 2. Refuse to pay if skill id mismatches the product you intended
  • 3. Log challenge snapshot before broadcast
  • 4. Only then sign the transfer

  • Merchant checklist


  • 1. Amounts come from catalog prices, not client input
  • 2. Challenge is GET-safe (no side effects)
  • 3. POST unlock verifies chain facts against the challenge

  • Takeaway


    If clients invent the amount, merchants get underpayment chaos. Challenge fields are law.

    Optional: paid capability

    Skip this section if you are only learning. Sealed packs implement ideas — they are not the lesson.

    ← Previous
    Next →

    Machine: lesson JSON · /api/train?lesson=