https://github.com/jimasuen/lnbits-lightning-lnurl
Documentation on using LNbits API to pay lightning addresses and LNURL
https://github.com/jimasuen/lnbits-lightning-lnurl
curl lightning lightning-address lightningaddress lnbits lnurl
Last synced: about 2 months ago
JSON representation
Documentation on using LNbits API to pay lightning addresses and LNURL
- Host: GitHub
- URL: https://github.com/jimasuen/lnbits-lightning-lnurl
- Owner: jimasuen
- License: mit
- Created: 2023-09-06T18:39:48.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-28T17:19:36.000Z (about 2 years ago)
- Last Synced: 2024-04-28T18:28:29.375Z (about 2 years ago)
- Topics: curl, lightning, lightning-address, lightningaddress, lnbits, lnurl
- Homepage:
- Size: 36.1 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lnbits-lightning-lnurl
Documentation on using LNbits API to pay lightning addresses and LNURL
Link to the relevant part of the LNbits API:
https://demo.lnbits.com/docs#/Payments/api_payments_pay_lnurl_api_v1_payments_lnurl_post
For testing purposes, you can inspect your LNURL and lightning address and view the expected `description_hash` using this tool:
https://lightninginspector.mysatoshikit.com/
# STEPS:
1. Decode LNURL using LNbits API. Skip this if you're paying a lightning address.
```
curl -X 'POST'
https://your-lnbits-endpoint.com/api/v1/payments/decode
-H "X-Api-Key: "
-H "Content-type: application/json"
-d '{"data": }'
```
Sample response:
```
{
"domain": "https://decoded-lnurl-domain.com"
}
```
2. Retrieve callback URL and metadata from lightning address or LNURL.
cURL for lightning address:
``` curl 'https://lightning-wallet-domain.com/.well-known/lnurlp/username' ```
OR
cURL for LNURL:
``` curl 'https://decoded-lnurl-domain.com' ```
Sample response:
```
{
"status": "OK",
"tag": "payRequest",
"commentAllowed": 255,
"callback": "https://lightning-wallet-domain.com/lnurlp/username/callback",
"metadata": "[[\"text/identifier\",\"username@lightning-wallet-domain.com\"],[\"text/plain\",\"Payment\"]]",
"minSendable": 1000,
"maxSendable": 11000000000,
"payerData": {
"name": {
"mandatory": false
},
"email": {
"mandatory": false
},
"pubkey": {
"mandatory": false
}
}
}
```
3. Process payment using LNbits API:
```
curl -X 'POST'
'https://your-lnbits-endpoint.com/api/v1/payments/lnurl'
-H "X-Api-Key: "
-H 'Content-Type: application/json'
-d '{
"description_hash": ,
"callback": ,
"amount": ,
"comment": ,
"description":
}'
```
WHERE:
`description_hash` = the sha256 hash of parsed metadata from decoded LNURL or lightning address
`callback` = callback url from decoded LNURL or lightning address
`amount` = amount to be paid; specified in millisats (sats to be paid * 1000)
`comment` = transaction note that will appear in receiver's lightning wallet (write what you want)
`description` = memo that will appear in your LNbits wallet (write what you want)
# Relevant links:
1. On lightning addresses: https://github.com/andrerfneves/lightning-address/blob/master/README.md
2. On LNURL payRequest: https://github.com/lnurl/luds/blob/luds/06.md
3. Tool to view expected `description_hash` of parsed metadata from decoded LNURL or lightning address: https://lightninginspector.mysatoshikit.com/