azmenak / react-stripe-checkout

Load stripe's checkout.js as a react component. Easiest way to use checkout with React.
MIT License
984 stars 160 forks source link

"Accepted currencies" hardcoded? Seems to be dynamic based on Country. #104

Open harisibrahimkv opened 6 years ago

harisibrahimkv commented 6 years ago

I tried passing in currency as MMK and it threw:

Warning: Failed prop type: Invalid prop `currency` of value `MMK` supplied to `ReactStripeCheckout`, expected one of

 ["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BIF","BMD","BND","BOB","BRL","BSD","BWP","BZD","CAD","CDF","CHF","CLP","CNY","COP","CRC","CVE","CZK","DJF","DKK","DOP","DZD","EEK","EGP","ETB","EUR","FJD","FKP","GBP","GEL","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","ISK","JMD","JPY","KES","KGS","KHR","KMF","KRW","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","MAD","MDL","MGA","MKD","MNT","MOP","MRO","MUR","MVR","MWK","MXN","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SEK","SGD","SHP","SLL","SOS","SRD","STD","SVC","SZL","THB","TJS","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","UYU","UZS","VND","VUV","WST","XAF","XCD","XOF","XPF","YER","ZAR","ZMW"].

MMK seems to be supported as per https://stripe.com/docs/currencies.

However, according to https://stripe.com/docs/api?lang=python#country_spec_object, the supported currencies seems to be country dependant.

supported_payment_currencies: Currencies that can be accepted in the specified country (for payments).

So the question is:

Should we update this hardcoded list with all the accepted currencies (hence including MMK as well) or is there a way to make this dynamic based on the stripeKey="my_PUBLISHABLE_stripekey" prop that is being passed in?

harisibrahimkv commented 6 years ago

Here is a PR updating the list: https://github.com/azmenak/react-stripe-checkout/pull/105.

Please verify. I've provided the steps I did to get the new list as well. I might have overlooked something.

Thanks!