I know this is more of a math question, but since I'm trying to evaluate it in a script, maybe I can squeeze it in here.
I know there is an easy way to do this, but for the life of me, I can't seem to get it clear.

If a payment processor is charging a per transaction fee of $1.50 plus a 6.5% processing fee, that come off of the total payment..

And I want to end up with a Net of $2 in my account, how do I determine what the Gross charge would be to send them?

BTW, they are charging the 6.5% on the transaction fee as well as on the actual payment itself.

what they are doing on their end when they receive it is they take the Gross payment and multiply it by the 6.5% rate, then add the $1.50 trans fee to determine the fee, and back that out of the gross payment to determine the net that goes into the account.

$fee=($gross x .065) + 1.5;

So, the basic question is...
How do I determine what the Gross needs to be to end up with the net where I want it. In this case it is $2, but I need to be able to calculate it with a single calculation no matter what the net is.

This is what I thought would work, but apparently I was wrong...

    $cc_fee= (ceil(((($fund_amount+1.5)*.065)+1.5)*100)/100);

Any clarification or enlightenment on this matter would be greatly appreciated.


Recommended Answers

All 6 Replies

I'm going to go on the basis I have the right idea for what you want, the calculation is as follows:

You want the fee (referred to as $outcome, what you get) to equal a certain amount, lets take your example for $2, so...

(($gross x 0.065) + 1.5) must equal $2 ... and you want to know what $gross is? so you would do the following:

(2 - 1.5) / 0.065 = 7.6923... - That's what you have to charge your customer, in order for you to receive $2 in fees.

Now, for that to work on any calculation with pluggable values in PHP:

$outcome = 2;
$charge = 1.5;
$processing_fee = 0.065;

$gross = ($outcome - $charge) / $processing_fee;

// Gross is now 7.6923...

Sorry, but that is not what I was trying to explain...

In my example, the gross should end up at $3.74 for them to take away their 6.5% and then their $1.50 and leave the $2.00 net

What I need is to figure out what the Gross should be so they can take their 6.5% and their $1.50, and leave me with the net that I want in my account. (in example the net is $2.00)

Ah see, you want them to absorb the charges, the $1.50 throws the equation I know off :/ ... if they applied it before, then it would have been ok.

OK, I have come up with the solution, although it was a long drawn out process to come up with the factor to use to represent the 6.5% they would deduct...

Here is a little snippet to show the solution.
And it actually works no matter what the funding amount is.
(Well almost) Tested from $2 to 35,000 with accuracy, but when you hit $40K it gains a penny... but since the funding amount will never approach that figure, I think I'll deal with it.

   $factor=.06526; // represents 6.5% fee deducted after payment

print "<br />To fund $".number_format($fund_amount,2);
print "<br />The fee is $".number_format(($fee+$trans_fee),2);
print "<br />For a total Charge of $".number_format($total_charge,2);

print"<br /><br />So when the processor receives the payment of $".number_format($total_charge,2);
print"<br />They determine the fee to be gross X .065 plus $1.50, which is ".number_format((($total_charge * .065) + 1.5),2);
print"<br />Leaving a Net of $".number_format(($total_charge-(($total_charge * .065) + 1.5)),2);

I believe the penny gained at 40K was coming from 0.00026 . $factor minus the actual value used (0.065)..

sorry, for the double post..how did it happen??????

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.