This calculates the Paypal transaction fee for a supplied amount, and adds it to the final amount. We used this to charge the Paypal fee back to the user as a booking fee on ticket sales for an event.
The function will spit out an array containing: *The Sub Total amount supplied as sub_total *The Paypal Fee applied as paypal_fee *The Grand Total, which is the two above added together, as grand_total
You have the option of rounding the fee up to the nearest whole number, or charging the user the exact transaction fee, just supply a second parameter in the function call as true.
The Paypal rates are set as variables inside the function itself, it's up to you to check what they are for your country and set them accordingly.
You need to login to post a comment.