CRM & SaaS development

Building GST Invoices and UPI QR Into SaaS

How to add GST-compliant invoices, quotations and UPI QR payment codes to a SaaS product, based on the invoicing module I built for Client Mitra.

By Devang GandhiUpdated Nov 3, 20268 min read

Most Indian SaaS products eventually hit the same request: "Can we send a proper GST invoice from here?" GST invoice software development sounds like a small feature, but it touches your data model, tax math, document rendering, numbering rules and payments all at once. Get the foundations wrong and you end up patching rounding errors and edited invoices for years.

I built the invoicing and quotation module for Client Mitra, a multi-tenant CRM for photography studios and creative service businesses. This post walks through what that build taught me: how to model invoices, compute tax, render branded PDFs and add a UPI QR code that gets studios paid faster.

TL;DR

Model invoices as frozen snapshots, not live joins. Keep amounts in paise, compute CGST/SGST or IGST per line with one shared function, and generate PDFs on the server. Add a UPI QR built from a upi://pay link with the amount and invoice number pre-filled. Make quotations and invoices share one line-item structure so conversion is a single click.

key takeaways

  • Treat invoices as immutable snapshots of customer, business and tax data at the moment of issue, not live views of other records.
  • Store money in the smallest unit and compute CGST, SGST or IGST per line from a single tax function used everywhere.
  • A UPI QR code is just a upi://pay deep link encoded as an image, so it costs almost nothing to add and shortens time to payment.
  • Quotations, invoices and payments should share one line-item model so converting a quote to an invoice is a copy, not a re-entry.

The data model behind a GST invoice

The most common mistake I see is an invoice table that stores a customerId and looks up the customer's name and GSTIN at render time. Six months later the customer changes their address, and every old invoice silently changes too. That is a compliance problem.

Instead, an invoice should copy everything it prints at the moment it is issued. In practice that means three groups of fields.

Group Fields to snapshot Why
Seller business name, GSTIN, address, state code, logo URL, UPI VPA Your own details change too (new logo, new office)
Buyer name, GSTIN (optional for B2C), billing address, place of supply Place of supply decides intra- vs inter-state tax
Lines description, HSN/SAC, qty, rate, discount, tax rate, computed tax Rates and catalogs change after issue

Alongside those, keep invoiceNumber, issueDate, dueDate, status (draft, issued, partially paid, paid, cancelled) and a tenantId. In Client Mitra every query runs through tenant isolation middleware, so one studio can never fetch another's invoices even with a guessed ID.

Numbering that never collides

Invoice numbers must be unique and sequential per business per financial year. Do not generate them with count() + 1, because two staff members issuing at the same second will collide. Use an atomic counter document per tenant and financial year, incremented with a single findOneAndUpdate and $inc, and assign the number only when the draft becomes issued. Drafts do not consume numbers.

Getting the tax math right

GST math is simple until it isn't. The rules that matter for most service businesses:

  1. Compare the seller's state code with the place of supply.
  2. Same state: split the rate into CGST and SGST (for example 18% becomes 9% + 9%).
  3. Different state: apply the full rate as IGST.
  4. Compute tax per line on the taxable value after discount, then sum.
  5. Round each tax component to the paisa, then round the grand total as your business rules require, showing any round-off as its own line.

Write this once as a pure function, something like computeInvoiceTotals(lines, sellerState, placeOfSupply), and call it from the API, the PDF renderer and the UI preview. When the browser computes one total and the server computes another, customers notice before you do.

Store all money as integers in paise. JavaScript floating point turns 0.1 + 0.2 into 0.30000000000000004, and across hundreds of line items that becomes a visible one-rupee mismatch between the PDF and your reports.

Quotations use the same engine

Studios send quotations first, then convert the accepted quote to an invoice. If quotations have their own schema, conversion becomes a manual re-entry and the numbers drift. In Client Mitra quotations and invoices share the line-item shape and the totals function. Converting is a copy into a new invoice draft with a reference back to the quote.

Branded PDFs and the UPI QR code

Customers judge a business by its invoice. Small businesses want their logo, their colors and a clean layout, not a generic template with your SaaS branding on top.

I render invoices server-side with PDFKit in Node. Server rendering means the same PDF whether it is downloaded on a phone, emailed, or shared through a link on WhatsApp. Business logos are stored on Cloudinary, so the renderer fetches a resized version instead of embedding a 4 MB phone photo into every PDF.

Adding a UPI QR

A UPI QR is the highest-value, lowest-effort addition to any Indian invoice. The QR simply encodes a deep link:

upi://pay?pa=studio@okbank&pn=Studio%20Name&am=25000.00&cu=INR&tn=INV-2026-0142

Here pa is the payee VPA, pn the payee name, am the amount, cu the currency and tn a note that should contain the invoice number. Generate the QR as a PNG on the server and place it near the total with a "Scan to pay" label. When the customer scans, their UPI app opens with the amount and reference already filled in, which removes the most common reason for payment delays: typing the wrong amount or forgetting the reference.

Two cautions. First, use the balance due, not the invoice total, once partial payments exist. Second, a static UPI QR does not notify your system of payment. Staff still mark payments received, or you add a payment gateway for automatic confirmation. If you want gateway-based collection, Razorpay's payment links documentation covers the hosted flow.

Payments, expenses and the profit view

An invoice module is only half useful if payments live somewhere else. Each invoice should have a payments array or collection with amount, mode (UPI, cash, bank transfer, card), date and who recorded it. Status is derived: if payments sum to the total, it is paid.

Once payments and expenses sit in the same database, a basic profit view per booking or per month becomes a query instead of a spreadsheet exercise.

How I built this in practice

In the Client Mitra case study I built the whole product solo: a Next.js App Router front end with Tailwind and TanStack Query, and a Node/Express API on MongoDB with Mongoose. The invoicing piece covers GST invoices and quotations carrying the studio's own logo and a UPI QR, recorded payments, expenses and a profit view, plus reports.

PDFs are generated with PDFKit on the server and logos come from Cloudinary. Owners, managers and staff have different permissions, so staff can run the crew calendar for multi-day weddings without seeing any money. Tenant isolation is enforced in middleware, and node-cron sends payment reminders for overdue invoices. The same web app ships as native Android and iOS apps through a Flutter wrapper, so studios can share an invoice straight from their phone.

Common mistakes

  • Rendering invoices from live customer and product records instead of a frozen snapshot at issue time.
  • Using floating point rupees, which creates one-rupee mismatches between PDFs, dashboards and reports.
  • Generating invoice numbers with a count query, which collides under concurrent issuing.
  • Building quotations with a separate schema, forcing manual re-entry when a quote is accepted.
  • Encoding the invoice total in the UPI QR after a partial payment has already been received.
  • Allowing edits to issued invoices instead of using cancellation and credit notes.

keep reading

FAQ

How long does GST invoice software development take inside an existing SaaS?+

For a focused module with quotations, invoices, PDF output and a UPI QR, plan on roughly three to six weeks of development. The range depends on how many tax edge cases you support and whether payments must reconcile automatically.

Do I need a GST API or e-invoicing integration?+

Not always. Small businesses below the e-invoicing threshold only need a correctly formatted tax invoice. If your customers cross the threshold, plan a separate integration with the government invoice registration portal through an approved provider.

Can a UPI QR code on an invoice include the exact amount?+

Yes. The upi://pay link supports payee VPA, payee name, amount, currency and a transaction note, so the customer's app opens with the amount and invoice number already filled in.

Should invoices be generated on the server or in the browser?+

Generate them on the server. Server-side PDFs look identical on every device, can be emailed or shared by link, and keep your numbering and tax logic in one trusted place.

Devang Gandhi

AI & full stack developer at Passdn, building CRMs, SaaS, AI agents and Flutter apps for clients in the US, UK, Australia, UAE and India. More about me

Read next

More in CRM & SaaS development