How ZeraBooks Calculates and Records Loan Principal and Interest

ZeraBooks calculates loan-payment splits in its ledger code, not in AI. Its approach pairs a cent-rounded interest calculation with balanced journal entries and a check against the lender's statement after every payment. When the lender supplies its own principal and interest breakdown, those figur…

Robert Calloway
lake-953ca5b3-190f-419c-85b3-937583a008eb-0.webp

The lender's statement is the reference

In its DEV Community post, ZeraBooks describes a monthly calculation: multiply the outstanding loan balance by the annual interest rate, divide by 12 and round to the nearest cent. Subtract that interest from the payment to find the principal repaid.

That calculation assumes monthly interest charges. Many lenders instead calculate interest daily, meaning a late payment can accrue additional interest. If a statement specifies how much went toward principal and interest, ZeraBooks recommends using that breakdown and keeping the calculated schedule as a fallback.

Day-count conventions can also explain differences. Margill's white paper describes 30/360 as a method that assigns 30 days to every month and 360 days to a year. In the U.S., it is used for corporate bonds, agency bonds and mortgage-backed securities. Actual/360 instead counts the actual days the loan is outstanding while using a 360-day denominator. In Margill's example, that produces $101.39 in annual interest on a $1,000 loan at a nominal 10%, rather than $100, to the lender's benefit.

After each payment, the code compares the remaining balance in the books with the lender's balance and raises an error if they differ. This serves as a loan reconciliation, separate from checking that the payment cleared the bank.

Calculating the payment and repayment schedule

For a fixed-rate amortizing loan, the standard annuity formula determines the level payment. ZeraBooks illustrates it with a fictional loan of 24,000.00 at a fixed 6% over 24 months, producing a regular payment of 1,063.69.

The example uses Python's Decimal type and explicitly sets ROUND_HALF_UP for rounding. Floating-point arithmetic can introduce a one-cent discrepancy over the 24 periods, leaving the calculated loan balance out of agreement with the lender's records.

For each period, the schedule calculates interest on the opening balance, assigns the rest of the payment to principal and reduces the balance by that principal amount. In the first period, 24,000.00 × 0.06 ÷ 12 produces interest of 120.00. The principal portion is 943.69, leaving 23,056.31 outstanding.

The second payment allocates 115.28 to interest and 948.41 to principal, reducing the balance to 22,107.90. The third allocates 110.54 to interest and 953.15 to principal, leaving 21,154.75. Together, the three payments total 3,191.07: 345.82 in interest and 2,845.25 in principal. Subtracting that principal from the original 24,000.00 gives the same remaining balance of 21,154.75.

The last installment is adjusted rather than held to the regular payment amount. It pays off the remaining principal plus the final period's interest, absorbing the small residual created by monthly rounding. ZeraBooks notes that lenders also make this adjustment, so the final payment usually differs slightly from earlier installments.

Recording the split without unbalancing the entry

The journal entry debits the loan account for principal and Interest Expense for interest, then credits the bank account for the payment. If a payment includes an additional fee, the example adds a debit to Bank and Loan Fees and increases the bank credit by the same amount.

An assertion checks that the entry's total debits and credits agree. That catches an implementation error such as adding a fee to the bank credit without recording its corresponding debit. The bank credit must also match the actual withdrawal's amount and date to preserve the bank reconciliation.

Loan origination fees require different treatment from an ordinary payment fee. AccountingTitan explains that US GAAP, under ASC 835-30, requires origination fees to be deferred rather than expensed immediately. They are amortized over the loan's life through an adjustment to interest expense, increasing the effective borrowing cost above the stated rate.

ZeraBooks' month-end workflow

ZeraBooks initially records a loan payment from a bank statement against the loan account. At month end, Autopilot reclassifies that month's interest from the loan account to Interest Expense, using the balance owed multiplied by the annual rate and divided by 12.

If the rate is unknown, Autopilot asks for it; it does not allocate interest using a guessed rate. For an SBA EIDL, it offers 3.75%. Uploaded loan statements provide evidence for the allocation alongside bank statements. Each resulting entry is shown in Done by AI and includes an Undo option, while the calculation itself remains in ledger code.

The offered rate comes from the SBA's COVID-19 Economic Injury Disaster Loan program. According to the U.S. Small Business Administration, small businesses received a fixed 3.75% rate, while private nonprofit organizations received a fixed 2.75% rate. The program had a 30-year term and a maximum loan amount of $2 million.

Payments were deferred for the first two years, but interest continued accruing during that period. There was no prepayment penalty. The SBA stopped accepting new COVID-19 EIDL applications on January 1, 2022.

Year-end classification and interest deductions

The repayment schedule also supports year-end debt classification. BizBooks Pro explains that the principal payable during the next 12 months must be moved out of long-term debt into a Current Portion of Long-Term Debt account at each year end. That classification affects working capital and the current ratio because both use current liabilities, and lenders review those measures.

Tax treatment is a separate question from recording the payment. According to AccountingTitan, business interest is generally deductible, but IRC §163(j) limits the deduction to 30% of adjusted taxable income for businesses with average annual gross receipts above $31 million, the stated 2026 threshold. Businesses at or below that threshold are exempt from the limitation. Disallowed interest can be carried forward indefinitely.

#Interest Rates
← Back to Business

Related news