Hi,
We have experienced an issue where when creating a checkout via Terminal API, at times, passed amount + tip throws an error from Square end.
Example of a Successful Order:
Request:
2024-10-29 15:40:09 - SQUARE-TERMINAL API >>>>>>>>>>
URI : https://connect.squareup.com/v2/terminals/checkouts
Method : POST
Headers : {Accept=[application/json], Content-Type=[application/json], Authorization=[Bearer REDACTED], Square-Version=[2024-01-18], Content-Length=[318]}
Request body: {"idempotency_key":"SQT-a22335c5a39c99-1730216409551","checkout":{"amount_money":{"amount":2273,"currency":"USD"},"tip_money":{"amount":429,"currency":"USD"},"order_id":"8BSvJuip13cH6zsLCx9UJMUNrvAZY","device_options":{"device_id":"846CS108A2000949","tip_settings":{"allow_tipping":false},"skip_receipt_screen":true}}}
Response:
2024-10-29 15:40:09 - SQUARE-TERMINAL API API <<<<<<<<<< Status = [200] path = [https://connect.squareup.com/v2/terminals/checkouts]
Status code : 200
Status text : OK
Headers : {Date=[Tue, 29 Oct 2024 15:40:09 GMT], Content-Type=[application/json], Connection=[keep-alive], CF-Ray=[8da4432fb8af05f9-IAD], CF-Cache-Status=[DYNAMIC], Strict-Transport-Security=[max-age=631152000; includeSubDomains; preload], Vary=[Accept-Encoding], frame-options=[DENY], square-version=[2024-01-18], squareup--connect--v2--common--versionmetadata-bin=[CgoyMDI0LTAxLTE4], x-content-type-options=[nosniff], x-envoy-decorator-operation=[/v2/terminals/**], x-frame-options=[DENY], x-sq-dc=[aws], x-sq-region=[us-east-1], x-xss-protection=[1; mode=block], Server=[cloudflare]}
Response body: {"checkout": {"id": "widl02zjRMWqO","amount_money": {"amount": 2273,"currency": "USD"},"device_options": {"device_id": "846CS108A2000949","collect_signature": false,"tip_settings": {"allow_tipping": false},"skip_receipt_screen": true,"show_itemized_cart": true},"status": "PENDING","created_at": "2024-10-29T15:40:09.817Z","updated_at": "2024-10-29T15:40:09.817Z","app_id": "sq0idp-TpHen_F96miOUr07zsUKTw","order_id": "8BSvJuip13cH6zsLCx9UJMUNrvAZY","location_id": "LVTX8NQD7J2DW","payment_type": "CARD_PRESENT","payment_options": {"autocomplete": true},"tip_money": {"amount": 429,"currency": "USD"}}}
A Failed Transaction:
Request
2024-10-02 14:00:37 - SQUARE-TERMINAL API >>>>>>>>>>
URI : https://connect.squareup.com/v2/terminals/checkouts
Method : POST
Headers : {Accept=[application/json], Content-Type=[application/json], Authorization=[Bearer REDACTED], Square-Version=[2024-01-18], Content-Length=[314]}
Request body: {"idempotency_key":"SQT-a295c4eckc7e-1727877637317","checkout":{"amount_money":{"amount":472,"currency":"USD"},"tip_money":{"amount":22,"currency":"USD"},"order_id":"87tYCMKdoSqogsDQJeiiyubzeELZY","device_options":{"device_id":"846CS108A2000949","tip_settings":{"allow_tipping":false},"skip_receipt_screen":true}}}
Response:
2024-10-02 14:00:37 - SQUARE-TERMINAL API API <<<<<<<<<< Status = [400] path = [https://connect.squareup.com/v2/terminals/checkouts]
Status code : 400
Status text : Bad Request
Headers : {Date=[Wed, 02 Oct 2024 14:00:37 GMT], Content-Type=[application/json], Content-Length=[180], Connection=[keep-alive], CF-Ray=[8cc538414801c980-IAD], CF-Cache-Status=[DYNAMIC], Strict-Transport-Security=[max-age=631152000; includeSubDomains; preload], frame-options=[DENY], square-version=[2024-01-18], squareup--connect--v2--common--versionmetadata-bin=[CgoyMDI0LTAxLTE4], x-content-type-options=[nosniff], x-envoy-decorator-operation=[/v2/terminals/**], x-frame-options=[DENY], x-sq-dc=[aws], x-sq-region=[us-east-1], x-xss-protection=[1; mode=block], Vary=[Accept-Encoding], Server=[cloudflare]}
Response body: {"errors": [{"code": "BAD_REQUEST","detail": "The checkout's total amount=472 does not match the order's total amount=494","field": "amount","category": "INVALID_REQUEST_ERROR"}]}
This has occurred to the same merchant. Our order placing and payment flow is the same for both instances.
Why has this happened?