惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
Microsoft Azure Blog
Microsoft Azure Blog
Stack Overflow Blog
Stack Overflow Blog
Jina AI
Jina AI
Vercel News
Vercel News
H
Help Net Security
Martin Fowler
Martin Fowler
美团技术团队
云风的 BLOG
云风的 BLOG
Y
Y Combinator Blog
阮一峰的网络日志
阮一峰的网络日志
MyScale Blog
MyScale Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
博客园 - 司徒正美
人人都是产品经理
人人都是产品经理
Engineering at Meta
Engineering at Meta
G
Google Developers Blog
Blog — PlanetScale
Blog — PlanetScale
MongoDB | Blog
MongoDB | Blog
宝玉的分享
宝玉的分享
小众软件
小众软件
T
Tailwind CSS Blog
WordPress大学
WordPress大学

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
HTTP 402: the payment status code the web ignored for 33 ...
Patrick Hugh · 2026-04-28 · via DEV Community

The internet had a payment status code for 33 years. Nobody used it. Until now.

HTTP 402 Payment Required has been in the spec since 1991. It was reserved. Servers couldn't actually charge for a request because the client half of the protocol was missing. No browser knew what to do with a 402. No client library could sign and replay. The status code sat in RFC 7231 with the word "experimental" next to it.

What x402 actually does

x402 is the missing client half. The protocol shipped in 2025. Here is what a paid request looks like end to end:

  1. Client calls a paid endpoint with no auth.
  2. Server returns 402 with a JSON body that includes accepts[], the array of acceptable payment options. Each option carries scheme (exact, upto), network (CAIP-2, e.g. eip155:8453 for Base), amount (atomic units), asset (USDC contract on Base), payTo (recipient wallet), maxTimeoutSeconds, and extra (the EIP-712 domain name and version for the asset).
  3. Client picks an option. The wallet signs an EIP-3009 TransferWithAuthorization over those exact terms.
  4. Client base64-encodes the signed payload and replays the request with an X-PAYMENT header.
  5. Server verifies the signature, settles the transfer on-chain via a facilitator, and serves the response.

The whole flow is HTTP. No new infrastructure. Your existing API gets paid endpoints by emitting a 402. Your client library learns to sign and replay. That is it.

Why now

Agents need a payment primitive that does not require accounts. Stripe and the rest of the SaaS billing stack assume a human is at the door. Wallets do not. A wallet signing typed data is a clean, programmable, account-less primitive that any agent can use.

For the supply side, x402 turns a single endpoint into a paid endpoint with one HTTP middleware. No new vendor relationship. No new contract. No new auth surface. The agentic.market directory indexes the providers so agents can discover them.

I built a paid memory API on top of this. The Coinbase CDP facilitator handles on-chain settlement on Base. The whole round-trip is three seconds.

Watch it move real money: bmdpat.com/memory/demo

What I had to learn the hard way

CDP's V2 facilitator enforces an undocumented minimum payment threshold somewhere between 100 and 1000 atomic USDC. Below the floor, V2 verify rejects with a generic invalid_payload and no message. The V1 endpoint with the same body said "amount is too low." Took three PRs of payload-shape fixes to figure out the body was always fine and the number was the bug. Bumped my prices to a uniform $0.001 per call and the rejections went away.

If you are building on x402 and getting invalid_payload from CDP, the first thing to try is bumping the amount.

What's next

The next problem isn't whether agents can pay. It's giving them a budget.

A typical 4-tool agent loop hits five priced endpoints per turn. A long-running task does this thousands of times a day. A single rogue loop drains a wallet in minutes. Per-tool caps, per-agent budgets, kill switches, spend visibility — that's the next layer.

AgentGuard.