Check invoice arithmetic with decimal rounding
Catch invoice total mismatches before importing billing data into another system.
20 credits · USD $0.020
Input schema
{
"type": "object",
"properties": {
"items": {
"type": "array",
"minItems": 1,
"maxItems": 200,
"items": {
"type": "object",
"properties": {
"quantity": {
"oneOf": [
{
"type": "number",
"minimum": 0,
"maximum": 999999999999
},
{
"type": "string",
"pattern": "^\\d{1,12}(\\.\\d{1,6})?$"
}
]
},
"unit_price": {
"oneOf": [
{
"type": "number",
"minimum": 0,
"maximum": 999999999999
},
{
"type": "string",
"pattern": "^\\d{1,12}(\\.\\d{1,6})?$"
}
]
}
},
"required": [
"quantity",
"unit_price"
]
}
},
"total": {
"oneOf": [
{
"type": "number",
"minimum": 0,
"maximum": 999999999999
},
{
"type": "string",
"pattern": "^\\d{1,12}(\\.\\d{1,6})?$"
}
]
},
"tax": {
"oneOf": [
{
"type": "number",
"minimum": 0,
"maximum": 999999999999
},
{
"type": "string",
"pattern": "^\\d{1,12}(\\.\\d{1,6})?$"
}
]
},
"discount": {
"oneOf": [
{
"type": "number",
"minimum": 0,
"maximum": 999999999999
},
{
"type": "string",
"pattern": "^\\d{1,12}(\\.\\d{1,6})?$"
}
]
},
"currency": {
"enum": [
"USD",
"EUR",
"GBP",
"AUD",
"CAD",
"JPY",
"KWD"
]
}
},
"required": [
"items",
"total"
]
}Request
curl -X POST 'https://staging.callmint.dev/v1/invoice-validator' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Idempotency-Key: unique-request-001' \
-H 'Content-Type: application/json' \
-d '{"items":[{"quantity":2,"unit_price":"10.00"}],"tax":"2.00","total":"22.00","currency":"USD"}'Response result
{
"valid": true,
"currency": "USD",
"rounding": "half_up_per_line",
"line_totals": [
20
],
"subtotal": 20,
"expected_total": 22,
"provided_total": 22,
"difference": 0,
"note": "Arithmetic only. Tax calculation and jurisdiction rules not verified."
}Limitations
Arithmetic only, not tax-law validation. Up to 200 lines. Nonnegative fixed-point values only; quantities and unit prices have at most six decimals. Tax, discount and total use currency precision: JPY 0, KWD 3, others 2. Each line rounds half up before summing; discount is a fixed invoice amount. Prefer decimal strings. No scientific notation, unsafe totals or discount exceeding subtotal.
All enabled routes accept a JSON object of at most 60,000 UTF-8 bytes. String limits are also measured in UTF-8 bytes.