Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I calculate PayPal's fees (2.9% + .30) on a fixed number?

Sounds like an easy question, I know. I am literally stumped.

Here are two websites that have made the simple calculator:

http://thefeecalculator.com

http://ppcalc.com

I'm needing to calculate these PayPal's fees in my PHP application.

Here's what I got, say we wanted to be paid $30 "even" for membership fees. This is the function I'm using to calculate what we should charge to make up for it using PayPal's calculations (also described on both of the sites above): 2.9% of the transaction + $0.30.

function memfees()
{
    $calc = round((30 * .029) + 30 + .30,2);
    return $calc;
}

Test it here: http://matt.mw/junk/php/memfees.php As you can see, it says 31.17. Both of the other websites say it should be 31.20. If I try $130.00, mine calculates to $134.07 and both of theirs calculate to $134.19.

What am I doing wrong?

Why am I using a Round function? Percentages cause some decimals to go past the hundredths place, and PayPal generates an error if there is more then 2 digits after the decimal. I thought people normally round money, (e.g. $31.6342 will be $31.63) but if that is the case, what am I doing wrong in my function? The amount that is off is further if there are large payments. This leads me to believe that something is wrong with the percentage portion.

Could you offer some help on this?

Thank you for your time.

like image 416
WebMW Avatar asked May 16 '12 06:05

WebMW


People also ask

How are PayPal fees calculated?

PayPal's payment processing rates range from 1.9% to 3.5% of each transaction, plus a fixed fee ranging from 5 cents to 49 cents. The exact amount you pay depends on which PayPal product you use. A $100 transaction will cost between $2 and $3.99.

What is the 2.9% fee for PayPal?

The current fees for PayPal Payments Pro are 2.9% + $0.30 per transaction for US transactions. For international transactions, they're 4.4% + a fixed fee. The fixed fee differs between locations, like the standard transaction fees above.

What are the PayPal fees on $3000?

To clarify, let us say that you exceed $3000 in sales but do not exceed $10,000 before the monthly period ends. In this event, the transactions you receive will charge 2.5% instead — though still with a 30-cent addition to each transaction.


1 Answers

Your function does seem strange. To break it down, PayPal is charging a fixed rate of $.30, and adding a transaction percentage fee of 2.9%.

The formula for this is to add the $.30 and then divide by the percentage difference (100% - 2.9%), which will give you the amount prior to the actual reduction by PayPal.

function memfees($amount)
{
    $amount += .30;
    return $amount / (1 - .029);
}

You can round and float that as you wish.

like image 126
Jordan Avatar answered Sep 27 '22 17:09

Jordan