About L402 and how to use it
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.