Jump to content

PHP fees calculation


edgarasm
Go to solution Solved by kicken,

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
Share on other sites

  • Solution

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;
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.