---
title: HTTP 402 Payment Required：意思、歷史與 x402 | RunAPI
description: HTTP 402 Payment Required 狀態碼是甚麼意思、為何閒置了數十年、現時 API 何時會回傳它，以及 x402 如何將它變成一套付款流程。
url: https://runapi.ai/zh-HK/http-402.md
canonical: https://runapi.ai/zh-HK/http-402
locale: zh-HK
updated: '2026-09-24'
date: '2026-09-24'
site: RunAPI
image: https://runapi.ai/assets/opengraph-bfaaa0f0.png
alternates:
  en: https://runapi.ai/http-402
  zh-CN: https://runapi.ai/zh-CN/http-402
  es: https://runapi.ai/es/http-402
  ja: https://runapi.ai/ja/http-402
  de: https://runapi.ai/de/http-402
  fr: https://runapi.ai/fr/http-402
  pt-BR: https://runapi.ai/pt-BR/http-402
  ko: https://runapi.ai/ko/http-402
  it: https://runapi.ai/it/http-402
  nl: https://runapi.ai/nl/http-402
  pl: https://runapi.ai/pl/http-402
  tr: https://runapi.ai/tr/http-402
  zh-TW: https://runapi.ai/zh-TW/http-402
  zh-HK: https://runapi.ai/zh-HK/http-402
  ar: https://runapi.ai/ar/http-402
  x-default: https://runapi.ai/http-402
---

> HTML version: https://runapi.ai/zh-HK/http-402
> Site index for agents: https://runapi.ai/llms.txt

# HTTP 402 Payment Required：它的意思，以及 x402 如何運用它

402 是表示「伺服器處理請求前需要先付款」的 HTTP 狀態碼。在它存在的大部分時間裏，一直沒有標準格式。x402 補上了這一環。

_更新於 September 24, 2026 · 閱讀時間約 5 分鐘_


## Key takeaways

- 402 Payment Required 是一種客戶端錯誤：請求本身有效，但伺服器要求先付款。
- HTTP/1.1 將 402 保留作日後使用，卻從未定義付款應如何運作，因此各個 API 的用法都不一樣。
- x402 補齊了欠缺的部分：一個載有機器可讀條款的 PAYMENT-REQUIRED header，以及重試時附上的已簽署付款。

## 402 Payment Required 是甚麼意思

402 回應告訴客戶端：請求本身沒有問題，但付款之前不會被處理。它屬於 4xx 系列，因為下一步要採取行動的是客戶端而非伺服器。

402 與 401 Unauthorized、403 Forbidden 不同。401 要求提供憑證，403 直接拒絕請求，402 則要求付款。


## 為何 402 閒置了這麼久

這個狀態碼是在編寫 HTTP/1.1 時保留下來的，當時預期某種形式的數碼現金會在將來出現。但規範從未說明 402 回應的內容應包含甚麼、客戶端又應如何付款，因此瀏覽器從未真正處理過它。

由於沒有統一格式，真正會回傳 402 的 API 只是把它當作一般錯誤：帳戶點數用完、信用卡被拒，或達到計劃上限。


## 現時 API 何時會回傳 402

你會在兩大類情況下見到 402。

- 帳戶計費錯誤：key 有效，但餘額、點數或訂閱不足以支付這次請求。解決方法是增值或升級計劃。
- 按次收費報價：伺服器回傳付款條款，客戶端付款後可以重試同一個請求。x402 正是這樣運作。

## x402 如何將 402 變成付款流程

x402 將機器可讀的條款放進 PAYMENT-REQUIRED header：金額、資產、網絡及收款地址。客戶端按這些條款簽署一份穩定幣授權，經 PAYMENT-SIGNATURE header 送回，然後收到附有 PAYMENT-RESPONSE 收據的回應。

由於整個過程都是一般的 HTTP，擁有錢包的 AI 代理毋須註冊或儲存 API key，都可以為單次 API 調用付款。


## 在客戶端處理 402

先檢查有沒有 PAYMENT-REQUIRED header。如果有，即是 x402 報價，x402 客戶端可以完成付款。如果沒有，請細閱錯誤訊息：通常表示帳戶需要增值或轉換計劃。



## HTTP 402 常見問題

### 402 Payment Required 算是錯誤嗎？

它是 4xx 範圍內的客戶端錯誤，但不代表請求格式有誤。它的意思是：伺服器要求先付款才會繼續處理。

### 402 和 401 有甚麼分別？

401 表示伺服器需要有效憑證，402 表示伺服器需要付款。同一個 API 可以對無效 key 回傳 401，對餘額不足的有效 key 回傳 402。

### 瀏覽器會自動處理 402 嗎？

不會。瀏覽器會把 402 當作一般錯誤頁面顯示。要自動付款，需要一個理解 x402 這類協議的客戶端。

### 哪些 API 會配合 x402 使用 402？

任何實作 x402 協議的伺服器都可以。RunAPI 在按次收費的 AI 模型端點上回傳 x402 報價，讓 AI 代理可以用 USDC 支付圖像、影片、音樂及音訊生成。



## 相關頁面

- [為 AI 模型而設的 x402 API](https://runapi.ai/zh-HK/x402.md) - 在 Base 上以 USDC 按次付費，毋須 API key。
- [模型目錄](https://runapi.ai/zh-HK/models.md) - RunAPI 上所有可用的模型及端點。
- [開發者文件](https://runapi.ai/zh-HK/docs/guides) - 請求格式、任務輪詢及錯誤碼。
- [收費](https://runapi.ai/zh-HK/pricing.md) - 點數、單次調用價格及計費細節。


Claude 訪客：新帳戶可在 30 天內獲得 $1.00 API 贈送額度。每人限領一次，僅用於 API 用量。


## 試試一個真正可以付款的 402

不附 key 向 RunAPI 的按次收費端點發出請求，看看它回傳的 x402 報價。

- [瀏覽模型](https://runapi.ai/zh-HK/models.md)
- [閱讀文件](https://runapi.ai/zh-HK/docs/guides)



---

## More from RunAPI

- [Home](https://runapi.ai/zh-HK/.md)
### 產品
- [模型目錄](https://runapi.ai/zh-HK/models.md)
- [收費](https://runapi.ai/zh-HK/pricing.md)
- [服務商](https://runapi.ai/zh-HK/models#all-models)
### 開發者
- [文件](https://runapi.ai/zh-HK/docs/guides)
- [SDK](https://runapi.ai/zh-HK/sdk.md)
- [CLI](https://runapi.ai/zh-HK/cli.md)
- [MCP Server](https://runapi.ai/zh-HK/mcp.md)
### 指南
- [Claude Code 與 Cursor](https://runapi.ai/zh-HK/claude-code-vs-cursor.md)
- [Cursor API 設定](https://runapi.ai/zh-HK/cursor-api-setup.md)
- [RunAPI 與 OpenRouter](https://runapi.ai/zh-HK/openrouter-alternative.md)
- [x402 API](https://runapi.ai/zh-HK/x402.md)
### 公司
- [企業版](https://runapi.ai/zh-HK/contact.md)
- [聯絡](https://runapi.ai/zh-HK/contact.md)
### 法律
- [條款](https://runapi.ai/zh-HK/terms.md)
- [私隱](https://runapi.ai/zh-HK/privacy.md)
- [Site index for agents](https://runapi.ai/llms.txt)

Contact: contact@runapi.ai

## Structured data

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-HK",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-HK",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/zh-HK/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-HK",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-HK",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/zh-HKicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-HK",
    "@type": "Article",
    "headline": "HTTP 402 Payment Required：意思、歷史與 x402",
    "description": "HTTP 402 Payment Required 狀態碼是甚麼意思、為何閒置了數十年、現時 API 何時會回傳它，以及 x402 如何將它變成一套付款流程。",
    "datePublished": "2026-09-24",
    "dateModified": "2026-09-24",
    "author": {
      "@type": "Organization",
      "name": "RunAPI"
    },
    "publisher": {
      "@type": "Organization",
      "name": "RunAPI",
      "url": "https://runapi.ai/zh-HK"
    },
    "mainEntityOfPage": "https://runapi.ai/zh-HK/http-402"
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-HK",
    "@type": "FAQPage",
    "mainEntity": [
      {
        "@type": "Question",
        "name": "402 Payment Required 算是錯誤嗎？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "它是 4xx 範圍內的客戶端錯誤，但不代表請求格式有誤。它的意思是：伺服器要求先付款才會繼續處理。"
        }
      },
      {
        "@type": "Question",
        "name": "402 和 401 有甚麼分別？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "401 表示伺服器需要有效憑證，402 表示伺服器需要付款。同一個 API 可以對無效 key 回傳 401，對餘額不足的有效 key 回傳 402。"
        }
      },
      {
        "@type": "Question",
        "name": "瀏覽器會自動處理 402 嗎？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "不會。瀏覽器會把 402 當作一般錯誤頁面顯示。要自動付款，需要一個理解 x402 這類協議的客戶端。"
        }
      },
      {
        "@type": "Question",
        "name": "哪些 API 會配合 x402 使用 402？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "任何實作 x402 協議的伺服器都可以。RunAPI 在按次收費的 AI 模型端點上回傳 x402 報價，讓 AI 代理可以用 USDC 支付圖像、影片、音樂及音訊生成。"
        }
      }
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-HK",
    "@type": "BreadcrumbList",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "name": "主頁",
        "item": "https://runapi.ai/zh-HK"
      },
      {
        "@type": "ListItem",
        "position": 2,
        "name": "HTTP 402",
        "item": "https://runapi.ai/zh-HK/http-402"
      }
    ]
  }
]
```
