CUSTOMER CREDITS · LEDGER
Customer credits: offset once and carry the remainder
Apply one service credit across three monthly invoices, crash and re-run a billing job, and check that every dollar of credit is offset exactly once.
Event trace
Computed data
Final metrics
Fictional invoices of $120, $80 and $150 with no tax, currency conversion or proration. A re-run without a receipt regenerates the February invoice from usage and debits the credit again; the regenerated invoice keeps one credit line. Expiry removes the remaining balance at the start of the first month after the validity period. This is a teaching ledger, not accounting or tax advice.
A credit consumed twice
Defaults: Credit granted $300, remainder carried, valid through month 3, each line capped, and the February job crashes and re-runs without a receipt. January offsets $120 (balance $180) and February $80 (balance $100). The re-run regenerates the February invoice and debits the credit again: $80 leaves the balance with no matching offset. March gets only $20 and the customer pays $130: DOUBLE-APPLIED, offset $220, $80 consumed twice.
Offset once with a receipt
Tick Record an application receipt per invoice. The re-run finds the receipt for credit CR-1 on invoice INV-02 and reuses it, so March is offset by $100 and the customer pays $50: OFFSET ONCE, offset $300. Untick February invoice job crashes and is re-run and you get the same result without needing the receipt, because nothing retries. At a $200 credit the balance is empty before the re-run, so the missing receipt does no visible harm; at $400 it costs $80 again (offset $320, $80 consumed twice).
Caps, carry and expiry
Untick Cap each credit line at the invoice total: January takes the whole $300, the invoice goes to −$180 and that amount is refunded to the card as cash: CREDIT PAID OUT AS CASH. Restore the cap and untick Carry the unused remainder: $180 is forfeited after January, REMAINDER LOST. Set Credit valid through month to 1 instead: the same $180 is removed at the start of February, but under the stated terms, so the verdict stays OFFSET ONCE and lists it as expired.
Reading the ledger
The board keeps a bar for each destination of the grant: offset on invoices, remaining balance, consumed without offset, paid out as cash, and forfeited or expired. The final metrics compare offsets with what left the balance; any gap is a defect. The table lists each invoice with usage, credit applied, amount due and the balance after it.
Replay and limits
Any change recomputes the run and rewinds it; the Complete-run preview states the outcome at once. Play and Pause walk through the events, Next event jumps one event, Restart rewinds, Speed runs from 0.25x to 2x and Inspection time seeks from 0 to 60 seconds, where the outcome and final metrics appear. Invoices of $120, $80 and $150 have no tax, proration or currency conversion, and a regenerated invoice keeps one credit line. This is a teaching ledger, not accounting or tax advice.