We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


How to calculate credit card minimum payment amount paid and time to pay off

lexo asked
Medium Priority
Last Modified: 2012-05-06
How can I use php to calculate how long it will take to pay off a credit card debt using a minimum payment option.

Here are the variables:
Credit Card Balance: $ccb
APR: $apr
Minimum Payment percentage of balance: $mmp

Number of months to pay off: $mos
Amount Paid: $amt

Credit cards offer a minimum payment option, typically 3% of the balance due.  If you make only the minimum payment and your balance is say $20000 how long will it take to pay off the entire balance and how much money will have been spent to pay off the balance?

I need the formula to be written in PHP.
Watch Question

I am not a php expert so cannot give you a complete free PHP program but the outline will be something like
A loop including
$newbalance  = $ccb ($ccb*100*$mmp) +$ccb *100/12*$apr
Iterate (putting $newbalance for $ccb) until $newballance = 0
$amt = sum of all terms in ()
Details  such as how often interest is charged to the account (monthly, daily,?), how to handle the last iteration, number of payments required in year (not always 12), have to be addressed.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
dhsindyRetired considering supplemental income.

You night need to look at the back of a statement to see how they compute it.  Or, give them a call.  And, it might depend on your past payment history.  Paying the minimum on a credit card is not a good idea unless it has a very low interest rate.


@dhsindy your comment is neither informative nor helpful.  I dont have a personal credit issue, this is to build an online credit card calculator.  Your comments aren't needed here, thank you.

@Aburr, thank you. I will try to take your formula to the php experts.
awking00Information Technology Specialist

Aburr has you on the right track, but one note of caution. Since the payment is based on a percentage and the interest applied is also based on a percentage, a calculation of the new balance will only asymptotically reach 0. I would suggest that your loop be along the lines of "while new_balance > 100" or some manageable final payment amount. As an aside, if you had a $20,000 balance with a 3% minimum payment rate, and an annual interest rate of 12%, assuming an even monthly payment, it would take 22 years to payoff (no new charges) and you would pay nearly $30,000.

i can give you some formulae (not in PHP though), and iterations are not needed:
asume $mm is the minimum of the accpetable minimal payment, e.g. 100 in awking00's comment;
let $mr be the monthly interest rate as $apr/12.0
let $r = (1.0-$mmp)*(1.0+$mr) and this is the acctual rate of your balance decreasing.

then N+1 months is needed to pay off the debt, where
N = floor( log($mm/$ccb)/log($r)), floor(R) is the largest integer that <=R
$mos = N+1
and in the end, an amount of
$amt = $ccb*($mmp*(1.0-$r^(N-1))/(1-$r)+$r^N)
has been paid in total.

let me know if this is not detailed enough.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.