fiskalizimi-utils
v0.1.0
Published
Utilities for Albanian fiscalization (Law 87/2019): NIPT/NUIS validation, TVSH (VAT) math, and fiscal invoice totals with per-rate VAT breakdown. Zero dependencies.
Maintainers
Readme
fiskalizimi-utils
Zero-dependency TypeScript utilities for Albanian fiscalization (Law 87/2019 "On the invoice and the circulation monitoring system"): NIPT/NUIS validation, TVSH (VAT) math, and fiscal invoice totals with the per-rate VAT breakdown every fiscalized invoice must report.
Built and maintained by Square Software, a software company in Tirana that ships fiscalization integrations for POS, ERP and e-commerce systems. These are the same pure functions that power our free online tools:
Install
npm install fiskalizimi-utils
# or straight from GitHub:
npm install github:square-al/fiskalizimi-utilsUsage
Validate a NIPT / NUIS
import { validateNipt } from 'fiskalizimi-utils'
const res = validateNipt(' m5 1418-039h ') // separators + case are normalized
res.valid // true
res.normalized // 'M51418039H'
res.parts // { prefix: 'M', digits: '51418039', checkLetter: 'H' }
validateNipt('M5141803OH')
// { valid: false, issues: ['digits-not-numeric'], likelyTypo: true } ← O vs 0Format-level validation only (letter A–M + 8 digits + control letter). A well-formed NIPT is not necessarily registered — check existence in the official registry (QKB), e.g. https://opencorporates.al/sq/nipt/m51418039h.
TVSH (VAT) math
import { addVat, extractVat, ALBANIA_VAT, KOSOVO_VAT } from 'fiskalizimi-utils'
addVat(1000, ALBANIA_VAT.standard) // { net: 1000, vat: 200, gross: 1200, rate: 0.2 }
extractVat(1180, KOSOVO_VAT.standard) // net 1000, vat 180 — Kosovo 18%Fiscal invoice totals
import { invoiceTotals } from 'fiskalizimi-utils'
const t = invoiceTotals([
{ description: 'Service A', quantity: 2, unitPrice: 500, vatRate: 0.2 },
{ description: 'Book', quantity: 1, unitPrice: 800, vatRate: 0.06, discountRate: 0.1 },
])
t.subtotal // net total
t.totalVat // VAT total
t.vatByRate // [{ rate: 0.2, base: 1000, vat: 200 }, { rate: 0.06, base: 720, vat: 43.2 }]vatByRate is the per-rate base/VAT table a fiscalized invoice reports.
Shqip
Mjete TypeScript pa varësi për fiskalizimin shqiptar: verifikim i formatit të NIPT/NUIS, llogaritje TVSH-je (shto/hiq nga një vlerë) dhe totalet e faturës me TVSH-në e ndarë sipas normës — ashtu siç e raporton një faturë e fiskalizuar. I njëjti kod që fuqizon llogaritësit tanë falas. Për integrime fiskalizimi në sistemet tuaja, shihni square.al.
Notes
- Rates and rules change; confirm current TVSH rates and fiscalization requirements with the tax authority before invoicing.
- No network calls, no dependencies, side-effect free — safe for browser and Node.
License
MIT © Square Software SHPK
