Flow

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.

760

Step by step

  1. Client scan LNURL QR or pastes lightning:LNURL... link
  2. Client decodes the LNURL
  3. Client calls the endpoint on the decoded LNURL to get the invoice requirements.
  4. If the amount is not set, the client asks for the amount from the user.
  5. Client creates Lightning invoice
  6. Client calls the callback endpoint on the invoice requirements with the newly created lightning address.
  7. IBEXHub responds immediately and tries to pay asynchronously the invoice.
  8. 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.

750

Step by step

  1. Client scan LNURL QR or pastes lightning:LNURL... link
  2. Client decodes the LNURL
  3. Client calls the endpoint on the decoded LNURL to get the invoice requirements.
  4. If the amount is not set, the client asks for the amount from the user.
  5. Client calls Withdraw from lightning invoice endpoint on IBEXHub
  6. IBEXHub responds immediately and tries to pay asynchronously the invoice.
  7. Client tracks the state of invoice.

For more information, please refer to the official spec https://github.com/lnurl/luds/blob/luds/03.md.