Validate transaction totals
Recomputes the subtotal, discount, tax and grand total the server expects for the submitted line items, without saving anything. Safe to call repeatedly; useful for diagnosing a sale that was rejected for a totals mismatch.
How to use it
- Send the totals you plan to submit and the sale's line items (item code, quantity, unit price, line discount and line tax).
- Optionally include cartId to check that the cart exists on the server.
- Compare submitted with expected and read discrepancies; nothing is saved, so fix the totals and call Create a transaction from a cart again.
BearerAuthAuthorizationBearer <JWT>application/json- body
cartId?|Optional cart id; the response tells you whether that cart exists on the server.
clientTransactionId?|Optional device id of the sale being checked, for your own reference.
subtotal*numberRequired. The subtotal you intend to submit, in the merchant's currency.
taxTotal*numberRequired. The tax total you intend to submit, in the merchant's currency.
discountTotal*numberRequired. The discount total you intend to submit, in the merchant's currency.
grandTotal*numberRequired. The grand total you intend to submit, in the merchant's currency.
items*array<>The sale's line items. Expected totals are computed from these.
subtotalCents?|Optional subtotal in hundredths of the currency unit (1050 = 10.50); when sent, compared exactly.
int64taxTotalCents?|Optional tax total in hundredths of the currency unit (1050 = 10.50); when sent, compared exactly.
int64discountTotalCents?|Optional discount total in hundredths of the currency unit (1050 = 10.50); when sent, compared exactly.
int64grandTotalCents?|Optional grand total in hundredths of the currency unit (1050 = 10.50); when sent, compared exactly.
int64OK
*/*- response
status*stringOutcome of the call: SUCCESS when the request was handled, ERROR otherwise.
message*stringShort human-readable message describing the outcome, e.g. which record was fetched or saved.
data?The comparison of submitted and expected totals.
curl -X POST 'https://beta.iotoms.com/api/v1/transaction/transactions/validate' \ -H 'Content-Type: application/json' \ -d '{ "subtotal": 0, "taxTotal": 0, "discountTotal": 0, "grandTotal": 0, "items": [ { "itemId": "string", "quantity": 0, "unitPrice": 0, "discountAmount": 0, "taxAmount": 0 } ]}'{ "status": "string", "message": "string", "data": { "matches": true, "submitted": { "subtotal": 0, "taxTotal": 0, "discountTotal": 0, "grandTotal": 0, "subtotalCents": 0, "taxTotalCents": 0, "discountTotalCents": 0, "grandTotalCents": 0 }, "expected": { "subtotal": 0, "taxTotal": 0, "discountTotal": 0, "grandTotal": 0, "subtotalCents": 0, "taxTotalCents": 0, "discountTotalCents": 0, "grandTotalCents": 0 }, "discrepancies": [ "string" ], "cartFoundOnServer": true }}