months (integer, required) min 1 : Total number of monthly payments in the loan
payment_number (integer, required) min 1 : Which payment to report (1 = first payment)
Outputs
interest_portion (currency units): Interest paid in this payment
principal_portion (currency units): Principal paid in this payment
remaining_balance (currency units): Balance remaining after this payment
Steps
Convert the annual rate to a decimal: r = annual_rate_percent / 100; monthly rate i = r / 12.
Compute the fixed monthly payment using the standard annuity formula: payment = principal * i * (1+i)^months / ((1+i)^months - 1) (or principal/months if i = 0).