[403] [DFN[[CODE(HTTP)[[[402]]]]]] ([DFN[[[Payment Required]]]])
は、[[課金]]に関する制限により[[要求]]が処理されなかったことを示す[[状態符号]]です。

* 仕様書

[REFS[
- [404] [CITE@en[RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content]] ([TIME[2014-08-07 05:54:02 +09:00]] 版) <https://tools.ietf.org/html/rfc7231#section-6.5.2>
]REFS]

[405] 歴代の [[HTTP]] [[仕様書]]は [CODE(HTTP)[[[402]]]] を[[予約]]しているだけで、
実質的な定義は存在していません。

* 構文

[407] [[応答]]の [[payload body]] には、アクセス頻度や[[課金]]などに関するエラーであることを示す短い文章が含まれるのが普通です。

[408] アクセス状況や[[課金]]の状態などを[[機械可読]]な形で提示したり、
自動的に支払いを行ったりするような仕組みは存在していません。

* 文脈

[406] かつて [CODE(HTTP)[[[402]]]] [[応答]]は、 [[Web API]] に ([[鯖]]の判断基準による)
過剰なアクセスがあった場合にしばしば用いられていました。現在ではそうした場合は
[CODE(HTTP)[[[429]]]] がより適切と考えられています。

* 歴史

[4] [[RFC 2068]], [[RFC 2616]], [[RFC 7231]] のいずれも、 [CODE(HTTP)[[[402]]]]
([CODE(HTTP)[[[Payment Required]]]]) は[[理由句]]が定義されているだけで、
[[状態符号]]自体は予約 [SRC[>>2, >>3]] されていて、使われていません。

[FIG(quote)[
[FIGCAPTION[
[2] RFC 2068 & 2616 (HTTP/1.1) 10.4.3 402 Payment Required
]FIGCAPTION]

> This code is reserved for future use.

この符号は将来の使用のために予約しています。
]FIG]

[REFS[
- [3] [CITE@en[RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content]] ([TIME[2014-08-07 05:54:02 +09:00]] 版) <https://tools.ietf.org/html/rfc7231#section-6.5.2>
]REFS]

[REFS[
- [1] [CITE[法と技術とクローラと私 - 最速転職研究会]]
([TIME[2010-07-08 07:47:20 +09:00]] 版)
<http://d.hatena.ne.jp/mala/20100707/1278514965>
]REFS]


[409] [CITE@en[RFC 2660 - The Secure HyperText Transfer Protocol]]
( ([TIME[2014-11-09 14:12:37 +09:00]] 版))
<http://tools.ietf.org/html/rfc2660#section-5.2.1>

[FIG(quote)[
[FIGCAPTION[
[5] [CITE@en[REST API Reference - PayPal Developer]]
([TIME[2015-07-02 12:54:14 +09:00]] 版)
<https://developer.paypal.com/docs/api/>
]FIGCAPTION]

> 402	- Failed request

]FIG]


[FIG(quote)[
[FIGCAPTION[
[6] [CITE@en[Stripe API Reference]]
([TIME[2015-08-29 17:37:34 +09:00]] 版)
<https://stripe.com/docs/api#errors>
]FIGCAPTION]

> When a request is valid but does not complete successfully (e.g. a card is declined), we return a 402 error code.
> 402 - Request Failed	Parameters were valid but request failed.

]FIG]


[FIG(quote)[
[FIGCAPTION[
[7] [CITE[402 Payment Requiredが出た方へ]]
( ([TIME[2012-02-11 05:45:34 +09:00]]))
<http://s1.gptwm.com/402error.html>
]FIGCAPTION]

> 
> 本サイトは同時接続数制限2ですので、それを超えるとエラーが出るようにしています。

]FIG]


[FIG(quote)[
[FIGCAPTION[
[8] [CITE@en[New HTTP Status Code (402 - Payment Required) - API Announcements — Ecommerce University]]
( ([TIME[2016-05-15 18:33:58 +09:00]]))
<https://ecommerce.shopify.com/c/api-announcements/t/new-http-status-code-402-payment-required-215030>
]FIGCAPTION]

> I want to let you know the API will now respond with (402 - Payment Required) when a shop does not have access to a specific feature. Prior to this change the API would respond with (404 - Not Found).
> In addition to this HTTP Status Code there will be an error included in the JSON response:
> This shop's plan does not have access to this feature

]FIG]


[FIG(quote)[
[FIGCAPTION[
[9] [CITE@en[Google APIs - Global domain errors  |  YouTube Data API  |  Google Developers]]
( ([TIME[2015-05-21 03:44:24 +09:00]]))
<https://developers.google.com/youtube/v3/docs/core_errors#PAYMENT_REQUIRED>
]FIGCAPTION]

> dailyLimitExceeded402	A daily budget limit set by the developer has been reached.
> quotaExceeded402	The requested operation requires more resources than the quota allows. Payment is required to complete the operation.
> user402	The requested operation requires some kind of payment from the authenticated user.

]FIG]



[10] 
[CITE@ja[XユーザーのCoinbase Developer Platform🛡️さん: 「First, a little history: HTTP 402 “Payment Required” has been a part of the internet’s blueprint for decades, but it was never used. x402 turns this 402 status code into a real payment layer—letting any server request payment, and any client (human or agent) respond with」 / X]], [TIME[午前1:04 · 2025年5月7日][2025-05-06T16:04:00.000Z]], [TIME[2025-05-08T02:48:50.000Z]] <https://x.com/CoinbaseDev/status/1919785226936713369>


[11] [CITE@en[x402.org]], [TIME[2025-05-08T03:02:38.000Z]] <https://www.x402.org/>


[12] 
[CITE@ja[x402: The Payment Protocol for Agentic Commerce - x402-whitepaper.pdf]], [TIME[2025-05-08T01:20:16.000Z]], [TIME[2025-05-08T03:03:22.564Z]] <https://www.x402.org/x402-whitepaper.pdf>

[13] 
[CITE@en[GitHub - coinbase/x402: A payments protocol for the internet. Built on HTTP.]], [TIME[2025-05-08T03:04:39.000Z]] <https://github.com/coinbase/x402/>


[14] 
[CITE@en[Introducing x402: a new standard for internet-native payments | Coinbase]], [TIME[2025-05-08T03:05:17.000Z]] <https://www.coinbase.com/developer-platform/discover/launches/x402>



[15] 
[CITE@en-us[Introducing pay per crawl: enabling content owners to charge AI crawlers for access]], [TIME[2025-07-03T02:31:59.000Z]] <https://blog.cloudflare.com/introducing-pay-per-crawl/>
