x402 Architecture

From primitive to platform — how five API calls become a content monetization engine

The x402 Protocol — 5 API Calls

Everything we've built — t-shirt checkout, content paywalls, dashboards, multi-rail payment — rests on these five interactions. This is the entire protocol.

1
GET /resource — Client requests protected content
Client → Server
2
402 Payment Required — Server returns payment requirements in the PAYMENT-REQUIRED header (base64-encoded; decodes to the body below)
{ x402Version: 2, resource: { url, mimeType }, accepts: [{ scheme, network, amount, payTo, asset, maxTimeoutSeconds }] } Server → Client
3
User signs transaction — Wallet builds USDC transfer, user approves
signTransaction(usdcTransfer) → transaction Client → Wallet (Phantom, Coinbase Embedded, etc.)
4
Retry with PAYMENT-SIGNATURE — Client resends the request, now carrying the signed payment (base64-encoded) in the PAYMENT-SIGNATURE header
{ x402Version: 2, accepted: { scheme, network, amount, payTo, asset }, payload: { transaction } } Client → Server → Facilitator
5
Access granted — Server sets access cookie, returns content, and echoes the settlement in the PAYMENT-RESPONSE header (base64-encoded)
Set-Cookie: x402_access={signed_token}; PAYMENT-RESPONSE: <base64>; 200 OK Server → Client

Architecture Layers

Each layer builds on the one below it. The protocol is the foundation. Everything above is optional configuration.

Consumer Apps
T-Shirt Checkout Content Paywall Author PWA Agent Briefings
Product Layer
Seller Dashboard Member Pricing A/B Testing CSV Export Order Tracking
Payment Rails
Stripe (Card/Apple/Google Pay) Braintree (Venmo) x402/Solana (USDC) Coinbase Embedded
Gateway
X402.Gateway (.NET 9) Payment Routing SQLite Persistence Access Cookie Manager
x402 Protocol
HTTP 402 Payment Requirements Wallet Signing Facilitator Settlement 5 API calls

Development Phases

Phase A — Wireframes

What Does It Look Like?

Payment flow wireframes, admin dashboards, newspaper paywall mockups. Established the UX patterns and Northwoods brand guidelines for all payment interfaces.

wireframes-payment-flow.html wireframes-admin.html wireframes-newspaper.html tshirt-order-flow.html
Phase B — Research & Documentation

What Does It Do?

Deep research into the x402 ecosystem, competitive landscape, revenue models, facilitator APIs, and security audit. Built the knowledge base that informed all implementation decisions.

PAYMENT-INTEGRATION-RESEARCH.md X402-ECOSYSTEM-RESEARCH.md SUBNANO-COMPETITIVE-ANALYSIS.md revenue-model-*.html ab-test-demo.html
Phase C — T-Shirt POC

Does It Actually Work?

End-to-end proof: real Stripe payments, real Braintree/Venmo, real Phantom wallet signing on Solana (devnet on this public site). 79 tests. SQLite persistence. Seller dashboard with live stats.

X402.Core/ X402.Gateway/ X402.Gateway.Tests/ checkout/index.html dashboard/index.html PRODUCTION-SETUP.md .env.model
Phase D — Fundamentals & Scale

How Does This Serve the Last Mile and Open the First?

Strip x402 to its essence. Prove the primitive works. Then show how it scales — from one recipient to thousands, from one article to a content library, from manual publish to an agentic pipeline.

x402-proof/index.html x402-architecture.html

Proof Scenarios — Scale in Three Steps

Each scenario uses the same x402 primitive. The only difference is what's on top.

1
Single Recipient — The Primitive
BUILT

One sender, one recipient, $0.01 of test USDC on Solana devnet. The entire x402 protocol in one page, zero backend.

A reader opens the proof page
  → picks a recipient from the dropdown
  → clicks "Pay with Phantom"
  → Phantom signs USDC transfer
  → Transaction settles on Solana devnet (~1 sec)
  → Receipt with Solscan link
What this proves: x402 works. A real, signed transfer settled. Verifiable on-chain. One HTML file. No middleware. The protocol is the product.
2
Multi-Recipient — Scaling to Authors
BUILT

Same primitive, but the recipient dropdown grows. Each author has a wallet address. Payment routes directly to them.

Reader opens an article by "Dr. Smith"
  → Article is x402-gated
  → Reader pays $0.05
  → USDC goes directly to Dr. Smith's wallet
  → No intermediary, no 30-day payout cycle

Dropdown could hold 10, 100, or 10,000 authors.
The protocol doesn't care — it's one PayTo address per resource.
What this proves: x402 scales to any number of content creators. Each gets their own wallet. Payments are instant and direct. The platform doesn't hold funds.
3
Content-Gated — The Publisher Play
BUILT

The Morning Ledger demo: real articles behind x402 paywalls. Reader hits a 402, pays, gets access. Cookie persists so they don't pay twice.

Reader visits morningledger.com/article/fed-digital-dollar
  → Server returns HTTP 402 + payment requirements
  → Paywall overlay: "This article costs $0.05"
  → Reader connects Phantom, signs payment
  → Facilitator verifies, server sets access cookie
  → Article renders. Reader can return anytime (cookie valid 24hr).

Scale: 10,000 articles, each with its own price and author wallet.
The middleware handles it all — one config entry per path.
What this proves: x402 works for content monetization at publisher scale. Per-article pricing. Per-author payment. Automatic access management. The protocol replaces subscription paywalls.

Where This Goes

The protocol is the foundation. Everything above it is a business decision, not a technical one.

Near Term: Live Payments

Production payment keys on a public URL. Real orders from real people.

Medium Term: Internal Dogfood

Northwoods experts create content through a voice-first app. Northwoods staff agents consume it via x402 micropayments. The company is customer zero — both supply and demand side. Real usage data, real case study.

Long Term: Content Monetization Platform

Titan CMS integration. External publishers. Personal agents with wallets buying content overnight. The HTTP 402 status code doing what it was designed for: automated payment negotiation at internet scale.