Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

HTTP 402 Payments

HTTP 402 "Payment Required" is an underutilized HTTP status code designed for programmatic payments, enabling seamless monetization of digital content for AI agents and automated systems.

What is HTTP 402?

HTTP 402 "Payment Required" is a proposed HTTP status code that allows servers to require payment before fulfilling a request. Unlike traditional paywalls requiring user interaction, 402 enables automatic payments that work with AI agents, crawlers, and APIs.

How MCP Server Handles 402 Payments

The MCP Wallet Server includes a mcpwallet_browse_with_payment tool that automatically detects 402 responses and processes payments using the integrated Ethereum wallet.

Example Usage

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "mcpwallet_browse_with_payment",
    "arguments": {
      "url": "https://premium-api.example.com/data"
    }
  }
}

Payment Flow

  1. Content Request: Agent requests paid content via MCP tool
  2. 402 Detection: Server receives 402 Payment Required response
  3. Payment Processing: Wallet automatically sends required payment
  4. Content Access: Request retries with payment proof, receives full content

Benefits for Content Creators

Aggressive Crawler Prevention

Traditional rate limiting fails against distributed botnets. 402 payments create economic barriers that make mass scraping expensive while allowing legitimate users to pay.

Flexible Monetization

Set dynamic pricing based on:

  • Content type and quality
  • User/agent type
  • Time of access
  • Usage volume

Built-in Rate Limiting

Each request carries its own payment, naturally limiting abusive patterns. Economics handles rate limiting automatically.

DDoS Protection

Attackers must spend real money to overwhelm servers, creating natural economic defense.

Payment Mechanisms

The 402 protocol supports various payment methods:

Native Ethereum

{
  "network": "eip155:1",
  "token": "0x0000000000000000000000000000000000000000",
  "recipient": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
  "amount": "1000000000000000000"
}

ERC20 Tokens

{
  "network": "eip155:1",
  "token": "0xA0b86a33E6441e88C5F2712C3E9b74B8E5f5c4b4",
  "recipient": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
  "amount": "1000000"
}

Real-World Applications

Financial Data Providers

Charge per query for premium market data, ensuring only serious users access.

AI Training Data

Monetize datasets for machine learning, funding better data collection.

News and Journalism

Support quality journalism directly through reader and AI payments.

Research and Academia

Monetize academic papers and research tools while keeping them accessible.

MCP Integration

The Model Context Protocol standardizes agent interaction with paid content. The mcpwallet_browse_with_payment tool handles payments transparently, enabling agents to:

  • Access real-time financial data
  • Use premium APIs automatically
  • Build applications with paid datasets
  • Create value-added services

Getting Started

Implement 402 payments in your service and let AI agents pay automatically. Check the Payment Protocol docs for technical details.

The web is about to get a lot more valuable – one payment at a time! 🚀