Checkout 2.0
Monthly Fee calculation product script

Monthly Fee calculation product script

If you have a product page where you want to display monthly fee when paying the purchase with account or loan.

Javascript function

function getMonthlyPayment(months, price, statementFee, yearInterestRate) {
  return (
    Math.round(
      ((yearInterestRate / 1200 +
        yearInterestRate /
          1200 /
          (Math.pow(1 + yearInterestRate / 1200, months) - 1)) *
        price *
        100) /
        100,
    ) + statementFee
  );
}

Example calculation


Monthly Payment:

Example product page item : Account 12 month

Example of a product with mothly fee calculation done