iotoms Docs

Validate transaction totals

POST
/api/v1/transaction/transactions/validate

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

  1. Send the totals you plan to submit and the sale's line items (item code, quantity, unit price, line discount and line tax).
  2. Optionally include cartId to check that the cart exists on the server.
  3. Compare submitted with expected and read discrepancies; nothing is saved, so fix the totals and call Create a transaction from a cart again.

Authorization

BearerAuth
headerAuthorizationBearer <JWT>

Header Parameters

Request Body

application/json
  1. 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*number

Required. The subtotal you intend to submit, in the merchant's currency.

taxTotal*number

Required. The tax total you intend to submit, in the merchant's currency.

discountTotal*number

Required. The discount total you intend to submit, in the merchant's currency.

grandTotal*number

Required. 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.

Formatint64
taxTotalCents?|

Optional tax total in hundredths of the currency unit (1050 = 10.50); when sent, compared exactly.

Formatint64
discountTotalCents?|

Optional discount total in hundredths of the currency unit (1050 = 10.50); when sent, compared exactly.

Formatint64
grandTotalCents?|

Optional grand total in hundredths of the currency unit (1050 = 10.50); when sent, compared exactly.

Formatint64

Response Body

OK

*/*
  1. response
status*string

Outcome of the call: SUCCESS when the request was handled, ERROR otherwise.

message*string

Short human-readable message describing the outcome, e.g. which record was fetched or saved.

data?

The comparison of submitted and expected totals.

Example Request
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    }  ]}'
Example Response
{  "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  }}