#Bando - price API
1 messages ยท Page 1 of 1 (latest)
if i wanted to account for potential zero decimal currencies like Japanese yuan what would u think the best approach is
What I'm basically doing is making means to create a price thru my website
Allowing means to select whatever currency
So I want to ideally be able to account for any currency
Taking a look here, give me a few minutes please.
No worries I'm in no rush, i know you guys are pretty busy all the time
So there is not an easy way to do this with zero decimal currencies on Stripe. You'd need to handle this on your end I'm afraid.
how does unit_amount_decimal work?
it'll accept like this 50.00?
Let me test this real quick
In the above example provided, it'll be the same. But if you're adding sub-cents, this is where unit_amount_decimal will come in: https://stripe.com/docs/api/prices/create#create_price-unit_amount_decimal.
So my solution was to make a function
function currencyConvert($iso) {
$zerodecimal = array("BIF","CLP","DJF","GNF","JPY","KMF","KRW","MGA","PYG","RWF","UGX","VND","VUV","XAF","XOF","XPF");
if(in_array($iso,$zerodecimal)) {
return($iso);
} else {
return($iso * 100);
}
}```
hopefully that has it covered!
you'll want to look at https://stripe.com/docs/currencies#special-cases too
lol
payments is hard, but really if I were you I'd focus on currencies I want to support ๐
I think I'll just remove the support for UGX and HUF
I doubt they'd ever be used anyway
yeah they are quite special