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: Add a utility for formatting currency amounts #1086

Open
Dretch opened this issue Aug 21, 2020 · 1 comment
Open

Feature Request: Add a utility for formatting currency amounts #1086

Dretch opened this issue Aug 21, 2020 · 1 comment
Labels

Comments

@Dretch
Copy link

Dretch commented Aug 21, 2020

Stripe stores currency amounts in the smallest unit, but this is not suitable for showing to a user because they are used to seeing major units - e.g. USD 10.50.

The computation for what to show to a user will differ depending on the currency in question:

  • For GBP or USD, one simply has to divide the amount by 100 in order to get it into the major units. E.g. GBP 5000 should display as GBP 50.00.
  • For Japanese Yen however, the amount must be displayed as-is: E.g. JPY 5000 would be displayed as JPY 5000.

It would be helpful if the knowledge about what to do in order to display different currencies could be encapsulated inside of the Stripe Java library, so that it does not have to be re-invented by users.

Thanks

@remi-stripe
Copy link
Contributor

@Dretch Thank you for reaching out about this. We've definitely heard this before but it's not something we have considered implementing for now. Right now we recommend that you cache this information yourself, based on this article though it's definitely not easy to scale this as we add new currencies. We're also working on some currencies with 3 decimals which will change the approach in the future too.\

For now, I've tagged this as future though I don't think it would happen in the near future!

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

No branches or pull requests

2 participants