When building invoicing tools, SaaS checkouts, or e-commerce margin calculators, one of the most common bugs is naive fee pass-through math.

If you want to receive $100.00 net through a processor charging 2.9% + $0.30 (e.g., standard Stripe / Shopify Payments US card rate), charging $103.20 is wrong — because the 2.9% fee also applies to the $3.20 surcharge you added.

The Exact Reverse-Invoice Gross-Up Formula

To clear a target net payout $N$ after a percentage rate $r$ and fixed fee $F$:

function grossUpInvoice(targetNet, rate, fixedFee) { const gross = (targetNet + fixedFee) / (1 - rate); return Math.ceil(gross * 100) / 100; // round up to nearest cent } // Example: Net $100.00 on Stripe US standard (2.9% + $0.30) // grossUpInvoice(100, 0.029, 0.30) => $103.30 

At $103.30, the processor deducts ($103.30 * 0.029) + $0.30 = $3.30, leaving you with exactly $100.00 net.

Open CC-BY-4.0 Benchmark Dataset (20 US Platforms)

To make testing payment-fee math easier for developers, indie hackers, and analysts, we compiled and archived a structured CSV dataset covering 20 US payment processors, marketplaces, and creator platforms (Stripe, PayPal, Square, Shopify Payments, Venmo Business, Etsy, eBay, Amazon, Poshmark, Mercari, Depop, Upwork, Fiverr, Gumroad, Patreon, Substack, Ko-fi, TickPick, StubHub, and StockX).

Sample CSV Schema

platform,category,fee_percent,fixed_fee_usd,net_on_100_usd,gross_to_net_100_usd Stripe,Payment Processor,2.90,0.30,96.80,103.30 PayPal Commercial,Payment Processor,3.49,0.49,96.02,104.13 Square Online,Payment Processor,2.90,0.30,96.80,103.30 Etsy,Marketplace,9.50,0.45,90.05,111.00 Upwork,Freelance Platform,10.00,0.00,90.00,111.12 

All CSV files are released under CC-BY-4.0 so you can pull them straight into unit tests, pricing sheets, or analytics notebooks.