HTTP 402 Paywall Protocol

Overview

The HTTP 402 Paywall Protocol is the backbone of the 402Gate ecosystem. It extends the standard web request model with a payment verification layer, allowing any HTTP endpoint to enforce pay-per-use access powered by Solana and the $402G token.

When a client (human user, DApp, or AI agent) requests a protected resource, the server responds with a structured 402 Payment Required message that includes:

  • the amount to be paid,

  • the recipient wallet address,

  • the accepted tokens, and

  • the unique requestId for tracking and verification.

Once the user completes payment, the request is re-sent with proof of payment (a transaction signature) in the header. The server then verifies it on-chain and grants access immediately.


Request–Response Cycle

> GET /api/data
< HTTP/1.1 402 Payment Required
{
  "requestId": "req_492ab",
  "recipient": "MERCHANT_PUBKEY",
  "amount": "0.001",
  "currency": "402G",
  "acceptedMints": ["402G","USDC","SOL"],
  "instructions": "Pay the required amount and include memo=requestId"
}

After payment:

> GET /api/data
Payment-Proof: tx=9DgT1a...WZq3; requestId=req_492ab; payer=Fg8a...

< HTTP/1.1 200 OK
{ "result": "Access granted", "data": {...} }

Last updated