Urgent.News

What's breaking now, across thousands of outlets.

Tech

Tipping on a Pre-Tax vs Post-Tax Base: A Reference Sheet for Engineers Who Build the Math

If you have ever wired up a "calculator widget" in a checkout flow, expense module, or hospitality backend, you have probably discovered that the boring question — do we tip on the pre-tax subtotal, the post-tax total, or something in between? — is not boring at all. It is a tiny rules engine wrapped in regional habits, rounding quirks, and disagreement between what a customer expects and what a…

Calculating tips correctly is essential for engineering the math behind checkout flows and expense modules. The key consideration is whether to compute the tip based on the pre-tax subtotal or the post-tax total. In the United States, sales tax is typically added after the tip, meaning the tip is calculated on the pre-tax base. In regions with pre-tax models, like much of Canada, the tip is also calculated on the pre-tax amount.

However, in areas with a service charge already included in the price, like some parts of the UK, adding an additional tip would double-count the service. A robust calculation function should take two inputs: the pre-tax base and the post-tax total, along with a rule selector to determine which base is appropriate. This allows for clear auditing and avoids confusion between what customers expect and what service workers receive.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Saturday 22 August →