HTTP 402 재구상 – Stripe로 API 및 에이전트 결제 단순화

hackernews | | 🔬 연구
#ai 에이전트 #api 결제 #http 402 #review #stripe #결제 표준 #agentic payments
원문 출처: hackernews · Genesis Park에서 요약 및 분석

요약

1. **Analyze the Request:** * **Role:** News summarization expert. * **Task:** Summarize the provided article (based on the title and limited context since the article text is just the title repeated). * **Constraints:** 2-4 sentences, concise, focus on important info, *do not* copy-paste, *do not* simply restate title, add new info (this is tricky when the source text is minimal), answer in English. * **Source:** Hacker News (usually implies a discussion or a link to a blog post, but here the "Article Text" provided is just the title again). * **Input:** Title: "Reimagining HTTP 402 – Simplify API and agentic payments with Stripe". Text: Same. 2. **Analyze the Input Data:** * The user provided a Title and "Article Text" which is identical to the Title. * *Problem:* There is no actual article content to summarize. * *Hypothesis:* This is likely a post about Stripe releasing a new feature or a blog post regarding the HTTP 402 status code. * *Knowledge Retrieval (Internal Knowledge):* What is HTTP 402? It's "Payment Required" and is currently reserved but not widely used/standardized. What is Stripe doing? Stripe recently released a "Stripe Request for Comment" (RFC) or a specific protocol (sometimes called "Lemon Squeezy" or similar, but specifically Stripe has been pushing "Smart Wallets" or "Payment Links" for APIs). * *Correction/Refinement:* Wait, I don't have the *actual* content of the article because the user didn't paste it. I only have the title. * *Constraint Check:* "Add new information beyond the title." * *Dilemma:*

본문

Agentic Payments Made Easy Payment is the authentication. An open standard for API & agentic payments using HTTP 402 and Stripe. No signup. No API keys. No OAuth. Just pay and use â AI agents pay for APIs on their first request, no human in the loop. import { paymentRequired } from '@stripe402/express' // One middleware. $0.01 per request. app.use('/api/weather', paymentRequired({ price: 100 })) Overview The 402 status code, finally realized. Reserved since 1997 for 'Payment Required' but never standardized. stripe402 puts it to work â a machine-readable payment protocol between clients and servers, powered by credit cards. Zero signup No registration, no API keys, no OAuth. Identity is derived from the card fingerprint via HMAC â same card always produces the same identity. Credit card rails Built on Stripe and the payment infrastructure 99% of the internet already uses. No crypto wallets, no stablecoins, no bridging. Agent-native Pre-authorize a card and let your AI agent pay for any API on its first request. No human-in-the-loop needed for provisioning. Protocol Five steps. Fully automatic. After the first payment, subsequent requests re-use the client ID until the balance runs out. Client requests a paid resource GET /api/weather HTTP/1.1 Server responds 402 with payment details HTTP/1.1 402 Payment Required payment-required: eyJwcmljZSI6MTAwLCJtaW5Ub3BVcCI6NTAwMDAuLi59 Client tokenizes card via Stripe and retries GET /api/weather HTTP/1.1 payment: eyJwYXltZW50TWV0aG9kSWQiOiJwbV8uLi4iLCJ0b3BVcCI6NTAwMDB9 Server charges card, returns client ID and balance HTTP/1.1 200 OK payment-response: eyJjbGllbnRJZCI6ImM4YTJlLi4uIiwiY3JlZGl0c1JlbWFpbmluZyI6NDk5MDB9 Subsequent requests include the client ID GET /api/weather HTTP/1.1 payment: eyJjbGllbnRJZCI6ImM4YTJlLi4uIn0= Micropayments Sub-cent pricing, without the fee problem. Stripe charges $0.30 + 2.9% per transaction with a $0.50 minimum. stripe402 batches charges into credit top-ups, making per-request pricing at fractions of a cent economically viable. Credits system - Unit - 1/10,000 of a dollar (1 basis point) - Example - 100 units = $0.01 per request - Top-up - $5.00 = 50,000 units = 500 requests at $0.01 - Storage - Redis (Lua atomics) or PostgreSQL (WHERE clause) Client identity HMAC-SHA256(card_fingerprint, server_secret) - Deterministic â same card on the same server always produces the same ID - Private â the card fingerprint cannot be recovered from the client ID - Isolated â different servers produce different IDs for the same card Comparison Familiar payment rails, modern protocol. How stripe402 stacks up against traditional API monetization and crypto-native alternatives. This project stripe402 Trade-offs What you should know. No protocol is perfect. stripe402 optimizes for low adoption friction at the cost of statefulness. Strengths - Uses credit cards â the existing payment rail for 99% of the internet - Zero adoption barrier for end users - Self-describing protocol â the 402 response tells clients exactly what to pay and how - AI agents can pay for APIs autonomously on their first request - Low regulatory complexity compared to crypto-based alternatives Limitations - Stateful â server maintains credit balances (vs. x402's stateless on-chain settlement) - 3D Secure â EU cards may require interactive authentication, breaking headless flows - $0.50 minimum charge â top-ups should be $5+ for efficiency - PCI scope â server-side tokenization requires SAQ-D; browser-based Stripe.js keeps you at SAQ-A - Single currency â one currency per route (for now) Packages Install only what you need. @stripe402/core SharedProtocol types, constants, base64 encoding/decoding, HMAC identity derivation, error classes. Zero dependencies.@stripe402/server ServerStripe integration, payment processing, persistence stores for Redis and PostgreSQL.@stripe402/express ServerExpress middleware â add 402 payment gating to any route with a single function call.@stripe402/client-fetch ClientFetch wrapper that automatically handles 402 responses, tokenizes the card, and caches the client ID.@stripe402/client-axios ClientAxios interceptor that transparently handles 402 responses.# server npm install @stripe402/express # client (pick one) npm install @stripe402/client-fetch npm install @stripe402/client-axios Quick start Running in under a minute. Server import express from 'express' import { paymentRequired } from '@stripe402/express' const app = express() app.get('/api/weather', paymentRequired({ price: 100 }), (req, res) => res.json({ temp: 72 }) ) Client import { wrapFetch } from '@stripe402/client-fetch' const paidFetch = wrapFetch(fetch, { paymentMethodId: 'pm_...' }) const res = await paidFetch( 'https://api.example.com/weather' ) FAQ

Genesis Park 편집팀이 AI를 활용하여 작성한 분석입니다. 원문은 출처 링크를 통해 확인할 수 있습니다.

공유

관련 저널 읽기

전체 보기 →