author: akumaigorodski
diagram: johnpaulkiser
Withdrawing funds from a service
Today users are asked to provide a withdrawal Lightning invoice to a service. This requires some effort and is especially painful when users try to withdraw funds into mobile wallets while using a desktop website. Instead of asking for Lightning invoice a service could display a “withdraw” QR code which contains a specializedLNURL.
Wallet to service interaction flow:
-
User scans a LNURL QR code or accesses an
lightning:LNURL..link withLN WALLETandLN WALLETdecodes LNURL. -
LN WALLETmakes a GET request toLN SERVICEusing the decoded LNURL. -
LN WALLETgets JSON response fromLN SERVICEof form:or -
LN WALLETDisplays a withdraw dialog where user can specify an exact sum to be withdrawn which would be bounded by: -
Once accepted by the user,
LN WALLETsends a GET toLN SERVICEin the form of -
LN SERVICEsends a{"status": "OK"}or{"status": "ERROR", "reason": "error details..."}JSON response and then attempts to pay the invoices asynchronously. -
LN WALLETawaits for incoming payment if response was successful.
k1. In order to harden this a service may require authorization (LNURL-auth, email link etc.) before displaying a withdraw QR.