Skip to content

Customer debt and store credit

A customer account in Fexl Lite has two sides. They can owe you (debt, posted to Accounts Receivable), you can owe them (store credit, posted to a liability account), or — surprisingly often — both at once. The UI always shows you the net; the journal keeps the two sides separate so the books balance even when a single customer is mid-cycle on both.

Customer Detail — Financial Summary card on the right with Total Sales / Total Paid / Outstanding Debt and a Pay Debt button, plus a per-invoice Debt Breakdown table below
Updated 4 May 2026·For v1.6.100·5 min read

The two columns: debt and credit

Two persistent fields drive every customer balance you see in the app. They are independent — neither one ever resolves the other automatically.

How debt accumulates

Three flows increase balance and post a debit to AR (1100).

  • Partial payments at POS — checkout type partial with paid < total. The unpaid amount lands on amountOwed for the new invoice.
  • Pay-later sales — checkout type partial with paid = 0. The customer walks out; the full total sits on the tab. See Pay Later & COD.
  • Opening balance — a number you set when creating a migrated customer to represent debt they already owed before they were entered into Fexl. It behaves identically to invoice debt for settlement and statements.

Debt is tied to specific invoices via amountOwed — that’s how the AR Aging report ages it correctly. Opening balance ages from the customer’s createdAt.

How credit accumulates

Three flows increase creditBalance and post a credit to Customer Credits (2100), a liability account.

  • Credit refunds from the return wizard — picking Store credit as the refund destination on Step 5 of the refund wizard writes a type='credit' transaction tied to the return.
  • Overpayments — when a customer hands over more than their debt, the excess can be parked as credit instead of given back as cash.
  • Manual credit additions — admin-driven adjustments (rare; usually goodwill).

Credit is not tied to a specific invoice. Once it’s on the account, it’s a single pool of value the customer can spend, withdraw, or apply against future debt.

Settling

Three operations move money out of the customer’s two columns. They live on the customer detail page.

  • Pay debt — customer hands over cash/card against their tab. Allocates payment to invoices oldest-first (FIFO) on amountOwed, then to openingBalance if anything remains. Posts DR cash sub-account / CR 1100. See Pay debt.
  • Withdraw credit — customer takes credit out as cash. Decreases creditBalance by writing a type='withdrawal' transaction; posts DR 2100 / CR cash sub-account. Caps at creditBalance — can’t go negative. See Withdraw credit.
  • Apply credit on a new sale — at POS, when a customer with usableCredit > 0 is attached to the cart, Store credit appears as a payment method in checkout. The applied amount writes a type='usage' transaction.

Mixed debt and credit at once

A customer can carry debt and credit simultaneously, and that is not a bug. It happens when a customer with an open tab returns an item for store credit, or when a credit-refund customer rings a new pay-later sale before spending their credit.

Journal-entry summary

Every change to either column posts a paired entry. Account codes here match the seeded chart of accounts (see Chart of accounts).

  • New debt (sale, partial paid) — DR 1100 AR, CR 4010 Revenue (with VAT and shipping splits as applicable).
  • Debt payment — DR cash sub-account (1010-xxx), CR 1100 AR.
  • Refund applied to debt (refund wizard, debt deduction) — DR 4020 Sales Returns, CR 1100 AR.
  • New credit (refund as store credit) — DR 4020 Sales Returns, CR 2100 Customer Credits.
  • Credit withdrawal — DR 2100 Customer Credits, CR cash sub-account (1010-xxx).
  • Credit applied to new sale — DR 2100 Customer Credits (in lieu of cash), CR 4010 Revenue.