Jump to content

PHP fees calculation


edgarasm

Recommended Posts

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 

Link to comment
https://forums.phpfreaks.com/topic/285939-php-fees-calculation/
Share on other sites

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;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.