-
Notifications
You must be signed in to change notification settings - Fork 164
LUD-21: Specify a payment amount in local unit of account #207
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
Open
ethanrose
wants to merge
7
commits into
lnurl:luds
Choose a base branch
from
ethanrose:LUD-21/pouchph/pay-local-currency
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.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3b9dc13
LUD-21: Guarantee payment amount in a localized currency using `payRe…
285a85d
Add instructions re: currency.currencyParamSupported
d04066e
simplify the spec
6ccff90
Add a warning about how service-provided exchange rates open a new me…
2e044bb
Update title "local unit of account". Add back rateEstimate concept, …
7302d15
update rateEstimate to multiplier
8d5af2e
use proper exponent operator in code block
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 hidden or 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,57 @@ | ||
| LUD-21: Pay in local unit of account. | ||
| ================================================ | ||
|
|
||
| `author: ethanrose` | ||
|
|
||
| --- | ||
|
|
||
| The idea here is to enable a merchant to receive an exact payment amount, in whatever currency their goods are priced in (i.e. their own fiat currency). A sender should be able to input the amount in the recipient's own unit of account. | ||
|
|
||
| Typically this is for a point-of-sale use-case where a lightning service is acting as a bitcoin-to-fiat payment processor. Currently, a sender would have to use their own calculator to determine how many sats to pay, and the recipient inevitably would receive the close-but-wrong amount. This bad experience is a hinderance to adoption of lightning as a cross-border payment system. | ||
|
|
||
| ## 1. `currency` record in payRequest details | ||
|
|
||
| If `SERVICE` wishes for a `WALLET` user to specify a payment amount in a different unit of account, it MUST alter its JSON response in the payRequest details response to include a `currency` object, as follows: | ||
|
|
||
| ```diff | ||
| { | ||
| "callback": String, | ||
| "maxSendable": number, | ||
| "minSendable": number, | ||
| "metadata": string, | ||
| + "currency": { | ||
| + "code": "PHP", | ||
| + "name": "Philippine Pesos", | ||
| + "symbol": "₱", | ||
| + "minSendable": 1, | ||
| + "maxSendable": 50000, | ||
| + "multiplier": 64501 // estimated millisats per "unit" | ||
| + }, | ||
| "tag": "payRequest", | ||
| } | ||
| ``` | ||
|
|
||
| NOTE: `SERVICE` must include a `multiplier` property. This is an estimate which helps the `WALLET` do frontend validation & set expectations for users. A simple helper for the `SERVICE` to calculate millisats `multiplier` from common BTC rates is: | ||
|
|
||
| ``` | ||
| 10**11 / btcRate | ||
| ``` | ||
|
|
||
| ## 2. User interface for specifying currency | ||
|
|
||
| If there is a `currency` record in the initial response, `WALLET` must display a modified interface: | ||
| - The wallet must display the `currency.code` and/or `currency.name` instead of its default currency. | ||
| - The wallet must enforce `currency.minSendable` and `currency.maxSendable`. | ||
|
|
||
| ## 3. Including `currency` in callback parameters | ||
|
|
||
| In the next step of the LNURL-Pay flow, `WALLET` must include a `currency` query parameter in the callback along with the `amount`: | ||
|
|
||
| ```diff | ||
| - <callback><?|&>amount=<milliSatoshi> | ||
| + <callback><?|&>amount=<philippinePeso>¤cy=PHP | ||
| ``` | ||
|
|
||
| ## 4. User interface for reviewing & confirming the exchange rate | ||
|
|
||
| - `WALLET` must display a confirmation screen so that the user can review/verify and "approve" or "confirm" the resulting invoice amount. | ||
This file contains hidden or 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
This file contains hidden or 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
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.
You say must here, but since we do not omit
maxSendable&minSendablefrom the initial payRequest details, it is actually a should.