Target: @codedeb/nepal-tax@0.1.0 — implemented source candidate, not published on npm. TypeScript/ESM SDK for billing systems, retail POS, ERP, accounting and e-commerce in Nepal.
A deterministic tax calculation and draft-data toolkit, not an IRD-certified invoicing system, tax adviser, filing service or source of live registration status.
Production implementation walkthrough
- Normalize the seller's nine-digit PAN with
validateNepalPan. This checks syntax only; validate active VAT registration through an authorized, independently verified IRD adapter. - Select an explicit effective-dated tax rule for each line. Default supports the general 13% VAT rate; zero-rated, exempt or special reduced categories require reviewed rules. The SDK does not classify products automatically.
- Calculate in integer NPR paisa with
calculateNepalTax; choose inclusive/exclusive pricing per line, quantities and any discounts. - Allocate an invoice reference atomically through your accounting database, then call
createNepalTaxInvoiceDraft; verify Schedule 5/5A, business identifiers, buyer fields, authorized signatures, retention and the legally mandated issue format independently. - Post the approved real invoice through your application. Use
generateNepalTaxReportto aggregate only posted records within one Nepali fiscal year; reconcile and file in your own approved workflow.
Quickstart
import {
calculateNepalTax,createNepalTaxInvoiceDraft,
nepalFiscalYear,validateNepalPan,
} from '@codedeb/nepal-tax';
const day='2026-11-25';
const lines=[{
id:'1',description:'Achar',quantity:2,unitPricePaisa:10000,
vatBasis:'exclusive' as const,ruleCode:'standard',
}];
const quote=calculateNepalTax({dateAD:day,lines});
console.log(quote.netPaisa,quote.vatPaisa,quote.totalPaisa);
console.log(nepalFiscalYear(day).label); // 2083/84
console.log(validateNepalPan('१२३४५६७८९').verified); // false
const draft=createNepalTaxInvoiceDraft({
invoiceNumber:'INV-2083-001',dateAD:day,
seller:{legalName:'Example Pvt Ltd',address:'Kathmandu',pan:'123456789',vatRegistered:true},
lines,
});
console.log(draft.status); // draft
API reference
| Export | Purpose |
|---|---|
validateNepalPan | Normalize ASCII/Devanagari digits and structurally check 9 digits; verified:false. |
verifyNepalPan(input,adapter) | Call an explicitly supplied authorized IRD lookup adapter and validate returned evidence. |
NEPAL_VAT_RULES_2083 | Reviewed baseline standard VAT policy, with rule identifier and source URL. |
resolveVatRule(policy,code,dateAD) | Resolve exactly one valid effective-dated VAT treatment. |
calculateNepalTax({dateAD,lines,rules?}) | Integer-paisa discounted inclusive/exclusive tax and totals. |
nepalFiscalYear(dateAD) | Shrawan–Ashadh BS fiscal label and AD start/end boundaries. |
createNepalTaxInvoiceDraft | Structured draft-only tax invoice metadata. |
generateNepalTaxReport | Sum caller-posted NPR invoices with seller, fiscal-year and duplicate checks; notFiled:true. |
Configurable tax policy
NepalTaxRules contains id, reviewedOn and explicit rules with code, treatment, basisPoints, effectiveFromAD, optional effectiveToAD and a mandatory sourceUrl. treatment is taxable, zero-rated or exempt. A rule must match the invoice date uniquely. The SDK rejects unknown/overlapping classifications rather than guessing.
Calculations use whole paisa and BigInt intermediate values, with deterministic half-up rounding. quantityMilli supports fractional quantities measured in thousandths.
Legal sources, update history and exclusions
- 2026-11-25: Initial source candidate with general Nepal VAT 13% policy and source-bound effective dates, review needed for later Finance Act amendments, category exceptions and IRD notices.
- Official legislation: IRD VAT Act and schedules, IRD Finance Act 2083 and IRD VAT Rules. Official PAN Search is the registration lookup reference. The default 13% VAT is a general rate, not automatic product tax classification. No unauthorized scraping is provided.
- Annual fiscal year runs Shrawan to Ashadh, using the existing Code Deb Nepali Calendar engine. Out-of-table dates throw.
- The SDK does not issue approved receipts, allocate database sequences, sign invoices, reconcile to IRD, store customer records, implement CBMS or submit returns. An externally reviewed workflow is required.
Troubleshooting and testing
npm run test:nepal-sdks
npm run sdk:build
npm run sdk:pack:verify
npm view @codedeb/nepal-tax@0.1.0 version
PAN valid but unverified: 9-digit formatting alone is not registration. Unknown VAT code: supply a reviewed effective policy and choose a category. Inconsistent total: pass integer paisa, not floating-point NPR. Fiscal date outside coverage: use a supported calendar date. npm 404: no approved publication has occurred.
Licensing
The source manifest stays private and UNLICENSED. The reviewed standalone staging process applies Apache-2.0 to Code Deb-owned code after release approval; the Nepali Calendar dependency has preserved upstream notices. No registry publication or government certification is implied.