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] Fiat value in checkout #19

Open
arbadacarbaYK opened this issue Sep 18, 2023 · 6 comments
Open

[Feature request] Fiat value in checkout #19

arbadacarbaYK opened this issue Sep 18, 2023 · 6 comments
Assignees

Comments

@arbadacarbaYK
Copy link

Please show fiat-value of preferred currency in checkout.
Most merchants but also users have set their wallets and online-shops to a fiat-currency and the UX breaks here. That mean you cannot check easily if the amount of sats charged is correct.
This goes especially for NFC payments, where you do not see the fiat-value again in your wallet before proceeding to pay.

@talvasconcelos talvasconcelos self-assigned this Oct 4, 2023
@talvasconcelos
Copy link
Collaborator

Where is this fiat set, and is there a global variable we can tap to? Showing a fiat value is fairly straight forward, i just need to know what currency!

@dni @jackstar12 ?

@jackstar12
Copy link

jackstar12 commented Oct 12, 2023

Where is this fiat set, and is there a global variable we can tap to? Showing a fiat value is fairly straight forward, i just need to know what currency!

@talvasconcelos
This currency would have to be set in the creation form (if the user wants to be able to enter a fiat amount aswell?), altough it could default to the one used by the wallet, which you can get through this.g.wallet.currency, and then used as an argument to create_invoice which would calculate the corresponding amount of sats:

satspay/crud.py

Lines 31 to 37 in ba0496e

payment_hash, payment_request = await create_invoice(
wallet_id=data.lnbitswallet,
amount=data.amount,
memo=data.description,
extra={"tag": "charge", "charge": charge_id},
expiry=int(data.time * 60), # convert minutes to seconds
)

That would not work for onchain tough, so you could call the service that does the fiat conversion directly. https://github.com/lnbits/lnbits/blob/dev/lnbits/core/services.py#L66

@talvasconcelos
Copy link
Collaborator

I thought that what was asked was to just display the value on the charge in fiat (@arbadacarbaYK ?)! not defining the charge in fiat terms, that's another beast, and can cause some issues if for example i have a charge that expires in 24h!

So there's a currency property on g.wallet? I can use that... Convert at mount and display the fiat value, if exists in the wallet!

@talvasconcelos
Copy link
Collaborator

If the charge is only onchain, that doesn't work! On setting fiat tracking, there could/should be a global variable with that currency! It would make things easier for using at extensions.

@jackstar12
Copy link

jackstar12 commented Oct 13, 2023

If the charge is only onchain, that doesn't work! On setting fiat tracking, there could/should be a global variable with that currency! It would make things easier for using at extensions.

Well, there is. this.g.wallet.currency if the current if I remember correctly or just the currency wallet property on the python side

@arbadacarbaYK
Copy link
Author

arbadacarbaYK commented Oct 14, 2023

I thought that what was asked was to just display the value on the charge in fiat (@arbadacarbaYK ?)! not defining the charge in fiat terms, that's another beast, and can cause some issues if for example i have a charge that expires in 24h!

So there's a currency property on g.wallet? I can use that... Convert at mount and display the fiat value, if exists in the wallet!

its was not just about displaying, also about storing in the csv - it belongs to
lnbits/lnbits#1754 (comment) and some others where alltoghether i asked for a default national fiat currency and to have that possible to be overwritten in extensions and stored in the csv, tx-history for the tpos and print-outs.

Because it has gotten so many unconnected PR i lost track.

lnbits/lnbits#1852
and
lnbits/lnbits#1789
and
lnbits/tpos#20
and
lnbits/lnbits#1852
and
lnbits/lnbits#1756
and
lnbits/lnbits#1813
and
lnbits/lnbits#1869
and
lnbits/lnbits#1909
and
lnbits/lnbits#1666

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

3 participants