Invoice Calculator

Computes invoice line totals, per-line and document discounts, configurable tax and the grand total using exact decimal arithmetic with a stated rounding policy.

POST /v1/business/invoice-calculate $0.01 per call

Specification

Endpoint
POST /v1/business/invoice-calculate
Price
$0.01 per call · tier standard_data
Payment
x402 on X Layer (chain 196) · settled in USDG or USDT0 · scheme exact
Data source
Deterministic decimal arithmetic on caller-supplied input
Timeout
15 seconds
Max request
256 KB
Version
1.0.0

Calling it

The first call returns a 402 with the payment challenge. Retry with a signed authorisation in the X-PAYMENT header — see the payment guide for the exact shape.

curl -i -X POST "https://api.dana-edu.pp.ua/v1/business/invoice-calculate" \
  -H "content-type: application/json" \
  -d '{ ... }'

Response

Real output, captured by running this endpoint at build time — not written by hand. Volatile fields such as timestamps are elided. Captured 2026-07-30.

{
  "currency": "IQD",
  "lines": [
    {
      "index": 0,
      "description": "API integration",
      "quantity": "10",
      "unit_price": "150000",
      "gross": "1500000.00",
      "discount": "0.00",
      "net": "1500000.00",
      "tax_rate_percent": "15.00",
      "tax_base": "1500000.00",
      "tax": "225000.00",
      "total": "1725000.00",
      "tax_exempt": false
    },
    {
      "index": 1,
      "description": "Support",
      "quantity": "1",
      "unit_price": "500000",
      "gross": "500000.00",
      "discount": "50000.00",
      "net": "450000.00",
      "tax_rate_percent": "15.00",
      "tax_base": "450000.00",
      "tax": "67500.00",
      "total": "517500.00",
      "tax_exempt": false
    }
  ],
  "totals": {
    "gross": "2000000.00",
    "line_discounts": "50000.00",
    "subtotal_after_line_discounts": "1950000.00",
    "document_discount": "97500.00",
    "exempt_base": "0.00",
    "taxable_base": "1852500.00",
    "tax": "277875.00",
    "shipping": "25000.00",
    "grand_total": "2155375.00"
  },
  "tax": {
    "document_rate_percent": "15",
    "inclusive": false,
    "note": "Tax was added on top of net amounts."
  },
  "rounding": {
    "mode": "half_up",
    "decimal_places": 2,
    "applied": "once per stated total, on exact decimal intermediates"
  },
  "line_count": 2
}

Every response is wrapped in the same envelope: data plus warnings, sources, confidence, informational_only and a measured processing_ms. See the envelope reference.

Related endpoints