pmclain / module-stripe

Stripe Payments for Magento 2
Open Software License 3.0
47 stars 21 forks source link

No Support for Zero-Decimal Currencies #57

Closed hanego closed 6 years ago

hanego commented 6 years ago

Hi,

I don't understand the purpose of the file Pmclain\Stripe\Helper\Payment\Formatter. In my case, the price is multiplied by 100 as the decimals separator is removed and then, in my stripe test account, all the totals are x100. Is it expected?

Thanks.

pmclain commented 6 years ago

What currency are you using?

Stripe's API accepts only integers

A positive integer in the smallest currency unit

I don't now of anyone using the module with a zero-decimal currency and suspect that may be causing the issue here, assuming you are using such a currency.

hanego commented 6 years ago

Yes indeed, I use a module for removing the decimal (https://github.com/lillik/magento2-price-decimal). For japanese yen or korean won, there is no decimal in the price, so it's a bit weird to display the default xxxx.00. I will look into the module to check if this is the cause.

pmclain commented 6 years ago

The issues is definitely the being caused by the price formatter when sending requests. What are your thoughts on adding a configuration in this module's configuration allowing the admin for defining the currency precision when sending to stripe? I glanced at the stripe docs and didn't see a full proof way of determining this via their api. So it think it would be best to leave the configuration of the smallest currency unit to the store owner.

pmclain commented 6 years ago

I wasn't reading stripe's docs properly and they do list the zero-decimal currencies. There should be a release with zero-decimal currency support in the next couple of days.