-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LUD-23 Webhook notification for a third-party in pay protocol #147
Draft
hsjoberg
wants to merge
1
commit into
lnurl:luds
Choose a base branch
from
hsjoberg:webhook-notification
base: luds
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
LUD-23: Webhook notification for a third-party in pay protocol. | ||
================================= | ||
|
||
`author: hsjoberg` `author: andreneves` `author: fiatjaf` | ||
|
||
--- | ||
|
||
## Third-party webhook notification | ||
|
||
In cases where an LNURL-pay code is displayed on a third-party website, | ||
it could make sense to be able to give feedback to the user upon a payment | ||
completion. | ||
|
||
## Construction | ||
|
||
In order to accomplish this, the third party can re-construct the bech32 code or | ||
build a [LUD-17](./17.md) raw LNURL code, with a `webhook` query parameter | ||
amended to the URL. The value of `webhook` is a URL that should be called by the | ||
service upon payment completion. | ||
|
||
In the case of a [LUD-16](./16.md) Lightning Address, the query parameter `MUST` | ||
be added the translated URL instead of the Internet Identifier. | ||
|
||
Raw LNURL: | ||
`lnurlp://domain.com/pay?webhook=thirdparty.com/webhook` | ||
|
||
Bech32: | ||
`lnurl1dp68gurn8ghj7er0d4skjm3wvdhk6tmsv9un7am9vf5x7mmt846xs6tjv3cxzun50yhxxmmd9amk2cngdahkkxmx8qr` | ||
|
||
Translated Lightning Address: | ||
`lnurlp://domain.com/.well-known/lnurlp/user?webhook=thirdparty.com/webhook` | ||
|
||
## Service-side | ||
|
||
To signal support for webhook notification, the `SERVICE` `MUST` include | ||
property `webhookAllowed` in its first callback. | ||
|
||
```diff | ||
{ | ||
"callback": String, | ||
"maxSendable": MilliSatoshi, | ||
"minSendable": MilliSatoshi, | ||
"metadata": String, | ||
+ "webhookAllowed": Boolean, | ||
"tag": "payRequest", | ||
} | ||
``` | ||
|
||
If the service received `webhook` query parameter `SERVICE` `MUST` make a `POST` | ||
call to the `webhook` parameter URL when the invoice is settled. | ||
|
||
The body payload should be in the following format: | ||
|
||
```JSON | ||
{ | ||
"paymentHash": String, | ||
"status": "settled", | ||
"amount": MilliSatoshi, | ||
"preimage": String, | ||
} | ||
``` | ||
|
||
The `status` property should be of type String and be equal to `settled`. | ||
|
||
## Wallet-side | ||
|
||
Upon seeing the `webhook` query parameter in the LNURL, `WALLET` `SHOULD` inform | ||
the user that the third-party may receive info about payments for this LNURL-pay | ||
code. | ||
|
||
`WALLET` `MAY` inform the user if the `webhookAllowed` response in the first | ||
wallet does not exist. | ||
|
||
`WALLET` `MUST` disallow payments if `webhookAllowed` is set to `false`. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what should the wallet do if the webhook param was in the lnurl request but the first callback didn't contain the
webhookAllowed
paramThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benthecarman Hmm yeah that would mean that the third party server is trying to use a feature that is not supported by the LNURL-pay service.
I think failing makes the most sense in that situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should probably be specified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I'll address this.