Converting Sales Order to Invoice via API; Problem with decimal places tax

Converting Sales Order to Invoice via API; Problem with decimal places tax

We are having problems converting a Sales Order to an Invoice via API Call. The cause of the issue is, that the Tax value in a Sales Order is sometimes calculated with up to 16 decimal places (e.g. 0.8730000000000001). The max decimal places allowed in an invoice for the Tax field is nine, so the following error occurs when converting the Sales Orders via API call (using https://www.zohoapis.com/crm/v8/Sales_Orders/ + salesOrderId + /actions/convert).

  1. "{"data":[{"code":"INVALID_DATA","details":{"maximum_length":16,"api_name":"Tax","json_path":"$.data[0].Tax",
    "maximum_decimal_place":9},
    "message":"invalid data","status":"error"}]}"

The problem does not occur when the Sales Order is converted manually.