Square connect 平方舍入误差(银行家舍入)

Square connect 平方舍入误差(银行家舍入),square-connect,square,Square Connect,Square,我从正方形得到一个错误,上面写着 {"errors": [{"code": "BAD_REQUEST","detail": "The total of the requested payments does not match the total of the sale order.","category": "INVALID_REQUEST_ERROR"}]} 该项目是3.00,税是9.5%,我们的应用程序费是3% 在我这边,我派人过去 3.00 + 0.29 (0.095 * 3.00 =

我从正方形得到一个错误,上面写着

{"errors": [{"code": "BAD_REQUEST","detail": "The total of the requested payments does not match the total of the sale order.","category": "INVALID_REQUEST_ERROR"}]}
该项目是3.00,税是9.5%,我们的应用程序费是3%

在我这边,我派人过去

3.00
+ 0.29 (0.095 * 3.00 = 28.5 rounded up)
+ 0.09
______
  3.38
我可以清楚地看到,这是我在请求中发送的金额,如果该项目的价格为2.99或3.01,则该金额有效。当Square响应create订单时,它返回0.28美元作为税额,这不是银行舍入。在这种情况下,我最好假设Square不会修正这个错误,我应该将税收四舍五入

来自订单端点的响应:

{"order": {"id": "gMTUBc5FrYvLzkoNv6xOYfkLtkUZY","location_id": "RE7KBN4EGW4KT","line_items": [{"uid": "Z3mT3QHmkk4SPCkbrSW5MB","catalog_object_id": "NN5CHF66YK6MUGXG3BNWF6X5","quantity": "1","name": "Steamer","variation_name": "Regular","base_price_money": {"amount": 300,"currency": "USD"},"taxes": [{"uid": "rQurMfiksaO3xTaMqWdb1C","catalog_object_id": "YSI7WUNXGGSJRQEQ4QEQYK5G","name": "Sales Tax","percentage": "9.5","type": "ADDITIVE","applied_money": {"amount": 28,"currency": "USD"},"scope": "LINE_ITEM"}],"gross_sales_money": {"amount": 300,"currency": "USD"},"total_tax_money": {"amount": 28,"currency": "USD"},"total_discount_money": {"amount": 0,"currency": "USD"},"total_money": {"amount": 328,"currency": "USD"},"variation_total_price_money": {"amount": 300,"currency": "USD"},"applied_taxes": [{"uid": "rQurMfiksaO3xTaMqWdb1C","tax_uid": "rQurMfiksaO3xTaMqWdb1C","applied_money": {"amount": 28,"currency": "USD"}}]}],"taxes": [{"uid": "rQurMfiksaO3xTaMqWdb1C","catalog_object_id": "YSI7WUNXGGSJRQEQ4QEQYK5G","name": "Sales Tax","percentage": "9.5","type": "ADDITIVE","applied_money": {"amount": 28,"currency": "USD"},"scope": "LINE_ITEM"}],"fulfillments": [{"uid": "jJtsXtwaWfjJBIpbe7wkk","type": "PICKUP","state": "PROPOSED","pickup_details": {"pickup_at": "2020-06-14T20:58:09.257Z","recipient": {"display_name": "Table: #1"}}}],"created_at": "2020-06-14T20:43:09.731Z","updated_at": "2020-06-14T20:43:09.731Z","state": "OPEN","version": 1,"total_tax_money": {"amount": 28,"currency": "USD"},"total_discount_money": {"amount": 0,"currency": "USD"},"total_tip_money": {"amount": 0,"currency": "USD"},"total_money": {"amount": 337,"currency": "USD"},"service_charges": [{"uid": "2lD47tU2idwjyOpydkfrtB","name": "Service Fee","amount_money": {"amount": 9,"currency": "USD"},"applied_money": {"amount": 9,"currency": "USD"},"calculation_phase": "SUBTOTAL_PHASE","taxable": false,"total_money": {"amount": 9,"currency": "USD"},"total_tax_money": {"amount": 0,"currency": "USD"}}],"total_service_charge_money": {"amount": 9,"currency": "USD"},"net_amounts": {"total_money": {"amount": 337,"currency": "USD"},"tax_money": {"amount": 28,"currency": "USD"},"discount_money": {"amount": 0,"currency": "USD"},"tip_money": {"amount": 0,"currency": "USD"},"service_charge_money": {"amount": 9,"currency": "USD"}},"source": {"name": "Table: #1"}}}

银行家四舍五入仅在两个数字之间的结束数字相等时适用(在本例中,
.05

在您的示例中:

3.00
+ 0.28 (0.095 * 3.00 = 0.285 which according to Banker's rounding, rounds to the closest even number, so this would be 0.28)
+ 0.09
_______
  3.37
在您的另一个示例(3.01)中:


非常感谢您澄清,您将四舍五入到最接近的偶数作为平局决胜!你救了我几个小时的头痛
3.01
+ 0.29 (0.095 * 3.01 = 0.28595 which would round to 0.286 and then use normal rounding, since it doesn't end in 5, to be 0.29)
+ 0.09
______
  3.39