Skip to main content

Subscription Expiry & School Retention Policy

Overviewโ€‹

This guide explains how the 4SCH system handles subscription expiration, grace periods, notifications, and school data retention. Understanding this workflow is crucial for both Super Admins managing the platform and School Admins managing their subscriptions.


Configuration Settingsโ€‹

System Settings (Super Admin Only)โ€‹

Navigate to: System Settings โ†’ Subscription Settings

1. Additional Billing Days (Grace Period)โ€‹

  • Purpose: Determines how long schools can access the system after subscription expires
  • Current Setting: 3 days
  • Minimum Value: 2 days
  • Recommended: 7-14 days for reasonable grace period
  • Impact: After this period expires, school access is automatically terminated

2. Current Plan Expiry Warning Daysโ€‹

  • Purpose: Controls when expiry warnings appear in the School Admin dashboard
  • Current Setting: 14 days
  • Minimum Value: 2 days
  • Impact: Dashboard warning appears when subscription has โ‰ค14 days remaining

Subscription Lifecycle Timelineโ€‹

Phase 1: Active Subscriptionโ€‹

Status: โœ… Fully Operational

Characteristics:

  • Subscription end_date is in the future
  • All features accessible based on package
  • Users can login and use all subscribed features
  • Dashboard shows remaining days

Database Status:

Subscription: start_date โ‰ค today โ‰ค end_date
School Status: 1 (Active)
User Access: Enabled
Bill Status: Not generated

Phase 2: Expiry Warning Period (14 Days Before Expiry)โ€‹

Status: โš ๏ธ Warning Active

When: 14 days or less until subscription end_date

Warning Display:

  • Appears in School Admin Dashboard only
  • Shows warning banner with days remaining
  • If auto-renewal is enabled, shows upcoming plan details
  • Visual alert to encourage payment before expiry

How It Works:

  • The system automatically checks your subscription status when you login
  • If expiry is within 14 days (or less), a warning banner appears on your dashboard
  • The banner shows how many days remain and payment options

Important Notes:

  • โš ๏ธ NO automatic email notifications are sent during this period
  • โš ๏ธ NO push notifications sent to mobile devices
  • Warning is dashboard-only (visual notification)
  • School remains fully operational

Phase 3: Subscription Expiry Day (Day 0)โ€‹

Status: ๐Ÿ“… Expired - Grace Period Begins

Automated Actions:

  1. Subscription Bill Generation (Daily Cron @ midnight)

    • System generates subscription_bill record
    • Calculates bill amount based on package
    • Sets due_date = end_date + additional_billing_days (3 days)
  2. Grace Period Activation

    • School enters 3-day grace period
    • extra_billing_status = 1 (within grace period)
    • All features remain accessible

What Happens Automatically:

  • The system creates a bill for your subscription renewal
  • Payment due date is set to 3 days after expiry
  • Bill appears in your admin dashboard

User Experience:

  • โœ… School continues operating normally
  • โœ… Teachers/Students can login
  • โœ… All features accessible
  • ๐Ÿ“Š Dashboard may show payment due notice

Server Automation:

  • The system automatically runs daily checks at midnight
  • No manual intervention needed from users
  • Super Admin ensures server is properly configured

Phase 4: Grace Period (Days 1-3 After Expiry)โ€‹

Status: ๐Ÿ•’ Grace Period Active

Duration: 3 days (configurable via Additional Billing Days)

Subscription Status Display:

  • Bill shows: "Unpaid" (before due_date)
  • After due_date passes: "Over Due"

How the System Calculates Grace Period:

  • Your subscription end date + 3 days = grace period deadline
  • During these 3 days, the system considers you "still active"
  • After day 3, grace period expires and access is terminated

School Access:

  • โœ… Full system access maintained
  • โœ… All users can login
  • โœ… All features functional
  • ๐Ÿ’ฐ Payment can be made anytime during grace period

Payment Options During Grace:

  1. Online payment via configured gateway
  2. Manual payment (Super Admin marks as paid)
  3. Auto-renewal (if enabled and next plan configured)

Phase 5: Grace Period Expiry (Day 4 - After Additional Billing Days)โ€‹

Status: โŒ Access Terminated

What the System Does Automatically (at midnight on Day 4):

The system performs these actions without any manual intervention:

  1. Identifies Unpaid Subscriptions

    • Checks all bills past their due date
    • Finds subscriptions where payment hasn't been received
  2. Terminates Current Subscription

    • Changes your subscription end date to yesterday
    • This effectively ends your active subscription immediately
  3. Removes Future Plans

    • Deletes any upcoming subscription renewals you may have scheduled
    • Removes any addon services scheduled to start
  4. Disables Auto-Renewal

    • Turns off automatic renewal to prevent future charges
    • You'll need to manually renew when ready
  5. Updates System Access

    • Removes access to premium features
    • Updates your school's active feature list

User Access Impact:

  • โŒ Students/Teachers: BLOCKED from login
  • โŒ School Admin: May be blocked (if school status changed)
  • ๐Ÿšซ Login attempt shows: "Your account has been deactivated. Please contact admin."

How Access Control Works:

  • The system checks your school's subscription status at every login
  • If subscription is expired (past grace period), login is rejected
  • Users see a clear message explaining their account is deactivated
  • They are instructed to contact the school administrator

Phase 6: Post-Expiry Status (Indefinite)โ€‹

Status: ๐Ÿ’ค Inactive - Awaiting Payment or Action

School Data Status:

  • โœ… School record: EXISTS in database
  • โœ… School database: school_[name] INTACT
  • โœ… All data: PRESERVED (students, teachers, exams, fees, etc.)
  • โœ… Files: RETAINED in storage
  • โณ Duration: Indefinite (no automatic deletion)

Subscription Status:

  • end_date: Set to yesterday (terminated)
  • status: "Bill Not Generated" or "Over Due"
  • extra_billing_status: 0 (grace period expired)

Restoration Process:

  1. School Admin contacts Super Admin or makes payment
  2. Super Admin creates new subscription package
  3. School regains access immediately
  4. All historical data remains intact

Notification System Analysisโ€‹

Current Notification Capabilitiesโ€‹

The 4SCH system includes a robust notification infrastructure:

Push Notificationsโ€‹

  • Available For: Mobile apps (Student/Teacher/Parent apps)
  • Platforms: Android, iOS, and web browsers
  • Current Use: Transportation expiry reminders work perfectly
  • Example: Drivers receive notifications 7 days before their plan expires

Email Notificationsโ€‹

  • System Capability: Email system is fully configured and working
  • Current Use: Various system notifications are sent via email
  • Configuration: Super Admin manages email settings

โš ๏ธ Critical Finding: NO Subscription Expiry Notificationsโ€‹

Current Implementation: โŒ NOT IMPLEMENTED

Despite having the notification infrastructure, the system DOES NOT currently send:

  1. โŒ Email notifications before subscription expiry
  2. โŒ Push notifications to School Admin mobile app
  3. โŒ SMS notifications about upcoming expiry
  4. โŒ Email alerts when grace period is active
  5. โŒ Notifications when access is terminated

Evidence: The system has these scheduled tasks configured:

  • Daily subscription bill generation โœ… Exists
  • Monthly notification cleanup โœ… Exists
  • Daily transportation expiry reminders โœ… Exists
  • โŒ NO subscription expiry reminder task exists

Comparison with Transportation Module:

  • Transportation module: โœ… Sends reminders 7 days before expiry
  • Subscription module: โŒ No similar reminder system

Current Warning Mechanismโ€‹

Only Active Warning: Dashboard Visual Alert

Where: School Admin Dashboard (home page) When: 14 days or less until expiry Type: Visual banner/alert on dashboard Content:

  • Days remaining until expiry
  • Upcoming plan information (if auto-renewal enabled)
  • Payment prompt

Limitation:

  • Requires School Admin to actively login to see warning
  • No proactive outreach to administrators
  • Easy to miss if admin doesn't check dashboard regularly

Data Retention & Deletionโ€‹

Automatic Retention Policyโ€‹

Key Principle: ๐Ÿ”’ Schools are NEVER automatically deleted

Data Preservation:

  • School databases remain intact indefinitely
  • No automatic cleanup of expired schools
  • Data preserved even after years of non-payment
  • Manual intervention required for any deletion

Manual Deletion Processโ€‹

Only Super Admin can delete schools. Two-step process:

Step 1: Soft Delete (Deactivate)โ€‹

Action: Move to "Trash"

Process:

  1. Navigate to: Schools โ†’ Select School โ†’ Delete
  2. System performs these actions:
    • Sets school status to inactive
    • Marks school record as deleted (but keeps it in database)
    • Deactivates the school admin user account

Result:

  • School moved to trash
  • Data still preserved
  • Database still exists
  • Can be restored

Step 2: Permanent Delete (Purge)โ€‹

Action: Complete removal from system

โš ๏ธ WARNING: This action is IRREVERSIBLE

Process:

  1. Navigate to: Schools โ†’ Trash โ†’ Permanently Delete
  2. System performs these IRREVERSIBLE actions:
    • Completely removes the school's database from the server
    • Deletes all uploaded files from storage (photos, documents, etc.)
    • Permanently removes the admin user account

Result:

  • โŒ School database: DESTROYED
  • โŒ All files: DELETED
  • โŒ All data: UNRECOVERABLE
  • โŒ Cannot be restored

Scheduled Tasks (Cron Jobs)โ€‹

Required Server Configurationโ€‹

Critical: Cron job must be configured on server for system to function properly.

Cron Command:

* * * * * cd /your-project-path/ && php artisan schedule:run >> /dev/null 2>&1

Schedule: Every minute (Laravel scheduler determines which tasks to run)

Active Scheduled Tasksโ€‹

1. Subscription Bill Generation & Management (Daily - Midnight)โ€‹

Purpose:

  • Generate bills for expired subscriptions
  • Terminate subscriptions after grace period
  • Handle auto-renewal if configured

Runs: Every day at midnight (00:00)

2. Clean Up Old Notifications (Monthly)โ€‹

Purpose: Removes old notifications to keep the system efficient Runs: Once per month

3. Transportation Expiry Reminders (Daily)โ€‹

Purpose: Sends push notifications to drivers 7 days before their transportation plan expires Runs: Every day

Important Note: A similar reminder system does NOT exist for school subscriptions (this is the gap we identified)


Best Practices & Recommendationsโ€‹

For Super Administratorsโ€‹

1. Grace Period Configurationโ€‹

  • Current: 3 days
  • Recommended: 7-14 days
  • Rationale: Allows schools adequate time for payment processing, especially during weekends/holidays

2. Warning Period Configurationโ€‹

  • Current: 14 days
  • Recommended: Keep at 14-30 days
  • Rationale: Earlier warnings provide more time for renewal planning

3. Regular Monitoringโ€‹

  • Check subscription dashboard weekly
  • Review overdue bills regularly
  • Follow up with schools approaching expiry
  • Monitor trash for old schools needing permanent deletion

4. Communicationโ€‹

  • Manually email schools before expiry (system doesn't do this automatically)
  • Call schools with high outstanding balances
  • Document communication attempts

For School Administratorsโ€‹

1. Dashboard Monitoringโ€‹

  • Login regularly (at least weekly) to check dashboard
  • Monitor subscription status and expiry date
  • Act on warning messages immediately

2. Payment Planningโ€‹

  • Renew before expiry date (avoid grace period)
  • Keep payment methods updated
  • Enable auto-renewal for uninterrupted service

3. Grace Period Awarenessโ€‹

  • Understand you have 3 days after expiry
  • Access terminates on day 4 (users cannot login)
  • Payment can be made anytime to restore access

4. Data Backupโ€‹

  • Export important data regularly
  • Don't rely on indefinite retention
  • Request data export before cancellation

Feature Enhancement Recommendationsโ€‹

๐Ÿš€ Suggested Improvementsโ€‹

Based on the analysis, here are recommended enhancements:

1. Implement Subscription Expiry Reminder Systemโ€‹

What's Needed: A new automated reminder system similar to transportation reminders

Proposed Notification Schedule:

  • 30 days before expiry: First email notification
  • 14 days before expiry: Second email + push notification
  • 7 days before expiry: Third email + push notification
  • 3 days before expiry: Urgent email + push notification
  • 1 day before expiry: Final warning email + push notification

Benefits:

  • Proactive communication with schools
  • Reduces unintentional lapses
  • Improves payment collection
  • Better customer experience

2. Email Template Systemโ€‹

Create Templates For:

  • Subscription expiry warnings (multiple urgency levels)
  • Grace period activation notice
  • Access termination notice
  • Payment confirmation
  • Subscription renewal confirmation

3. In-App Notificationsโ€‹

Add to Dashboard:

  • Countdown timer for expiry
  • Payment history widget
  • Quick renewal button
  • Notification bell icon with reminders

4. Auto-Renewal Improvementsโ€‹

Enhancements:

  • Automatic payment processing (if payment method saved)
  • Retry failed payments
  • Email notifications for auto-renewal status
  • Grace handling for failed auto-renewals

5. Grace Period Notificationsโ€‹

During Grace Period:

  • Daily email reminders
  • Push notifications
  • SMS alerts (if configured)
  • Dashboard banner with countdown

6. Reporting & Analyticsโ€‹

Super Admin Dashboard:

  • Schools expiring in next 7/14/30 days
  • Overdue schools report
  • Revenue forecast based on renewals
  • Churn analysis (schools not renewing)

Troubleshootingโ€‹

Common Issuesโ€‹

1. "Cron job not running"โ€‹

Symptoms: Bills not generated, subscriptions not terminating Solution:

# Verify cron is configured
crontab -l

# Should show:
* * * * * cd /var/www/html/your-project && php artisan schedule:run >> /dev/null 2>&1

# Test manually
cd /var/www/html/your-project
php artisan subscriptionBill:cron

2. "School can still access after grace period"โ€‹

Symptoms: Users can login despite overdue status Solution:

  • Check CheckSchoolStatus middleware is applied
  • Verify school status in database
  • Check subscription end_date value
  • Review cron job execution logs

3. "Warning not showing in dashboard"โ€‹

Symptoms: No expiry warning despite approaching expiry Solution:

  • Verify current_plan_expiry_warning_days setting
  • Check subscription end_date calculation
  • Review dashboard warning settings
  • Clear your browser cache or ask Super Admin to clear system cache

4. "Cannot restore deleted school"โ€‹

Symptoms: Accidentally deleted school Solution:

  • If soft deleted: Use restore function in trash
  • If permanently deleted: NO RECOVERY POSSIBLE
  • Restore from database backup (if available)

Configuration Summaryโ€‹

Current System Configurationโ€‹

SettingValueLocationImpact
Additional Billing Days3 daysSystem Settings โ†’ SubscriptionGrace period duration
Current Plan Expiry Warning Days14 daysSystem Settings โ†’ SubscriptionWhen dashboard warning appears
Trial DaysConfigurableSystem Settings โ†’ SubscriptionFree trial duration for new schools
Cron ScheduleDaily (midnight)Server crontabAutomated processing frequency
Auto-Delete SchoolsNeverN/ASchools must be manually deleted

Default Behaviorโ€‹

EventAutomatic ActionManual Action Required
Subscription expiresGenerate bill, start grace periodNone (automatic)
Grace period expiresTerminate access, disable featuresNone (automatic)
Payment receivedRestore access immediatelyPayment processing (manual or gateway)
School deletionNoneSuper Admin must delete manually
NotificationsDashboard warning onlyEmails/calls must be sent manually

Glossaryโ€‹

TermDefinition
Additional Billing DaysGrace period after subscription expires (currently 3 days)
Current Plan Expiry Warning DaysDays before expiry when dashboard warning appears (currently 14 days)
Grace PeriodTime after expiry when school can still access system
Extra Billing StatusBoolean indicating if school is within grace period (1) or not (0)
Soft DeleteMarking record as deleted without removing from database
Force DeletePermanent removal from database (irreversible)
Auto-RenewalAutomatic subscription renewal without manual intervention
Subscription BillInvoice generated when subscription expires
Due Dateend_date + additional_billing_days (payment deadline)


Changelogโ€‹

DateVersionChanges
2026-03-271.0Initial documentation based on codebase analysis

Document Status: โœ… Complete and Accurate Last Reviewed: March 27, 2026 Configuration Based On: 4SCH v3.x (PHP Laravel Backend) Settings: Additional Billing Days = 3, Warning Days = 14