METERING · FICTIONAL INVOICE INSPECTION

Usage reports: reconcile finalized and deferred records

Follow individual meter records into invoice lines, one credit application and a separate collection/refund ledger.

Fictional rates · 1 CU = 100 minor units

Scroll the ledger diagram horizontally to inspect all three columns. Current totals and ledger events also appear as text below.

Your experiment

Finalize with a short grace window and inspect the later-arriving event. Export the fictional invoice JSON and reconcile meter totals, invoice lines and deferred quantities.

Each observed ledger event takes three inspection seconds. The actual fictional event day is shown on the board. Invoice amounts are frozen at finalization even when later usage arrives.

Finalized invoice lines

LineBillable unitsAmount

Recent ledger events

Offline accounting mechanics with synthetic records and fictional CU rates—not a Stripe integration, Gemini price quote, real invoice, tax calculation or financial advice. Rates are integer minor units per 1,000 metered units. Each usage line and seat proration is rounded to the nearest minor unit, ties away from zero. The period is exactly 30 days; proration uses remaining days. Free input/output allowances are separate. Credits offset the finalized gross once; excess carries forward. Late events never change the finalized invoice; with Issue late records on invoice 2 checked they are billed once on invoice 2, on day 60 plus the grace days, as period 1 usage re-rated against period 1 allowances, and only the difference is charged. Invoice 2 models only that late usage, not period 2 seats or usage, and its collection is outside this run. Retry delays are fixed exponential days and create no new invoice. Refunds are separate entries bounded by collected cash and do not reopen the original invoice in this model. No tax, currency conversion, discounts, disputes, partial payments, provider fees or legal billing requirements are modeled. Metering concepts · Proration concepts.

Every record needs exactly one disposition

A usage report reconciles when every delivered meter record ends in exactly one place. Team A receives 9 deliveries: 8 fixture records plus a redelivered evt-2 on day 12. Three are accepted: evt-1, evt-2 and evt-3 add 3000 input and 600 output units. One duplicate is ignored, one record with negative input is rejected as invalid, and three Team B records are excluded. The last, evt-4, used 1200 input and 250 output units on day 28 but arrives on day 34, after finalization on day 32. 3 + 1 + 1 + 3 + 1 = 9.

Finalized means immutable, late means invoice 2

Invoice 1 is Gross 31.60 CU: 20.00 CU of initial seats, 10.00 CU of seat-change proration, 1.00 CU for 2000 billable input units and 0.60 CU for 400 billable output units. After 3.00 CU of credit and one failed attempt, 28.60 CU is collected. The late record does not reopen it; the trace says evt-4 arrived after finalization and that its 1200 / 250 units are held for a later invoice. With Issue late records on invoice 2 checked, as it opens, invoice 2 closes on day 62 and bills them as period 1 usage: period 1 is re-rated with evt-4 included and only the difference is charged, 0.60 CU for 1200 input units and 0.38 CU for 250 output units, 0.98 CU in all. The result line reads invoice 2 0.98 CU and outstanding 0.98 CU, and the deferred count returns to 0. Clear Issue late records on invoice 2 and the units stay deferred with no invoice ever carrying them, which is the failure this page tests; check it again. To confirm that nothing is lost or billed twice, set Days of grace after day 30 to 10: evt-4 now arrives before the close and the single invoice is 32.58 CU, exactly 31.60 + 0.98. Return Days of grace after day 30 to 2.

Team B and the inclusive cutoff

Set Fixture tenant to Team B. evt-1 (800 input, 100 output units) and evt-2 (2000 and 600) are accepted, 2800 and 700 in total, and six Team A deliveries are excluded. evt-3, 400 input and 80 output units used on day 29, arrives on day 35 and is deferred. Invoice 1 is 31.65 CU and invoice 2 issues evt-3 for 0.32 CU. With Days of grace after day 30 at 4 the cutoff is day 34 and evt-3 is still deferred. At 5 the cutoff is day 35, and a record arriving on the cutoff day is processed before the close: usage becomes 3200 and 780, the single invoice is 31.97 CU (31.65 + 0.32) and no invoice 2 is needed. Longer grace delays every invoice; shorter grace moves more usage to the next one.

Controls that change quantities

Return Fixture tenant to Team A and Days of grace after day 30 to 2. Clear Deduplicate tenant + event ID and evt-2 is billed twice: 4500 input and 900 output units, 32.80 CU; check it again. That checkbox is disabled when Include duplicate event fixture is cleared. Usage quantity multiplier 2 doubles every record, the deferred one now holding 2400 / 500 units; invoice 1 becomes 34.00 CU and invoice 2 1.95 CU. Free input units, Free output units, Input rate and Output rate price accepted units only, and invoice 2 uses the same period 1 allowances and rates.

Seats, collection and playback

The Seats tab holds Include seat subscription, Initial seats, Seats after change, Monthly seat price and Change day, fixed charges independent of metering. With Usage quantity multiplier back at 1, clearing Include seat subscription leaves invoice 1 at 1.60 CU, covered by credit, with no collection attempt; the 1.40 CU of credit left over then covers the 0.98 CU of invoice 2, leaving 0.42 CU. The Collection tab holds Customer credit, First N attempts fail, Maximum collection attempts and Requested refund, which move cash, never usage lines. Playback shows 15 ledger snapshots 3 seconds apart over 42 seconds: finalization at 27, the evt-4 deferral at 36 and invoice 2 at 42. Play and Pause run and hold it; Next ledger event, Restart, Speed, Inspection time and Export fictional invoice JSON support inspection; the trace lists the last 10 events.

Assumptions and limits

This fictional ledger is not an ADK API or a billing provider. Invoice 2 carries only the late period 1 usage; period 2 seats and usage are not modeled, and invoice 2 is issued but not collected in this run. The cutoff uses arrival day, not usage day, and there is no tax, currency or dispute handling.

Views are my own and do not represent any employer, past or present.

Search