Skip to content

Killing the fake discount

I had a variable literally named fakeOriginal. Ripping it out meant I finally had to build real GST invoices.

SD
Shubham Datarkar
· 2 min read

For weeks the service page on book-a-sloth showed a struck-through price and a shiny percent-off badge. There was no real discount. I built it that way early because every marketplace does it, and I told myself it was fine. Yesterday I finally ripped it out.

The thing that bugged me was a field in the code called fakeOriginal. I had literally named a variable fakeOriginal. Every time I opened that file it stared back at me. An inflated MRP, a percentage off a number I invented -- that is not a discount, that is a lie with nice styling.

So I replaced it. The sidebar now shows the actual service price, then one plain line: plus platform fee and tax. A small info tooltip opens inside the sidebar and itemises it -- service price, platform fee, tax (GST), total. No badge, no strike-through, no drama. The mobile checkout bar got the same treatment. It looks less exciting and I think that is exactly the point.

The honest version needs real invoices

Here is the catch with being honest about a platform fee. If I am charging a fee and adding GST on top, I actually have to hand people a tax invoice. You cannot print plus tax on a checkout and then give the seller nothing on paper. Indian sellers need that invoice for their own books.

So the rest of the day went into the billing layer. Pure helper functions first -- financial year, GSTIN validation, place-of-supply, the CGST/SGST versus IGST split depending on whether buyer and seller sit in the same state. Then a create_invoice RPC with an idempotent counter so one charge can never mint two invoices. Then a server-rendered A4 tax invoice, laid out like the Zoho and Timewheel invoices I have received myself over the years.

I wired it into both money flows. A booking mints a platform-fee invoice when the payment verifies. A subscription mints one on every charge, including the older recurring ones. Both surface as a download link on the confirmation screen, and there is now a GST-invoice list on the dashboard so a seller can pull any of them later.

An inflated MRP is a lie with nice styling.

note to self

The tax split is the part I do not fully trust yet. Same-state versus inter-state GST is easy to get subtly wrong, and I have not stress-tested every combination of buyer and seller location. That is the first thing to verify before this touches a real rupee.

Next up: check the invoice numbers against an actual GST filing, and make sure the seller GSTIN config is not quietly hardcoded to one entity.

Reactions

How was this article?

Newsletter

Never miss the next one

Get the latest playbooks, build logs, and the occasional unpublished idea straight to your inbox. One signal a week — no noise.