Closed kaloudis closed 4 years ago
I'm happy to implement this myself, but would like to get some discussion going first on how this should function.
Implementing this was pretty straightforward so I went ahead and made the BTC display unit configurable using a new metadata.checkout.display_unit
field. It can be set to one of msat
, sat
, bit
, milli
or btc
. For example:
$ curl $CHARGE/invoice -d msatoshi=150000 -d metadata[checkout][display_unit]=bit
Or with json:
$ curl $CHARGE/invoice -H 'Content-Type: application/json' -d '{"msatoshi":150000,"metadata":{"checkout":{"display_unit":"bit"}}}'
I also changed the default display unit to satoshis.
Cheers!
Great job! Closing this out and opening https://github.com/ElementsProject/wordpress-lightning-publisher/issues/8 to track in Wordpress Lightning Publisher
mBTC isn't very commonly used and sats are becoming somewhat of a standard. It would be awesome if lightning-charge displayed units in satoshis, especially when used on a paywall like wordpress-lightning-publisher