edgarasm Posted February 4, 2014 Share Posted February 4, 2014 Dear PHPFREAKS I was hoping maybe i would be able to get some help here Im thinking on calculating fees and certain percentage of transaction ? Which would be the best way to do so ? so after each withdrawal upload sending funds there would be a specific charge applied plus a percentage ,so lets say i would be sending $20 and the recipient would only receive 17.50 Im using code igniter framework . Any help would be appreciated Thanks Quote Link to comment https://forums.phpfreaks.com/topic/285939-php-fees-calculation/ Share on other sites More sharing options...
Solution kicken Posted February 4, 2014 Solution Share Posted February 4, 2014 It doesn't really matter what framework you are using. It's just basic math. You take the amount and subtract the fees. If you are going to do both a flat fee and percentage, you need to decide which order you want to remove them in and be consistent. Removing the flat fee first then taking a percentage would reduce the percentage fee amount. //As a fraction from 0 (0%) to 1 (100%) $feePercent=0.1; //in dollars $amount = 20; $flatFee = 0.50; $rateFee = $amount*$feePercent; $net = $amount - $flatFee - $rateFee; Quote Link to comment https://forums.phpfreaks.com/topic/285939-php-fees-calculation/#findComment-1467727 Share on other sites More sharing options...
edgarasm Posted February 4, 2014 Author Share Posted February 4, 2014 Thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/285939-php-fees-calculation/#findComment-1467733 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.