Understanding Accounts Receivable (A Beancount Guide)
If you run a business that bills clients, you need a rock-solid way to track who owes you money. This is where Accounts Receivable (AR) comes in. It’s more than just a number on a report; it’s the lifeblood of your cash flow.
This guide will walk you through what Accounts Receivable is, why it matters, and how to manage it with precision and clarity using the plain-text accounting system, Beancount.
TL;DR
Accounts receivable (AR) is the money customers owe you for goods or services you’ve already delivered. It’s a current asset on your balance sheet, central to accrual accounting, and a key driver of your business's cash flow. You can track AR cleanly in Beancount by using customer sub-accounts, linking invoices to payments with ^links
, and running a few simple queries. To measure your collection speed, you can calculate AR Turnover and Days Sales Outstanding (DSO). To handle risk, you can use an allowance for doubtful accounts.
What is Accounts Receivable?
Definition Accounts Receivable represents the balance of money due to your firm for goods or services delivered or used but not yet paid for by customers. Under accrual accounting, you recognize this revenue when you earn it, not when you receive the cash. As a result, AR appears as a current asset on your company's balance sheet.
Why It Matters Effectively managing your AR is critical for maintaining healthy liquidity. The faster you collect on your invoices, the shorter your cash conversion cycle—the time it takes to turn your investments in inventory and other resources back into cash. By monitoring metrics like AR Turnover and Days Sales Outstanding (DSO), you can get a clear picture of your collection efficiency and take action to improve it.
Accounts Receivable vs. Accounts Payable (One-Line Refresher)
- AR = money owed to you (it's an asset).
- AP = money you owe to others (it's a liability).
The Accounts Receivable Flow in Double-Entry Accounting
Conceptually, the lifecycle of a receivable follows these steps:
- Issuing an Invoice (Credit Sale): When you send an invoice, you increase your Assets (specifically, Accounts Receivable) and recognize the
Income
you've earned. - Cash Collection: When the customer pays, you increase one asset (your
Assets:Bank
account) and decrease another (Assets:AR
). The net effect on your total assets is zero, but your cash position improves. - Discounts or Credits: If you offer an early-payment discount or issue a credit memo, you reduce the customer's AR balance and offset it with a discount expense or a reduction in revenue (contra-revenue).
- Bad Debts: Unfortunately, not all invoices get paid. To account for this, you can recognize an allowance for doubtful accounts (a contra-asset that reduces your AR's value) and a corresponding bad debt expense. Later, you can write off a specific uncollectible invoice against this allowance.
Modeling AR in Beancount
Beancount is a plain-text, double-entry accounting system that is perfectly suited for tracking AR. Its use of tags
(which start with #
), links
(which start with ^
), and a SQL-like query language (bean-query
) makes your entire AR process transparent, auditable, and scriptable.
Suggested Account Structure
A clean chart of accounts is the foundation. Here’s a recommended structure:
Assets:AR
Assets:AR:Clients:<Name>
Assets:AR:Allowance ; A contra-asset account
Income:Sales
Income:Contra:SalesDiscounts ; An alternative to an expense account
Expenses:SalesDiscounts
Expenses:BadDebt
1. Record a Credit Sale (Issue an Invoice)
When you send an invoice to a client, you record it in your ledger.
2025-07-01 * "Acme Co." "Invoice 2025-045 · Web design" ^INV-2025-045 #ar #client:acme
invoice: "2025-045"
due: "2025-07-31"
document: "/invoices/2025/INV-2025-045.pdf"
Assets:AR:Clients:Acme-Co 1200.00 USD
Income:Sales -1200.00 USD
- The
^INV-2025-045
link is a unique identifier that will tie this invoice to its future payment(s). - The
document:
metadata helps Fava (Beancount's web interface) render a clickable link directly to the invoice PDF.
2. Record Full Payment
When Acme Co. pays the invoice in full, you clear their receivable balance.
2025-07-25 * "Acme Co." "Payment for INV-2025-045" ^INV-2025-045 #ar
Assets:Bank:Checking 1200.00 USD
Assets:AR:Clients:Acme-Co -1200.00 USD
Using the same ^INV-2025-045
link creates a clear audit trail connecting the invoice and the payment.
3. Handling Partial Payments
If a client makes a partial payment, the process is the same. The link keeps everything connected.
2025-07-20 * "Acme Co." "Partial payment INV-2025-045" ^INV-2025-045 #ar
Assets:Bank:Checking 400.00 USD
Assets:AR:Clients:Acme-Co -400.00 USD
A query on ^INV-2025-045
would show the original 400 payment, leaving an $800 balance.
4. Handling an Early-Payment Discount
Let's say you offer a 2% discount on a $1000 invoice if paid early.
2025-07-10 * "Acme Co." "2% early-payment discount on INV-2025-046" ^INV-2025-046 #ar
Assets:Bank:Checking 980.00 USD
Expenses:SalesDiscounts 20.00 USD
Assets:AR:Clients:Acme-Co -1000.00 USD
Here, you clear the full 980 cash received, and book the $20 discount as an expense. Note: Many ledgers treat sales discounts as contra-revenue instead of an expense. Using an expense account is often simpler for smaller ledgers. The key is to choose one method and use it consistently.
5. Including Sales Tax on Invoices
If you collect sales tax, you record it as a liability at the time of invoicing.
2025-07-01 * "Acme Co." "INV-2025-047 · Hardware + tax" ^INV-2025-047 #ar
invoice: "2025-047"
due: "2025-07-31"
Assets:AR:Clients:Acme-Co 1100.00 USD
Income:Sales -1000.00 USD
Liabilities:Tax:Sales -100.00 USD
You've invoiced for 1000 in revenue, and now owe $100 to the tax authority.
6. Handling Bad Debts (Allowance Method)
The allowance method is preferred under Generally Accepted Accounting Principles (GAAP) as it better matches expenses to revenues.
Step 1: Estimate and Create the Allowance (e.g., at Year-End) Based on historical data, you estimate a percentage of your receivables may be uncollectible.
2025-12-31 * "Allowance for doubtful accounts (2% of AR)"
Expenses:BadDebt 300.00 USD
Assets:AR:Allowance -300.00 USD
This creates a contra-asset account (Assets:AR:Allowance
) that reduces the book value of your total receivables.
Step 2: Write Off a Specific Uncollectible Invoice Later When you are certain an invoice will not be paid, you write it off against the allowance.
2026-03-05 * "Write-off INV-2025-049 for Insolvent Client" ^INV-2025-049 #ar
Assets:AR:Allowance 1200.00 USD
Assets:AR:Clients:Insolvent-Client -1200.00 USD
Notice this transaction does not impact your expenses; the expense was already recognized when you created the allowance.
Minimal Reporting & Queries
You can get quick snapshots of your AR using Fava or bean-query
.
Open Receivables by Customer
SELECT account, SUM(position)
WHERE account ~ '^Assets:AR'
GROUP BY account
ORDER BY account;
Journal of AR Activity for a Period
JOURNAL
WHERE account ~ '^Assets:AR'
AND date >= 2025-07-01 AND date < 2025-08-01;
Core AR Metrics (With Quick Formulas)
For these ratios, a practical approach is to use bean-query
to export the necessary numbers (period sales, beginning/ending AR balances) and then perform the calculations in a spreadsheet or a script. This keeps your ledger clean and your math explicit.
AR Turnover Ratio
This measures how many times per period your business collects its average accounts receivable. Higher is better.
DSO (Days Sales Outstanding)
This tells you the average number of days it takes to collect payment after a sale has been made. Lower is better.
Together, these metrics indicate how efficiently you convert invoices into cash.
A Simple Beancount Starter File (Copy/Paste)
; --- Accounts ---------------------------------------------------------------
1970-01-01 open Assets:Bank:Checking USD
1970-01-01 open Assets:AR
1970-01-01 open Assets:AR:Clients:Acme-Co
1970-01-01 open Assets:AR:Allowance
1970-01-01 open Income:Sales
1970-01-01 open Expenses:SalesDiscounts
1970-01-01 open Expenses:BadDebt
1970-01-01 open Liabilities:Tax:Sales USD
; ---------------------------------------------------------------------------
; Example invoice
2025-07-01 * "Acme Co." "Invoice 2025-045 · Web design" ^INV-2025-045 #ar
invoice: "2025-045"
due: "2025-07-31"
document: "/invoices/2025/INV-2025-045.pdf"
Assets:AR:Clients:Acme-Co 1200.00 USD
Income:Sales -1200.00 USD
; Payment received
2025-07-25 * "Acme Co." "Payment INV-2025-045" ^INV-2025-045 #ar
Assets:Bank:Checking 1200.00 USD
Assets:AR:Clients:Acme-Co -1200.00 USD
Operational Tips to Keep AR Healthy
- Set Clear Terms: Include the due date, late fee policies, and any early-payment discount terms on every invoice.
- Link Everything: Use consistent
^INV-...
links to tie invoices, payments, and credit memos together for a clear audit trail. - Attach Documents: Use the
document:
metadata to link to PDFs of invoices, purchase orders, and contracts. - Review Monthly: Check your open AR report at least once a month and follow up on past-due invoices. Watch your AR Turnover and DSO trends to spot problems early.