<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hari Korapati</title>
    <description>The latest articles on DEV Community by Hari Korapati (@hari_korapati_1ecddda0872).</description>
    <link>https://dev.to/hari_korapati_1ecddda0872</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1848176%2F311763a6-e00a-45da-929a-74970dc6e57a.png</url>
      <title>DEV Community: Hari Korapati</title>
      <link>https://dev.to/hari_korapati_1ecddda0872</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hari_korapati_1ecddda0872"/>
    <language>en</language>
    <item>
      <title>The one-paisa bugs in GST billing, and six open-source packages that fix them</title>
      <dc:creator>Hari Korapati</dc:creator>
      <pubDate>Fri, 27 Nov 2026 03:58:50 +0000</pubDate>
      <link>https://dev.to/hari_korapati_1ecddda0872/the-one-paisa-bugs-in-gst-billing-and-six-open-source-packages-that-fix-them-2fd5</link>
      <guid>https://dev.to/hari_korapati_1ecddda0872/the-one-paisa-bugs-in-gst-billing-and-six-open-source-packages-that-fix-them-2fd5</guid>
      <description>&lt;p&gt;Half of ₹1,053.35 is ₹526.675, which should round to ₹526.68. Try it in JavaScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1053.35&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;   &lt;span class="c1"&gt;// 526.67&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;1053.35 * 0.5 * 100&lt;/code&gt; is &lt;code&gt;52667.49999999999&lt;/code&gt;, so the half paisa rounds down.&lt;/p&gt;

&lt;p&gt;We've been building &lt;a href="https://merainvoices.com" rel="noopener noreferrer"&gt;Mera Invoices&lt;/a&gt;, GST billing software for small Indian businesses. Many of the bugs we've fixed look like this one: a single paisa, easy to miss in testing and hard to explain to an accountant. So we've pulled the parts that aren't specific to the app into six small packages. They're MIT-licensed, have no dependencies and ship with TypeScript types.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fud49lq9zrs15mu17ojeq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fud49lq9zrs15mu17ojeq.png" alt="A sample GST tax invoice with its parts labelled by the package that produces them: invoice number and amount in words (inr), the buyer's GSTIN check (gstin), totals with CGST and SGST split to the paisa (gst-invoice), and the UPI payment QR code (upi)." width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Package&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;@merainvoices/gstin&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Validates GSTINs with the check digit, reads the state and PAN, decides CGST + SGST or IGST&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;@merainvoices/gst-invoice&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Invoice maths: lines, CGST/SGST/IGST, freight, discounts before or after GST, round-off&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;@merainvoices/inr&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;₹1,23,456.00 formatting, amounts in words, the April–March financial year, invoice numbers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;@merainvoices/upi&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Builds and reads &lt;code&gt;upi://pay&lt;/code&gt; links for Pay buttons and QR codes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;@merainvoices/gstr2b&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reads the GSTR-2B JSON from the GST portal and matches it against your purchase bills&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;@merainvoices/bank-statement&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reads Indian bank statement exports and matches them against your records&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  A whole invoice in 25 lines
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;validateGSTIN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;isInterStateSupply&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@merainvoices/gstin'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;computeInvoice&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@merainvoices/gst-invoice'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;formatInvoiceNumber&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amountInWords&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;formatINR&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@merainvoices/inr'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;buildUpiLink&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@merainvoices/upi'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;buyer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;validateGSTIN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'27aakfp5678l1ze'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;// { valid: true, gstin: '27AAKFP5678L1ZE', … }&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;interState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;isInterStateSupply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;seller&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;gstin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'27ABCFS1234K1Z7'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;buyer&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;// false → CGST + SGST&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;formatInvoiceNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'INV/{yyyy-yy}/{n}'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;seq&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'2026-11-24'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;// 'INV/2026-27/007'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;invoice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;computeInvoice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1250&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gstRate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1890&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;discountPercent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gstRate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;850&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gstRate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;interState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;freight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gstRate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;roundOff&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;formatINR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;invoice&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;       &lt;span class="c1"&gt;// '₹11,494.00'  (CGST 876.69 + SGST 876.69, round-off −0.38)&lt;/span&gt;
&lt;span class="nf"&gt;amountInWords&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;invoice&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;// 'Indian Rupees Eleven Thousand Four Hundred Ninety Four Only'&lt;/span&gt;
&lt;span class="nf"&gt;buildUpiLink&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;vpa&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'shop@okaxis'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Shree Ganesh Electricals'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;invoice&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// 'upi://pay?pa=shop%40okaxis&amp;amp;pn=Shree%20Ganesh%20Electricals&amp;amp;am=11494.00&amp;amp;tr=INV%2F2026-27%2F007&amp;amp;cu=INR'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The GSTINs and the UPI ID are made-up samples. That's the invoice in the picture above.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two more one-paisa bugs
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;CGST and SGST that don't add up.&lt;/strong&gt; ₹100.10 at 5% GST is ₹5.01. Halve it and round each side, and you get ₹2.51 + ₹2.51 = ₹5.02. &lt;code&gt;gst-invoice&lt;/code&gt; gives CGST the odd paisa: ₹2.51 + ₹2.50.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An invoice discount that doesn't split evenly.&lt;/strong&gt; ₹50 off a three-line invoice, before GST, has to be shared across the lines. The shares come out as ₹16.67, ₹16.67 and ₹16.66, so the lines still add up to the invoice exactly. GST is then worked out again on each line.&lt;/p&gt;

&lt;p&gt;The package does all of its maths in whole paise. The tests check three rules on 500 random invoices: the lines add up to the totals, CGST + SGST + IGST equals the tax, and taxable + tax, less any after-GST discount, plus round-off, equals the total.&lt;/p&gt;

&lt;h2&gt;
  
  
  Things that look simple
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A GSTIN regex isn't enough.&lt;/strong&gt; The 15th character is a check digit. &lt;code&gt;validateGSTIN('27AAPFU0939F1ZW')&lt;/code&gt; fails with &lt;code&gt;code: 'CHECKSUM'&lt;/code&gt;, because the last character should be V. The &lt;code&gt;code&lt;/code&gt; is stable, so you can show your own message in Hindi or any other language.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Invoice numbers have a length limit.&lt;/strong&gt; Rule 46(b) of the CGST Rules allows up to 16 characters: letters, digits, hyphen and slash. &lt;code&gt;INV/2025-26/10000&lt;/code&gt; is 17, and &lt;code&gt;checkInvoiceNumber&lt;/code&gt; tells you before your 10,000th invoice does.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Servers run in UTC.&lt;/strong&gt; At 01:30 IST on 1 April it's still 31 March in UTC, so a naive check puts that invoice in the old financial year. &lt;code&gt;financialYear&lt;/code&gt; reads dates in India time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UPI apps are picky.&lt;/strong&gt; Some Android UPI apps don't decode &lt;code&gt;+&lt;/code&gt; as a space, so &lt;code&gt;buildUpiLink&lt;/code&gt; uses &lt;code&gt;%20&lt;/code&gt;. It always adds &lt;code&gt;cu=INR&lt;/code&gt;, which a few older apps need.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  GSTR-2B and bank statements
&lt;/h2&gt;

&lt;p&gt;These are two jobs accountants still do by hand every month.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foft45gyr087odzjdmcht.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foft45gyr087odzjdmcht.png" alt="Five purchase bills matched against a GSTR-2B download: one matched, one where the GST differs, one probably the same under a different number, one only on the portal and one only in the books, with its ITC at risk." width="799" height="512"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;parseGstr2b&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reconcile&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@merainvoices/gstr2b'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;reconcile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;parseGstr2b&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fileText&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;purchases&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;onlyBooks&lt;/span&gt;          &lt;span class="c1"&gt;// bills your suppliers haven't reported yet: that ITC is at risk&lt;/span&gt;
&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;probable&lt;/span&gt;           &lt;span class="c1"&gt;// 'INV-001' in your books vs 'INV/1' on the portal&lt;/span&gt;
&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;summary&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;atRiskTax&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvs9w5e6xe6ao0c8rjj06.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvs9w5e6xe6ao0c8rjj06.png" alt="An HDFC-style bank statement matched against receipt and payment entries: four pairs, a bank charge not in the books, an uncleared cheque not on the statement yet, and a running-balance check that passes." width="800" height="475"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;readStatement&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;matchTransactions&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@merainvoices/bank-statement'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;transactions&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;readStatement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;csvText&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;// finds the table, reads day-first dates and Cr/Dr&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;matches&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;unmatchedTransactions&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;matchTransactions&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;transactions&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;readStatement&lt;/code&gt; reads separate debit and credit columns (HDFC-style), one amount column with a Dr/Cr column (SBI-style), and amounts like &lt;code&gt;1,23,456.78 Cr&lt;/code&gt;. It rejects impossible dates like 31/02/2026 instead of rolling them over.&lt;/p&gt;

&lt;h2&gt;
  
  
  What they don't do
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;They don't decide which GST rate or treatment applies. That's for the business and its chartered accountant.&lt;/li&gt;
&lt;li&gt;They don't check whether a GSTIN is registered or active. Search it on the GST portal for that.&lt;/li&gt;
&lt;li&gt;No cess, TCS, tax-inclusive prices, foreign-currency invoices or e-invoice IRNs yet.&lt;/li&gt;
&lt;li&gt;The UPI package builds links. It doesn't move money or confirm a payment.&lt;/li&gt;
&lt;li&gt;Everything runs where you call it. Nothing is sent anywhere.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How they're published
&lt;/h2&gt;

&lt;p&gt;The packages are plain ESM for Node 18+, browsers and edge runtimes. They're released from GitHub Actions with npm provenance, so &lt;code&gt;npm audit signatures&lt;/code&gt; can confirm each one was built from the public repo.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try them
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install @merainvoices/gstin @merainvoices/gst-invoice @merainvoices/inr @merainvoices/upi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code, runnable examples and docs are at &lt;a href="https://github.com/merainvoices/oss" rel="noopener noreferrer"&gt;github.com/merainvoices/oss&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We'd love your edge cases. If your bank's statement export doesn't read correctly, open an issue with just the header row, no account data. And if you've hit a one-paisa bug of your own, tell us about it in the comments.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>opensource</category>
      <category>node</category>
      <category>india</category>
    </item>
  </channel>
</rss>
