I store price of an item as a Number. When Stripe charges the Test Card (4242 4242 4242 4242) it adds double zeros to the price. Instead of 25 it charges 2500. Any solutions?
EDIT:
So the Price is 25.
When user clicks PAY → Stripe Plugin’s prompt pops up to get the user’s card information.
This popup displays the Price. Instead of 25 it says $25.00. Which is normal. BUT in the backend it saves a PMT amount as 2500.
I tried to pass “Item Price/100” to Stripe. Unfortunately, in this case it displays, $0.25 in the popup.
Could it be that it charges the right amount, just stores the wrong way in the DB?
I’m pretty sure this is the case. Probably, Stripe returns the amount to be 25.00. But the Field type is Number so it ignores the “.”. Anyway post-success amount can be a text. I just need to display it in the Transactions page…
EDIT2:
Changing Field Type to Text didn’t help whatsoever.
Stripe (and probably most payment processors) always use integers for payment values, which means using cents rather than dollars (or pence instead of pounds, or the equivalent for other currencies).
So $25 dollars is 2500 cents.
If you want to save it in your database in dollars you can divide it by 100 on the back end.
Thanks a lot for the help here! I got your point but it’s still very confusing and not sure the payment would be correct for other currencies? In the pic below, the first payment should have been 36 JPY but instead of 36.00 JPY is 3,600 JPY.
Second one should have been 6.00 JPY but it’s 600 JPY and 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
Thanks Adam. I am not multiplyng it. I am literally sending to stripe the amount of 6 but it charges in stripe 600 JPY(see pic) not 6.00 . That’s the problem. I send 6 but it charges 600.
As I said in the other post, if the plugin you’re using is multiplying all values by 100 (which it appears to be), then you just need to divide the value by 100 when the currency doesn’t have a decimal denomination.
Thanks Adam. But the problem is I have multiple currency and most I DON T have to divide but for some i have to. Yet, I want to use only one formula (dynamic) field for the payment (currency). Is there a smart way to do it?
In that case just have a ‘divide_by’ field wherever it is you store your currency data (a datatype, or option set), with a default value of 1, but set to 100 for those currencies that need dividing.
Then you can just always use price / currency's divide_by to set the value for the plugin.
Or you could do it dynamically, using a boolean with :format as number (but the first option gives you more control).