Sellvik / developers
Concepts

Money and numbers

Why every money field is a string, and how to handle it.

Sellvik returns every monetary value as a decimal string, not a number. The reason is JavaScript: a price of 199.00 becomes 199 after a JSON.parse round-trip, and a price of 0.1 + 0.2 becomes 0.30000000000000004 after any client-side arithmetic.

What you'll see

{
  "price": "1490.00",
  "comparePrice": "1990.00",
  "subtotal": "4470.00",
  "total": "4490.00"
}
  • Always a string.
  • Always exactly two decimal places for BDT.
  • Never null for required fields (compare-price etc. may be null when not set).

What to do client-side

For display

const formatted = new Intl.NumberFormat("en-BD", {
  style: "currency",
  currency: "BDT",
}).format(Number(price))
// → "৳1,490.00"

The Number(price) is safe for display because:

  • We guarantee ≤ 12 significant digits per field.
  • Display does not need exact arithmetic.

For arithmetic

Use a decimal library:

import Decimal from "decimal.js"

const subtotal = new Decimal("1490.00")
const tax = subtotal.times("0.05")
const total = subtotal.plus(tax)
console.log(total.toFixed(2)) // "1564.50"

Avoid Number(price) * 1.05 in any code that ends up in a write-back to Sellvik. Floating-point drift across many rows will eventually show up as a 1-paisa mismatch in a reconciliation report.

For writes

When sending money to Sellvik (e.g. creating a product with a price), send a string in the same shape:

{
  "name": "Kurti",
  "price": "1490.00",
  "comparePrice": "1990.00"
}

Numbers are rejected with 400 invalid_body.

Currency

v1 is BDT-only. The shop's currency is implicit; there is no currency field on responses. Multi-currency support is on the post-v2 roadmap.

If you operate in multiple currencies today, do FX conversion on your side and write BDT into Sellvik.

Quantities and counts

Integers (stock, quantity, productCount) are plain JSON numbers. They fit safely in Number.MAX_SAFE_INTEGER (we cap stock at a few million) and have no precision concerns.

Dates

All timestamps are ISO 8601 UTC: 2026-05-27T13:45:00.000Z. Parse with new Date(s). We never return local-time strings or epoch numbers.

On this page