Created with Sketch.
Created with Sketch.

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.

Java script function

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

Example calculation

Months
Price
Interest Rate (year)
Statementfee

Example product page item : Account 12 month