LUD-12: Comments in payRequest.
March 25, 2022 ยท View on GitHub
author: andreneves discussion: https://github.com/fiatjaf/lnurl-rfc/pull/50
Support for LNURL-pay comment
This allows for a WALLET to pass a custom comment property to a SERVICE that accepts it. This can have multiple use-cases. Better donation flow is an easy one to visualize. The entity donating gets to send a message, whether their name/contact/random text and the issuer gets paid to read/voice/receive that message, for example, streamers.
This is completely additional/ad-hoc, so current implementations are not affected by this. Any services and wallets that wish to support it do need to add some more business logic.
Service-side
SERVICE must alter its JSON response to the first callback to include a commentAllowed field, as follows:
{
"callback": string,
"maxSendable": number,
"minSendable": number,
"metadata": string,
+ "commentAllowed": number,
"tag": "payRequest"
}
The value of commentAllowed should be the number of characters accepted for the comment query parameter on subsequent callback. (Should be interpreted as 0 if not provided).
Wallet-side
Upon seeing a positive commentAllowed attribute on the response from the SERVICE, a WALLET must display a text input where user can enter a comment string (max character count is equal or less than commentAllowed value) along with the other LNURL-pay metadata (text and image).
After gathering input from the user, WALLET must include the comment in its second callback to SERVICE:
- <callback><?|&>amount=<milliSatoshi>
+ <callback><?|&>amount=<milliSatoshi>&comment=<String>
Note on comment length
GET URL's accept around ~2000 characters for the entire request string. Therefore comment can only be as large as to fit in the URL alongside any/all of the properties outlined above.