Closed ydax closed 1 year ago
Hey @ydax based on the API/endpoint and the timestamp in your error I was able to find your errored request, which you can view in your developer dashboard here: https://dashboard.stripe.com/test/logs/req_H7H7da2LpL53WR
As you can see, you're sending the invalid parameter value unit_amount: "7840.000000000001",
This kind of floating point precision calculation error is a known quirk of javascript and you'll need to ensure you round decimal calculation results in your code, eg using Math.round(78.4*100)
or similar.
@brendanm-stripe Wow that's far out. Thanks for the heads up with the weird Javascript problem.
What happened?
I'm using this library in combination with Firebase Cloud Functions. I'm passing the following integer to the
stripe.prices.create
API:7840
This integer is tabulated by multiplying the amount,
78.4
times 100 in my cloud function.When I try to create this price, the API call errors out and I get the following error message:
You'll note this in the error:
Invalid integer: 7840.000000000001
For some reason, on the Stripe side of this API call, the integer of 7840 is being converted to this strange, long integer an causing the API to error out.
Environment
No response
Reproduction
No response