# How to calculate a moving percentage

I need to collect a payment using a payment provider that charges 2.9% + .30 of the final payment amount. I need to ensure that a specific number is collected after the fees are taken out. I need the end user to pay for the credit card fees so I'm adding them back into the payment amount which messes with the final total.

Here is an example:

100 has to be collected.

If I were to add in the credit card fees 100 + 2.9% + .30 = 103.20 and try to collect that it messes up the 100 because the processor takes 2.9% + .30 from the final payment amount 103.20 which ends up being 103.20 - 2.9% + .30 = 99.90 instead of 100 so I end up short .10 in this example.

I know that I need to calculate the payment amount 103.30 in order to make it 100 instead of 99.90 but I don't know how to come up with a formula to calculate that amount.

Let $C$ be the basic cost of an item (in dollars). If I'm reading you correctly, your payment provider takes a $2.9$% cut and then charges $30$ cents extra, so ultimately you get $C - 0.029C - 0.30=0.971C-0.30$ dollars.
So you need to find an increased cost $x$ such that, after those charges are deducted, you get $C$ dollars. That is:
$$0.971x-0.30 = C$$
The solution to which is $x=\frac{C+0.30}{0.971}$.
• @Adam $0.971C$ is $C-0.029C$. – Jack M Aug 9 '14 at 22:49