Dev.to WebDev 🛠 Dev 👁 0 📖 1 min read

Prepaid session packages: why 'money received' and 'sessions owed' need separate ledgers

Session & Package Control — PAID $19 one-time, FREE demo: https://gettidycents.com/product/session-package-control Trainers, tutors, studios and therapists sell packages: 10 sessions paid up front. The trap is treating

Session & Package Control — PAID $19 one-time, FREE demo: https://gettidycents.com/product/session-package-control

Trainers, tutors, studios and therapists sell packages: 10 sessions paid up front. The trap is treating the payment as income you have earned. Until the sessions are delivered, part of that money is a promise you still owe.

Two ledgers, one package

const pkg = {
  client: 'C-27', sessions: 10, priceCents: 90000,
  paidOn: '2026-10-01', expiresOn: '2027-01-01',
  frozenDays: 0,
  events: [ // attended | late_cancel | cancelled_ok | no_show
    { on: '2026-10-03', type: 'attended' },
    { on: '2026-10-10', type: 'late_cancel' },
  ]
};

const COUNTS = { attended: 1, late_cancel: 1, no_show: 1, cancelled_ok: 0 };

function used(p)      { return p.events.reduce((n, e) => n + COUNTS[e.type], 0); }
function left(p)      { return p.sessions - used(p); }
// value of sessions still owed, in cents, rounded down per session
function owedCents(p) { return Math.floor(p.priceCents / p.sessions) * left(p); }

Here 2 of 10 sessions are used (a late cancel counts by the rule), 8 are left, and $720.00 is still owed in service even though $900.00 is in the bank.

Rules belong in data, not in code branches

Whether a late cancel counts, how long a freeze extends expiry, what happens at expiry: put them in a rules object per package type, so a statement can show the rule that was applied.

Freeze extends expiry

expiresOn + frozenDays — computed at read time, so unfreezing never needs a migration.

The tool adds attendance, renewals and client statements on top. Tidy Cents makes tools for running your business: 170+ tools, 30+ of them free. No AI guesses: every result shows its working.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.