stripe-java
stripe-java copied to clipboard
Feature Request: Add a utility for formatting currency amounts
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 asGBP 50.00
. - For Japanese Yen however, the amount must be displayed as-is: E.g.
JPY 5000
would be displayed asJPY 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
@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!