L402: The Missing Link in Internet Payment Infrastructure
This text is adapted from the L402 documentation In today’s AI-driven world, L402 bridges the gap between automation and payments, enabling machine-friendly transactions where traditional human-centric payment flows fall short.Key Features
L402 simplifies and automates the process of handling payments on the internet, allowing seamless integration into digital workflows. It leverages HTTP as a foundation to standardize how payments are requested and processed, making it easier for AI agents and automated systems to interact with services.- HTTP-based flow: simplifies payment handling by using HTTP 402 status codes and JSON payloads, allowing clients to request resources, pay and access them seamlessly.
- Standarize payment requests: services indicate payment requirements, making integration predictable and easier for developers to implement across different systems.
- Payment agnostic: works with a variety of payment solutions, from services like Stripe to cryptocurrencies, offering developers the flexibility to use the payment network that best fits their needs.
- Designed for automation: enables seamless, autonomous transactions between services and AI agents, removing the need for human intervention in payment processes.
- Extensible and open source: built to be open and adaptable, making it easy to extend and integrate with future payment solutions and evolving technologies. Introduction
A client attempts to access a protected API resource that requires payment to use.
Server responds with a 402 Payment Required status code and JSON containing available payment offers and methods for the client to choose from.
Client contacts the payment gateway to request specific payment details for their chosen offer and preferred payment method.
Gateway returns payment details needed for the transaction - such as a checkout URL, Lightning invoice, or ACH account information.
Client completes the payment outside of the protocol using their selected payment method and the provided payment details.
Once payment is confirmed, the payment gateway notifies the server that the payment has been received successfully.
When the client requests the resource again, the server recognizes the completed payment and grants access to the protected resource.