omise/omise-node

I have problem in usd currency about fraction of amout

Closed this issue · 4 comments

when I use currency usd sometime i found error

{location: 'https://www.omise.co/api-errors#invalid-charge',
code: 'invalid_charge',
message: 'amount must be an integer' }

this is amount error such as 257.12 (25712),267.10 (26710),25.77 (2577),123.66 (12366) and another amount are fraction unsuitable

but sometime is passed such as 250.20 (25020),78.25 (7825),156.75 (15675),144.50(14450)

How to fix it?
thanks

Could you post a sample of a request that caused this error?

How often does it happen?

 omise.charges.create({
                            'description': description,
                            'amount': 25013, //(250.13)
                            'currency': 'usd',
                            'capture': true,
                            'card': tokenId,
                            'metadata': metaData,
                            'return_uri': '.....'
                        }).then(resp => {.....})

this is code
and I observe if fraction unsuitable such as 15.12 ,1.79 5.73 7.10, those amount has problem
and if fraction suitable such as 13.20 ,14.25 ,17.50 ,88.75 ,Can passed
In usd currency can use every fraction?
In thb i does not found problem

//Edit 10 1 2018 8:27
I try to do this
parseInt(amount.toFixed(0))
it work but i will test every fraction
thank

I've not success at duplicating the symptom yet. Do those amount that caused the error all the time, or does it happen randomly?

We’re going to close this since there hasn’t been any activity on this issue for a while. If you think it's still relevant, please feel free to reopen it with more details and we’ll take another look.