Approved, not published yet. Visible on the preview site only.

Building your own quote and invoice portal: what it takes in India

Online quote acceptance, invoice numbers by financial year, TDS on part payments, INR and USD routes, gateway reconciliation. How we built ours and when not to.

Software8 min read

Hands typing on a laptop on a wooden desk, beside a cup of coffee and a notebook

A client pays an invoice of ₹50,000 and ₹45,000 lands in the bank. Was it a mistake, a bank charge, or TDS? The quote is in a Word file, the invoice in an app, the payment screenshot on WhatsApp and the accountant's spreadsheet somewhere else. Nobody can say if the invoice is settled.

That pile is normal for a small business. When we set up our company this year, we looked at the usual invoicing apps and at an open-source option. They handle simple bills well. None of the ones we looked at handled what we needed: billing in India and abroad, part payments with tax deducted, estimates billed on actual use, and files going both ways. So we built a small portal for exactly that.

Why build one, and when not to

A quote, an invoice, a payment and a receipt are four records of one deal. Kept in four places, they drift. A short payment looks unpaid forever. A cancelled invoice gets deleted and the numbering has a hole your accountant has to explain. A good system keeps one chain where each step creates the next and nothing is retyped.

Usually, though, do not build. If your invoices are simple, a standard app is cheaper and someone else maintains it. Building makes sense only when:

  • your work crosses three or more tools that do not talk to each other,
  • the awkward cases (TDS, two currencies, part payments, file delivery) are your normal cases,
  • you have someone who can maintain it, back it up and keep up with rule changes.

If any of those is missing, buy.

What you need

  • A small always-on server you already run, or a cloud machine (roughly ₹500 to ₹2,000 a month, approximate). Ours shares a box with other services.
  • Django, for logins, CSRF protection, forms and migrations you do not hand-roll. Free.
  • SQLite for the database and WeasyPrint for PDFs, which renders the same HTML and CSS as the web pages. Free.
  • Docker and Caddy to run it and serve it over HTTPS. Free.
  • Nextcloud for upload and delivery links, and a mail server or relay for sending. Free if self-hosted.
  • A payment gateway account, for online payments. Expect KYC: a current account in the company name and a public website showing your exact legal name, registered address, CIN, contact details, pricing, and refund, privacy and terms pages.
  • A chartered accountant. Everything here is what we did for our own company in 2026, not legal or tax advice; have a CA confirm anything that touches your tax or filings.

How it works, step by step

Quotes

  1. Build the quote. Line items are fixed, or estimates such as "est. 100 GB, billed on actual use". The client gets a private link to a branded page with a PDF download. When it works, the quote shows as "viewed" the moment they open it. At invoice time the estimated line is replaced by the actual quantity at the quoted rate. If actual runs well past the estimate, that is a change order (step 3), not a surprise on the invoice.
  2. Record acceptance properly. The client types their name and ticks the agreement box. Section 10A of India's IT Act 2000, and the ESIGN Act and UETA in the US, treat electronic contracts as valid. What matters is proof, so we store the typed name, the time in UTC, the client's IP address and browser, the version of the terms, and a SHA-256 hash of the exact quote shown. When it works, the quote locks and both sides get an email with the accepted PDF.
  3. Handle change orders the same way. If scope grows, a new quote goes out on the same project and is accepted the same way. Nothing is agreed in a chat message. The project page also carries an upload-only link (file drop, no account) and a delivery link, both Nextcloud shares the portal creates; staff get an email on upload, the client when a delivery is ready.

Invoices

  1. Freeze issued documents. On issue, a quote or invoice stores a snapshot of company details, client details, terms and lines. Mistakes are fixed with a new version or a credit note, never an edit or a delete.

  2. Number invoices at issue, per financial year. GST rule 46 wants numbers consecutive and unique within a financial year (1 April to 31 March), at most 16 characters of letters, digits, hyphens and slashes, like ABC/26-27/0001. Assign the number when the invoice is issued, not when the draft is made, or every abandoned draft leaves a gap. Take it inside one transaction. On PostgreSQL select_for_update() locks the row; on SQLite it does nothing, so also put a UNIQUE constraint on (series, number) and retry on IntegrityError. In outline:

    from django.db import transaction
    
    @transaction.atomic
    def next_invoice_number(fy: str) -> str:
        seq = Sequence.objects.select_for_update().get(key=f"invoice:{fy}")
        seq.value += 1
        seq.save()
        return f"ABC/{fy}/{seq.value:04d}"
    

    Credit notes get their own series. When it works, two invoices issued in the same second still get different numbers and the register has no holes.

  3. Never store money as a float. Use Decimal, store the currency on every document, round each line to two places, then add up. Otherwise one day an invoice is off by a paisa, and the accountant finds it.

  4. Build GST fields before you need them. Below the registration threshold (₹20 lakh of aggregate turnover for service providers in most states, exports included) invoices carry no GST. (₹10 lakh in some special category states, and some cases need registration whatever the turnover; ask your CA.) Still add your GSTIN, the client's GSTIN and state, and a SAC code per line. Once registered, a single "tax mode" field picks CGST plus SGST (client in your state), IGST (another state), or zero-rated export under a Letter of Undertaking.

Payments and books

  1. Record payments in three parts. Money received, bank charges and TDS withheld, all taken off the balance. TDS is commonly 2% or 10% depending on the section, and you claim it back using the client's Form 16A. When it works, the ₹45,000 from the opening closes the invoice, with ₹5,000 shown as TDS. Gateway payments record themselves. A bank transfer is typed in by hand with the UTR, and a tick box sends the client a receipt email. A 9:00 job emails reminders for anything overdue.
An invoice total split into money received, TDS withheld and bank charges, with a balance of zero
An invoice total split into money received, TDS withheld and bank charges, with a balance of zero
  1. Offer the right payment routes. Clients in India pay in INR by bank transfer (NEFT, RTGS or IMPS) or UPI.

    International clients pay in USD by US bank transfer (some providers give Indian exporters a US account number, typically around 1% plus GST on the fee, approximate) or by SWIFT wire, where banks often charge $20 to $50.

    Pay online sits on top through the gateway (we use Razorpay: UPI, cards, net banking, Apple Pay, and USD cards), the most convenient route for the client and the dearest for you: international cards cost around 3% plus GST on the fee, approximate; introductory offers exist for new accounts. For export invoices, attach the bank's e-FIRA or FIRC to each foreign payment, and watch RBI's deadline for export proceeds (9 months for services at the time of writing).

  2. Record each gateway payment twice: webhook now, settlement later. The webhook records the payment right away. Verify its signature first, usually HMAC-SHA256 over the raw body:

    import hmac, hashlib
    
    def valid_signature(raw_body: bytes, header_sig: str, secret: str) -> bool:
        expected = hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
        return hmac.compare_digest(expected, header_sig)
    

    Then make the handler idempotent, because webhooks can arrive twice: store the gateway's payment id on the payment row with a unique index and ignore any webhook whose id already exists. A webhook does not tell you what reached your bank, so a morning job asks the gateway for the real fee, tax, settled amount, settlement date and bank reference. It also spots refunds made in the gateway dashboard and drafts a credit note for review, never issuing one itself. When it works, the books page shows actual fees instead of guesses.

A payment reaching the portal twice: once by webhook at capture, once by the morning settlement check
A payment reaching the portal twice: once by webhook at capture, once by the morning settlement check
  1. Export the books. One page lists a financial year's invoices, payments, fees, credit notes and refunds, with a spreadsheet export. A nightly backup copies the database and PDFs off the machine. Books of account must be kept for 8 financial years under the Companies Act, so the portal never deletes financial records. Only client media files expire.
The chain from quote to books: quote, acceptance, invoice, payment, receipt, books export
The chain from quote to books: quote, acceptance, invoice, payment, receipt, books export

What goes wrong

  • Test data burns real numbers. Every demo invoice in the live database takes a number from the series. Fix: test with automated tests or a separate data folder, never the real database.
  • Cached PDFs outlive a reset. If issued PDFs are stored by number, wiping test data means the new 0001 can serve the old file. Fix: any reset deletes stored PDFs too.
  • The checkout popup is blocked. With Razorpay, a strict Cross-Origin-Opener-Policy header broke the gateway's popup. Fix: relax it to same-origin-allow-popups.
  • Apple Pay will not show. With Razorpay it needs the checkout embedded on your own page and Apple's verification file served from your domain under /.well-known/. Fix: serve that file and embed the checkout.
  • Early gateway tests behave oddly. New accounts have risk checks and holds on funds. Fix: finish KYC before you test, run the flow on the gateway's test keys, then make one small live payment, and keep a small balance so a test refund does not bounce.
  • Export payments wait for paperwork. Some providers settle an export payment only after you link the invoice to it. Fix: check this before promising a client anything about timing.

Cost and time

Software cost is close to zero if you already run a server; the running costs are gateway and bank fees per payment, as above. The real cost is time. Expect weeks of evenings for a first version, not days, plus a few hours a year keeping up with rule changes (approximate, and it depends on how much you already know Django).

The short version

Whatever you use, built or bought, check that it records acceptance with a name, time and hash, numbers invoices at issue per financial year, freezes issued documents, records TDS and bank charges separately, and reconciles gateway settlements, not just payments. If an app does all that for you, buy it. We could not find one that fit, so we built ours.

TDH Systems builds custom business software like this for small companies. See what we build.

Written by Siddharth Agrawal, Founder and Director, TDH Systems.

Tell us what you have in mind. We will come back with a plan and a quote.

Start a project

Prefer email? Write to info@thydarkhour.com.