x402 payment flow — sequenceupdated 2026-07-12 17:41 UTC
AI AGENTTOLLGATEPAYMENT ENGINEPOSTGRESWALLETPROVIDERBUILD PAYMENTpick scheme, sign payload402 · RULES REJECTpayment_requires_approval (hold) · over_max_per_request · daily_budget_exceeded · insufficient_funds① GET /r/eu-rates/today② 402 Payment Required — v1 accepts[] JSON / v2 PAYMENT-REQUIRED header, x402-price $0.004④ retry: X-PAYMENT (v1) / PAYMENT-SIGNATURE (v2)⑤ settle(payment)⑥a credit branch: rules check (allowlist, ask-above→hold, max/request, daily budget) → atomic tx debit/credit + receipt tg_9f2e⑥b exact branch (dashed/future): verify EIP-3009 authorization, settle → tx hash⑦ 200 OK + content + X-PAYMENT-RESPONSE/PAYMENT-RESPONSE + x402-receipton rule violation402 sent instead of 200 OK