Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Description  





2 Examples  





3 Usage  





4 Experimental  





5 Response representation  





6 Relationship with other status codes  





7 References  





8 External links  














HTTP 402






Deutsch
Français

 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


HTTP Status Code 402, also known as "Payment Required," is a standard response code in the Hypertext Transfer Protocol (HTTP). It is part of the HTTP/1.1 protocol defined by the Internet Engineering Task Force (IETF) in the RFC 7231 [1] specification.

Description[edit]

The HTTP 402 status code indicates that the client must make a payment to access the requested resource.[2] It is typically used in situations where the server requires payment before granting access to the content or service. This code serves as a reminder that financial transaction or authorization is needed to proceed further.

The 402 status code is considered non-standard and was introduced to extend the HTTP protocol's capabilities beyond the standard set of status codes. It provides a clear indication to the client that they need to take action to complete the payment process before they can access the requested resource.

Examples[edit]

Client request:

GET /index.php HTTP/1.1
Host: www.example.org

Server response:[3]

HTTP/1.1 402 Payment Required
Location: https://www.example.org/index.asp

Usage[edit]

The HTTP 402 status code is typically used in e-commerce and subscription-based systems where access to content or services is restricted until the user completes a payment. It can be employed in various scenarios, such as:

Experimental[edit]

The HTTP status code 402 is currently classified as an experimental code within the HTTP protocol. Such experimental codes are introduced to assess new features or ideas and determine their practical application. The designation of the 402 status implies that a payment is mandated to obtain a particular resource or service. However, its tentative status indicates limited mainstream adoption. Web developers and institutions are advised to adhere to recognized HTTP norms and employ stable, thoroughly documented status codes. Even though the 402 code might be used on an experimental basis, caution is recommended because of potential discrepancies and compatibility challenges.[5]

Response representation[edit]

The HTTP 402 response is accompanied by an entity body that provides additional information to the client regarding the payment requirements. This entity body can be in various formats, including HTML, XML, or JSON, and typically includes details such as the payment amount, payment methods accepted, and instructions on how to complete the transaction.[6]

The server may also include relevant headers in the response, such as Retry-After, which indicates the time duration the client should wait before retrying the request after completing the payment process.[6]

Relationship with other status codes[edit]

The HTTP 402 status code should not be confused with the more commonly used 403 Forbidden status code.[7] While both codes indicate that access to a resource is restricted, the distinction lies in the reason for the restriction. The 402 code specifically implies that payment is required, whereas the 403 code implies that access is forbidden due to other reasons, such as insufficient permissions or authentication failure.

In cases where the server requires payment but also wants to convey additional information about why access is denied, it is common to include the 402 status code alongside a 403 status code. This combination helps communicate the payment requirement while providing more context to the client.[8]

References[edit]

  1. ^ Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content. IETF. sec. 6.5.2. doi:10.17487/RFC7231. RFC 7231.
  • ^ HTTP status code 402 Payment Required
  • ^ developer.mozilla.org Example response
  • ^ HTTP status code 402 General explanation of the 402 status code
  • ^ developer.mozilla.org Experimental
  • ^ a b Fielding, R., Gettys, J., Mogul, J., et al. (1999). "[rfc:2616 Hypertext Transfer Protocol -- HTTP/1.1]". RFC 2616. IETF.
  • ^ stackoverflow.com Difference between http response status code 402 and 403
  • ^ The difference between HTTP status code 402 and 403
  • External links[edit]


    Retrieved from "https://en.wikipedia.org/w/index.php?title=HTTP_402&oldid=1221140403"

    Categories: 
    Computer errors
    Hypertext Transfer Protocol status codes
    Hidden categories: 
    Articles with short description
    Short description is different from Wikidata
     



    This page was last edited on 28 April 2024, at 03:37 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki