Pass Convenience Fee To Customer


I am attempting to integrate Square payments into my .Net website and the desire is to pass the convenience fee (aka processing fee, aka transaction fees) on to the customer. It seems as though, when I calculate the amount the convenience fee should be, and include that amount in the total (item total + convenience fee), the end result is a higher convenience fee. Thus, the end result of the collected amount is always less then the item total.

For example, if I have a $100 payment and add the convenience fee (2.9% + $0.30), I would create the payment for $103.20. The payment then calculates a convenience fee of $103.29, and thus the total collected is $99.91.

Using the link below (Square Payments Surcharge Calculator), it looks to calculate the amount to charge in order to receive the full item amount. But I can’t determine how the calculator derives its “Amount to charge customer”.

Does someone know the formula for the calculator above or is there a different/better way to pass the
convenience fee off to the customer?


(P.S. Had some screenshots, but the post wouldn’t create if I include them…)