{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreigo43v7m7nagfiyc3b7go7eoktvbcjwix22v6e2evgd2wtdvmld6i",
    "uri": "at://did:plc:25rdn5elo5izoxrmtis34zuk/app.bsky.feed.post/3mousmij6wb52"
  },
  "coverImage": {
    "$type": "blob",
    "ref": {
      "$link": "bafkreieqjwa3wvnzhkr73nyssbvtxbwli6yenwhxr7vpqibzwmx3fsubya"
    },
    "mimeType": "image/webp",
    "size": 4024
  },
  "path": "/get402/http-402-is-back-18ga",
  "publishedAt": "2026-06-22T11:20:43.000Z",
  "site": "https://dev.to",
  "tags": [
    "api",
    "web3",
    "tutorial",
    "blockchain",
    "RFC 7231",
    "@get402"
  ],
  "textContent": "9|\n10|# HTTP 402 Is Back: How get402 Revives the Payment Required Status Code\n11|\n12|For decades, HTTP 402 \"Payment Required\" sat dormant in the HTTP specification — a reserved status code with no standardized implementation. While every other 4xx status code found its purpose, 402 remained a ghost in the machine, waiting for the right moment.\n13|\n14|That moment is now.\n15|\n16|## What is HTTP 402?\n17|\n18|HTTP 402 (Payment Required) is a status code defined in RFC 7231 but originally reserved since HTTP/1.0. Unlike 401 (Unauthorized) or 403 (Forbidden), 402 specifically indicates that the server cannot process the request because the client has not paid.\n19|\n20|\n\n\n\n        21|HTTP/1.1 402 Payment Required\n        22|Content-Type: application/json\n        23|\n        24|{\n        25|  \"error\": \"payment_required\",\n        26|  \"message\": \"This endpoint requires a payment of 0.01 USDC\",\n        27|  \"amount\": \"0.01\",\n        28|  \"currency\": \"USDC\",\n        29|  \"network\": \"base\"\n        30|}\n        31|```\n\n\n        32|\n        33|## The get402 Implementation\n        34|\n        35|[get402](https://get402.net) is the first production-ready implementation of HTTP 402. Here's how it works:\n        36|\n        37|1. **Developer registers an API endpoint** with get402 and sets a price per request\n        38|2. **Client calls the endpoint** — if they haven't paid, they receive a 402 response\n        39|3. **Client pays** the required amount in USDC on Base\n        40|4. **get402 verifies the transaction** and allows the request through\n        41|5. **Developer gets paid** — automatically, every time\n        42|\n        43|API providers keep **99%** of revenue — get402 takes only **1%**.\n        44|\n        45|## Why Now?\n        46|\n        47|Three factors make 2026 the year of HTTP 402:\n        48|\n        49|1. **Stablecoins are mature** — USDC on Base offers fast, cheap settlements (~$0.001 per transaction)\n        50|2. **Developers want fair monetization** — pay-per-call is more equitable than flat subscriptions\n        51|3. **The web needs new business models** — AI APIs, premium data feeds, and serverless functions all benefit from granular billing\n        52|\n        53|## Getting Started\n        54|\n        55|Ready to implement HTTP 402 in your API? Head to [get402.net](https://get402.net) or check out our [dashboard](https://dashboard.get402.net). Install the SDK:\n        56|\n        57|\n\n    ```bash\n        58|npm install @get402/sdk\n        59|```\n\n\n        60|\n        61|Then protect any endpoint with one line:\n        62|\n        63|\n\n    ```typescript\n        64|import { get402 } from '@get402/sdk';\n        65|\n        66|app.get('/api/premium-data', get402.protect('0.01'), handler);\n        67|```\n\n\n        68|\n        69|HTTP 402 is no longer just a reserved status code — it's a business model.\n        70|\n        71|---\n        72|\n        73|*Built on Base. Powered by USDC. Available now at [get402.net](https://get402.net).*\n        74|\n",
  "title": "HTTP 402 Is Back"
}