Paypal not calculating proper fees

  • Brian Lisle
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
9 years 10 months ago #61557 by Brian Lisle
Paypal not calculating proper fees was created by Brian Lisle
Noticed today that paypal is shorting us a few cents... we charge $30 as a base, which is supposed to be charged as 31.20, but it only charged 31.17 - I checked the paypal settings, and they are correct at 2.9% and .30 per transaction. Not sure why this happened, it worked fine before. Could you check this please?

Please Log in or Create an account to join the conversation.

More
9 years 10 months ago #61575 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Paypal not calculating proper fees
Hi Brian

Could you please submit a support ticket sending us super admin account of your site and the link to the page so that I can check to see what's wrong and get it sorted?

Tuan

Please Log in or Create an account to join the conversation.

More
9 years 10 months ago #61661 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Paypal not calculating proper fees
Hi Brian

The fee is calculating properly. It is 30 + (30*0.029) + 0.3 = 31.17

So I don't see anything wrong here

Tuan

Please Log in or Create an account to join the conversation.

  • Brian Lisle
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
9 years 10 months ago #61664 by Brian Lisle
Replied by Brian Lisle on topic Paypal not calculating proper fees
I am pasting my response from 6 months ago...
To recap - Paypal charges 2.9% +$0.30 per transaction.
So, to take home the correct total ($30.00 in my case) I would need to charge 31.20.
This would be $30.00 +.30 = $30.30 / .971 = 31.20, so the paypal fee on $30 would be 1.20 added to the member's total.
(100 - .029 = .971 above)
So the fee box (where I would put the .30) would add to the total of the transaction, then the percentage box would subtract from 100 like above, then calculate the total to be charged, then subtract the original total and show the member the remainder as a processing fee (in this example the $1.20)

Please Log in or Create an account to join the conversation.

More
9 years 10 months ago #61906 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Paypal not calculating proper fees
The extension not only support Paypal but also support other payment gateways. If you set up the payment processing fee like that, the total fee will be calculated as below:

30*(1 + 0.029) + 0.30

As I don't see anyone else complain about the way it works (like that), I could not change default behavior of the extension. I can modify the code to make it works as you want, but please maintain it yourself when you upgrade to future releases of the extension.

Please confirm so that I can modify it for you

Tuan

Please Log in or Create an account to join the conversation.

  • Brian Lisle
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
9 years 10 months ago - 9 years 10 months ago #61907 by Brian Lisle
Replied by Brian Lisle on topic Paypal not calculating proper fees
Yes, please modify that. Can you perhaps put a dropdown selection in the module to change the way it calculates so that people will have a choice? Because the way it calculates now for paypal is incorrect, I understand that others may not want it that way, but anyone using paypal should need it corrected.
Also, please let me know which file I need to maintain to keep it calculating that way.
Thanks!
Last edit: 9 years 10 months ago by Brian Lisle.

Please Log in or Create an account to join the conversation.

More
9 years 10 months ago #61947 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Paypal not calculating proper fees
I could not make it a choice, sorry. The config option is straight forward. There are two parameters like as you see:

1. Percent: It is the percent of the fee will be added to subscription fee.

2. Fixed fee. This is a fixed amount will be added to susbcription fee

So in your case, if you set it to 2.9% + 0.3, then the fee is 30 + 30*2.9/100 + 0.3. It looks correct for me

So in this case, I will modify the code for you and tell you the function where I modified it so that you can maintain it yourself

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Brian Lisle
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
9 years 9 months ago #63063 by Brian Lisle
Replied by Brian Lisle on topic Paypal not calculating proper fees
I see what you are doing... and it is sort of correct. If someone was to send 30, then paypal would take the 1.17 in fees. I would then get 28.83 net. That is correct. But what I need is to receive 30 net, (the customer is paying the paypal fees) so in order for me to get that, I would have to charge a 1.20 fee for a total of 31.20 which would allow me to receive 30 net.
The calculation is: $30.00 +.30 = $30.30 / .971 = 31.20 (Where the .971 is the percentage minus 100)
See this website for a calculator that will show the difference between sending an amount and being able to receive a certain amount. www.gregledet.net/ppfcm.html

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago #63072 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Paypal not calculating proper fees
For someone interested in this modification, please follow the instructions below to get it works:

1. Open the file components/com_osmembership/helper/helper.php

2. Find the function calculateSubscriptionFee

3. Find this code below:
Code:
if ($paymentFeeAmount > 0 || $paymentFeePercent > 0) { if ($trialGrossAmount > 0) { $fees['trial_payment_processing_fee'] = round($paymentFeeAmount + $trialGrossAmount * $paymentFeePercent / 100, 2); } else { $fees['trial_payment_processing_fee'] = 0; } if ($regularGrossAmount > 0) { $fees['regular_payment_processing_fee'] = round($paymentFeeAmount + $regularGrossAmount * $paymentFeePercent / 100, 2); } else { $fees['regular_payment_processing_fee'] = 0; } if ($grossAmount > 0) { $fees['payment_processing_fee'] = round($paymentFeeAmount + $grossAmount * $paymentFeePercent / 100, 2); } else { $fees['payment_processing_fee'] = 0; } $trialGrossAmount += $fees['trial_payment_processing_fee']; $regularGrossAmount += $fees['regular_payment_processing_fee']; $grossAmount += $fees['payment_processing_fee']; } else { $fees['trial_payment_processing_fee'] = 0; $fees['regular_payment_processing_fee'] = 0; $fees['payment_processing_fee'] = 0; }

4. Change it to:
Code:
if ($paymentFeeAmount > 0 || $paymentFeePercent > 0) { if ($trialGrossAmount > 0) { $fees['trial_payment_processing_fee'] = round(($trialGrossAmount + $paymentFeeAmount) / ( 1- $paymentFeePercent / 100) - $trialGrossAmount, 2); } else { $fees['trial_payment_processing_fee'] = 0; } if ($regularGrossAmount > 0) { $fees['regular_payment_processing_fee'] = round(($regularGrossAmount + $paymentFeeAmount) / (1 - $paymentFeePercent / 100) - $regularGrossAmount, 2); } else { $fees['regular_payment_processing_fee'] = 0; } if ($grossAmount > 0) { $fees['payment_processing_fee'] = round(($grossAmount + $paymentFeeAmount) / (1 - $paymentFeePercent / 100) - $grossAmount, 2); } else { $fees['payment_processing_fee'] = 0; } $trialGrossAmount += $fees['trial_payment_processing_fee']; $regularGrossAmount += $fees['regular_payment_processing_fee']; $grossAmount += $fees['payment_processing_fee']; } else { $fees['trial_payment_processing_fee'] = 0; $fees['regular_payment_processing_fee'] = 0; $fees['payment_processing_fee'] = 0; }

This is a strange requirement, so far, only you need it :D.

Please Log in or Create an account to join the conversation.

  • Brian Lisle
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
9 years 9 months ago #63156 by Brian Lisle
Replied by Brian Lisle on topic Paypal not calculating proper fees
Thanks Tuan! (and don't worry, once folks see this, they'll probably all want it!)

Folks will want to change this if they are charging their customers the paypal fee.
While your original coding is correct, in the example 1.17 is the fee for $30, when you send that total to paypal as 31.17, that's what paypal is now calculating their fee on, which is now raised to 1.20. You wouldn't be getting the full $30 now, you'd be shy a few cents. Not a huge deal at smaller amounts, but as the amount gets larger...
Thanks again for posting the needed change!

Please Log in or Create an account to join the conversation.