Skip to content

Instantly share code, notes, and snippets.

@vicariousdrama
Created December 3, 2023 04:15
Show Gist options
  • Save vicariousdrama/6be724fdcd69b9437768d0667d643ff5 to your computer and use it in GitHub Desktop.
Save vicariousdrama/6be724fdcd69b9437768d0667d643ff5 to your computer and use it in GitHub Desktop.
How to manually get an invoice for LNURL address

Example address: brownkat@getalby.com

Call LNURL Payment address supplementing domain, and the username portion

  • username: brownkat
  • domain: getalby.com

URL would be composed as: https://getalby.com/.well-known/lnurlp/brownkat

Open the url in your browser, and the response will look similar to this

{
  "status": "OK",
  "tag": "payRequest",
  "commentAllowed": 255,
  "callback": "https://getalby.com/lnurlp/brownkat/callback",
  "metadata": "[[\"text/identifier\",\"brownkat@getalby.com\"],[\"text/plain\",\"Sats for brownkat\"]]",
  "minSendable": 1000,
  "maxSendable": 500000000,
  "payerData": {
    "name": {
      "mandatory": false
    },
    "email": {
      "mandatory": false
    },
    "pubkey": {
      "mandatory": false
    }
  },
  "nostrPubkey": "79f00d3f5a19ec806189fcab03c1be4ff81d18ee4f653c88fac41fe03570f432",
  "allowsNostr": true
}

Take the value of the callback, and add parameters

The callback from above is https://getalby.com/lnurlp/brownkat/callback

Add the amount, in msats. So 1000 sats would be 1000000, and would be added as a querystring like this

https://getalby.com/lnurlp/brownkat/callback?amount=1000000&comment=Have%20some%20sats

After pasting into the web browser you will get another result with the invoice

{
  "status": "OK",
  "successAction": {
    "tag": "message",
    "message": "Thanks, sats received!"
  },
  "verify": "https://getalby.com/lnurlp/brownkat/verify/Tw8aeGdvCSfi8KQXbT5grAPv",
  "routes": [],
  "pr": "lnbc10u1pjkhllwpp5raukxglyq99t0cs6qta2duey9stwmaccs89u92tx6zqqkrfrz50shp5mldgf9d8chheydnh5jqhgnx6kd9lx224f7387rnltumarhednv0qcqzzsxqyz5vqsp54k2m23pdcyw4jqh4rs8u5kulydcu4p26wj23aq9vyrxm0e5mlegq9qyyssqr3r83rgkzqh38jzdl0nddmepc3p4t34m9msy9yqpu4ymm384wgjxxy5q6nzq40adk3ekyuxqm8drk6m3zwm22ev08a5zj32dg8882vgplzm6kc"
}

In the above, the value of the pr field, beginning lnbc... is the lightning invoice.

Copy that value, and goto duckduckgo.com in your browser.

search for qr followed by a space, and then the lightning invoice. Example

qr lnbc10u1pjkhllwpp5raukxglyq99t0cs6qta2duey9stwmaccs89u92tx6zqqkrfrz50shp5mldgf9d8chheydnh5jqhgnx6kd9lx224f7387rnltumarhednv0qcqzzsxqyz5vqsp54k2m23pdcyw4jqh4rs8u5kulydcu4p26wj23aq9vyrxm0e5mlegq9qyyssqr3r83rgkzqh38jzdl0nddmepc3p4t34m9msy9yqpu4ymm384wgjxxy5q6nzq40adk3ekyuxqm8drk6m3zwm22ev08a5zj32dg8882vgplzm6kc

The qr reference will instruct duck duck go to make a qr code you can scan with your wallet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment