The first test is about freedom of choice. The Internal Revenue Service spells it out in its tip-reporting rules for food and beverage businesses. If the customer picked the number, it is a tip. If your bill printed the number, it is a service charge. The IRS says it plainly: because the customer did not have an unrestricted right to determine the amount on the "tip line," the charge is considered a service charge.
Read the full rule in Publication 531 (12/2024), Reporting Tip Income.
The second test is how the amount got onto the bill in the first place. If your system computed the amount and pre-filled the line — 18% of the charges, say — the customer had to accept it or cross it out. That is not the same as starting from a blank line. In the IRS example, the restaurant's pre-filled 18% was treated as a service charge.
A shop can pass either test and still look similar on the printed bill. In the pre-filled case, the customer sees a line with "18%" printed on it. The difference sits in who decided that number and whether the customer could have changed it without friction.
The plain rule: the customer must freely decide the amount for it to be a tip. The IRS example spells the reasoning out in the negative: without an unrestricted right to decide, the amount is a service charge.