❯
x402 payment flow — sequence
updated 2026-07-12 17:41 UTC
AI AGENT
TOLLGATE
PAYMENT ENGINE
POSTGRES
WALLETPROVIDER
BUILD PAYMENT
pick scheme, sign payload
402 · RULES REJECT
payment_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-receipt
on rule violation
402 sent instead of 200 OK