A checkout can calculate VAT in integer paisa and still disagree with the invoice because the line-rounding policy differs from the basket-rounding policy. Compliance also requires evidence of what the customer actually accepted, not simply a checked box.
One thousand synthetic baskets reveal a rounding disagreement
We generated 1,000 baskets of three to six line amounts between 1 and 200 paisa and compared two illustrative 13% arithmetic policies: round each line's tax then sum, or sum the taxable amounts then round. The 13% rate is an experiment parameter, not a determination that the rate applies to every product or merchant.
| Result | Value |
|---|---|
| Baskets | 1000 |
| Different tax totals | 580 |
| Maximum absolute difference | 2 paisa |
The policies disagree in 580 deliberately tiny baskets. This fixture highlights a boundary condition, not the frequency of rounding discrepancies in real Nepal retail sales. The merchant's approved tax and rounding policy must decide which calculation is authoritative. A line-allocation algorithm should reconcile the remainder to the legally applicable total.
Keep every component in exact minor units
// Worked illustration, not statutory tax advice.
const linePaisa = [101, 101, 101];
const lineRounded = linePaisa.reduce(
(sum, n) => sum + Math.round(n * 13 / 100), 0
);
const basketRounded = Math.round(
linePaisa.reduce((a, b) => a + b, 0) * 13 / 100
);
Store amounts, rates, tax basis, rounding policy and quote revision. Use integer arithmetic with safe bounds or an exact decimal representation in production; validate the final charge, discount, tax and delivery amount before confirming an order. Nepal Tax and Concurrent checkout describe related calculation and stock boundaries.
What did the customer actually agree to?
Nepal's Electronic Commerce Act 2081 is the authoritative legal text. Preserve the merchant identity, product information, price, delivery and return terms actually displayed to the buyer. Version these disclosures and bind the accepted version to the order. Our dedicated Act 2081 guide covers legal obligations and primary references; review the current law and directives with a qualified professional.
Payment evidence cannot be a redirect query parameter
A successful browser return from a gateway is a user experience event. Verify a provider transaction using the authorized server flow, check amount, currency, tenant and reference, and transition the order idempotently. Record and reconcile pending, completed and reversed events. Webhook replay study explains why repeating a confirmed payment event must not generate a second financial record.
Build the complaint and invoice history from real events
A complaint needs a reference, acknowledgement, resolution status, responsible actor and evidence, with applicable deadlines configured from the current rules. Issuance and cancellation records should preserve the actual financial history. Invoice allocation study distinguishes unique and gapless references. IRD governs relevant tax requirements; Commerce Nepal SDK supplies implementation contracts, not certification. The rounding model provides a reproducible reason to test the complete quote-to-invoice flow.
Method and reproducibility: Controlled synthetic model. See Code Deb's recorded experiment results and reproduction script in the repository. Figures are reproducible from declared inputs, not undisclosed client outcomes. The cited external material is independent of Code Deb's experiment.