Skip to content
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

[feature request] msat precision in LN invoice payouts and invoice creation #4602

Open
openoms opened this issue Oct 1, 2024 · 4 comments
Open

Comments

@openoms
Copy link
Collaborator

openoms commented Oct 1, 2024

Currently the calls lnInvoiceCreate and LnInvoiceCreateOnBehalfOfRecipient are only accepting the amount as a (Positive) Satoshi amount.

amount: SatAmount!
Amount in satoshis.
Metadata for SatAmount Type
(Positive) Satoshi amount

When BTCPayServer would create a payment request with msat precision the amount is rounded up to the nearest satoshi and an overpayment is created which causes accounting issues.

A solution for this would be allowing creation of invoices with msat precision on lnInvoiceCreate operation in the API.

cc @NicolasDorier @pavlenex

@openoms
Copy link
Collaborator Author

openoms commented Oct 1, 2024

Update from @NicolasDorier:

Our work around for the invoice creation is the following: BTCPay asks for an invoice of say 5.123 sats, but Blink create a BOLT of 5 sats. In BTCPay we detect the mismatch and says "Ok so let's add a payment method fee of -0.123 sats" so when the customer pay 5 sats, with the negative fee, the invoice of 5.123 sats is considered paid without under/over payments.

The other more pressing issue is the overpayment of the msat precision invoices created in BTCPayServer and paid with the Blink wallet.
When a BTCPay ask a customer to pay for 1.234 sats Blink currently send 2 sats which appears as an overpayment.

The request is to have msat precision in payouts from Blink.

@openoms openoms changed the title [feature request] allow invoice creation in msats [feature request] msat precision in LN invoice payouts and invoice creation Oct 1, 2024
@NicolasDorier
Copy link

Here is how it looks link when a customer pays to a merchant on lightning now:

image

@NicolasDorier
Copy link

@openoms for the issue of lnInvoiceCreate only supporting sats. There is an "easy" way to fix that.

Just make SatAmount in your API a decimal rather than an integer. Wouldn't break anything either from consumer or in your backend. (except potentially DB columns which need type change)

@NicolasDorier
Copy link

Just to let you know: We decided to round down to the sats for 2.0 to avoid those issues in the short term.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants