我一直收到错误“请求内容格式错误:预期BigDecimal为JsNumber”

I am trying to do an API request based on json and one of the parameters i am supplying (10) should be an integer with 2 decimal places but what i have is a whole number. When i do the api call directly as "amount" => 10.00, it suceeds but when I hold the integer as $amount = $received_amount."00"; where $received_amount = 10; it throws an error as Received error response: The request content was malformed: Expected BigDecimal as JsNumber, but got "10.00"

I have tried most of the methods available changing a whole number by appending 2 decimal places at the end but none seems to work. Any work around?

Concatenation is a string construct. You can't concatenate integers or floats.

10 . '00' would give you a string of '1000'. I'm assuming what you meant was 10 . '.00'.

You can convert an integer to a float in various ways:

var_dump(10 + 0.00);
var_dump( (float) 10 );
var_dump( floatval(10) );

However, all of these will represent the float as 10 not 10.00 since that is how the float is supposed to be represented in accordance with IEEE754.

The string format is the only way you'll be able to represent 10.00. So this comes down to how you send it to Javascript which isn't represented in your question.