Subscription — Overview
Subscription handles long-term enrollment and recurring billing: customers enroll in a "package" (subscription), the system creates period-based billing schedules, issues invoices, and manages class booking, add-ons, and discounts per period.
Quick picture
Think of a learning center selling a "term package":
- Admin creates a Subscription (package): name, price, schedule, booking conditions.
- Customer / admin enrolls a student → creates an Enrollment.
- System builds a BillingSchedule (billing periods, each with an amount).
- On schedule, each period creates an Invoice; admin can schedule / approve / skip.
- During the process: add add-ons, apply discounts per period; optionally skip a period.
Two Subscription types
| Type | Subscription.TypeId | Meaning |
|---|---|---|
| BookingAndBilling (default) | null/0 | Books class places and collects money; requires SubscriptionProduct (Program) setup. |
| BillingOnly | 1 | Recurring billing only; skips booking-product validation, hides Program section. |
Main "objects"
| Name | One sentence |
|---|---|
| Subscription | Package/template: price, schedule, booking conditions. |
| Enrollment | Runtime enrollment, with Submitted→Approved→Confirmed lifecycle. |
| BillingSchedule | Period-based billing schedule; canonical source for booking period selection. |
| Invoice | Invoice per period, with financial status lifecycle. |
| Add-on / Discount | Extra service / discount applied per booked period. |
| Term | Academic period; subscription links to term. |
Suggested reading order
- End-user view — what admin and customer do.
- Core concepts — Subscription vs Enrollment, billing, booking.
- Architecture & data — tables and relationships.
- Codebase flow — API, service, validation.
- Data & read/write tables — what Term is, tables by flow.
- Common cases — skip, add-on, double-booking, etc.