I recently was search for the easiest way to do this, not with JS, but from within Android. I managed to get a MVP (GPT4BTC) communicating with getalby's LN node via their lnurl REST api: example Android Kotlin code.
  1. By far the easiest solution is to simply use a third-party's api (i.e. getalby.com) to interact with LN via lnurl protocol, as you won't have to deal with setting up and maintaining your own node. For example, payRequests allow you to call REST api to get encoded ln invoice, as in example below.
  2. The trade offs are, of course, loss of control, placing trust in third-parties, and limitations of their api. Also there are serious limitation with the lnurl specs themselves. For example: there are limited extra data fields you can pass into invoices, such as 'amount', 'comment', 'name', and 'email' - although the spec will no doubt expand its capabilities overtime.
  3. Here's some simple restful uri examples for interacting with getalby lnurl api from a web context - where 'bitanon' is my lnurl address username on getalby: bitanon@getalby.com.
-get lnurl details, including default human-readable payment meta-data: https://getalby.com/.well-known/lnurlp/bitanon
-get encoded lnurl from 'pr' field, including amount and comment (description): -note: unfortunately invoice details returned seem to remain encoded when viewed in sending wallet https://getalby.com/lnurlp/bitanon/callback?amount=10000&comment=hello
Certain wallets also allow for passing in other payRequest payerData.
Now, I'm learning how to use lnauth, hopefully in a similar manner, owing to the ease of implementation; and will reply to this post in the future with details on how to do that.
Also, response includes 'verify' field containing a url for verifying if payment was successfully received!
reply