# 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**

```bash
> 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:

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

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.402gate.com/core-protocol/http-402-paywall-protocol.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
