In the pic below, the first payment should have been 36 JPY but instead of 36.00 JPY, stripe shows is 3,600 JPY.
Second one should have been 6.00 JPY but it’s 600 JPY. However, the pound looks correct. 10.00 GBP.
Any idea if the JPY would be charged correctly? Doesn’t look like it. This is a sandbox thank God!
if stripe truly is doing that, then the workaround would be to when setting a price in a currency known to add double zeros to conditionally alter the way you send the price value to stripe
It’s not Stipe… it’s whatever plugin you’re using.
Stripe always works with the smallest denomination of the currency.
For USD that’s cents.
For GBP that’s pence
For JPY that’s Yen
So £10 is 1,000 pence (i.e. the amount in £ multiplied by 100)
Whereas 10¥ is 10¥ (you don’t multiply by 100 here - otherwise you’ll get the error you’ve got)
Normally, when calling the API directly you need to multiply the amount (in £) by 100 to get the amount in pence, assuming the selected currency has a decimal denomination.
In the case of whatever plugin you’re using, it looks like it’s already doing that for you, but without the check to see if the currency has a smaller denomination.
So you’ll need to do that yourself, and then divide by 100 when defining the price if there is no denomination smaller than the one you’re working the price out in (e.g. JP¥).
Thanks guys. So I got the idea to format the formula I have in the custom state to add 2 decimals and convert it to a number as in the pic.
I am using the value stored in that custom state in the picture in the stripejs plugin for payments.
I have to mention that custom state field type was set as number.
However, when I do a test transaction, 36 JPY is not 36.00 JPY but 3,600 JPY
DIviding it by /100 works for JPY. However, the formula in the custom state will be in place for all currencies, and when I do a payment in euros, based on the same state, it says it’s too small, as in the pic below. So for example a payment of 35 euros, will arrive in Stripe as €0.35 because it’s been dividing by 100.
I still believe the best idea is to add two decimals after the “.” on the final price, but I’m missing something.
It should only be divided by 100 when the currency has a decimal demonisation smaller that the one you’re using for defining the price.
So that’s what you need to do.
I still believe the best idea is to add two decimals after the “.” on the final price, but I’m missing something.
What does that achieve?
I also found the below on the Stripe payment documentation. I find it hard to understand and fix it:
Indeed… the Stripe docs state exactly what I’ve already been saying…
The “fix” is as I’ve already said.
If the currency has decimals then multiply it by 100 (or, in your case, divide it by 100, as the plugin is already multiplying it).
If it doesn’t then don’t.
Depending on how many currencies you’re working with you could either user an Option set or a Datatype for this, to store the currencies (with an attribute/field for ‘multiplier’), and then just multiply the amount by that (i.e. either 1 or 100) when making a charge.