Description
As explained in the Lightning Invoices Flow, you need an invoice every time you want to make a payment. The LNURL-withdraw protocol automates the process of generating an invoice and agreeing on the amount.
The idea is that a wallet can scan a static QR code or click on a static LNURL address in order to request a withdrawal of funds. This works by the wallet providing an invoice to the service to get the funds.
Flow for clients without IBEXHub account
This is the regular flow of the LNURL-withdraw protocol. This is how to be used when the client doesn't use IBEXHub.
Step by step
- Client scan LNURL QR or pastes lightning:LNURL... link
- Client decodes the LNURL
- Client calls the endpoint on the decoded LNURL to get the invoice requirements.
- If the amount is not set, the client asks for the amount from the user.
- Client creates Lightning invoice
- Client calls the callback endpoint on the invoice requirements with the newly created lightning address.
- IBEXHub responds immediately and tries to pay asynchronously the invoice.
- If IBEXHub response is 200 OK, the client awaits incoming payment
Flow for clients with IBEXHub account
This is the flow for LNURL-withdraw using IBEXHub, the client has an IBEXHub account where the funds are going to be credited.
Step by step
- Client scan LNURL QR or pastes lightning:LNURL... link
- Client decodes the LNURL
- Client calls the endpoint on the decoded LNURL to get the invoice requirements.
- If the amount is not set, the client asks for the amount from the user.
- Client calls Withdraw from lightning invoice endpoint on IBEXHub
- IBEXHub responds immediately and tries to pay asynchronously the invoice.
- Client tracks the state of invoice.
For more information, please refer to the official spec https://github.com/lnurl/luds/blob/luds/03.md.