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 daysfor 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_dateis 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:
-
Subscription Bill Generation (Daily Cron @ midnight)
- System generates
subscription_billrecord - Calculates bill amount based on package
- Sets
due_date=end_date + additional_billing_days(3 days)
- System generates
-
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:
- Online payment via configured gateway
- Manual payment (Super Admin marks as paid)
- 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:
-
Identifies Unpaid Subscriptions
- Checks all bills past their due date
- Finds subscriptions where payment hasn't been received
-
Terminates Current Subscription
- Changes your subscription end date to yesterday
- This effectively ends your active subscription immediately
-
Removes Future Plans
- Deletes any upcoming subscription renewals you may have scheduled
- Removes any addon services scheduled to start
-
Disables Auto-Renewal
- Turns off automatic renewal to prevent future charges
- You'll need to manually renew when ready
-
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:
- School Admin contacts Super Admin or makes payment
- Super Admin creates new subscription package
- School regains access immediately
- 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:
- โ Email notifications before subscription expiry
- โ Push notifications to School Admin mobile app
- โ SMS notifications about upcoming expiry
- โ Email alerts when grace period is active
- โ 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:
- Navigate to: Schools โ Select School โ Delete
- 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:
- Navigate to: Schools โ Trash โ Permanently Delete
- 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
CheckSchoolStatusmiddleware 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_dayssetting - 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โ
| Setting | Value | Location | Impact |
|---|---|---|---|
| Additional Billing Days | 3 days | System Settings โ Subscription | Grace period duration |
| Current Plan Expiry Warning Days | 14 days | System Settings โ Subscription | When dashboard warning appears |
| Trial Days | Configurable | System Settings โ Subscription | Free trial duration for new schools |
| Cron Schedule | Daily (midnight) | Server crontab | Automated processing frequency |
| Auto-Delete Schools | Never | N/A | Schools must be manually deleted |
Default Behaviorโ
| Event | Automatic Action | Manual Action Required |
|---|---|---|
| Subscription expires | Generate bill, start grace period | None (automatic) |
| Grace period expires | Terminate access, disable features | None (automatic) |
| Payment received | Restore access immediately | Payment processing (manual or gateway) |
| School deletion | None | Super Admin must delete manually |
| Notifications | Dashboard warning only | Emails/calls must be sent manually |
Glossaryโ
| Term | Definition |
|---|---|
| Additional Billing Days | Grace period after subscription expires (currently 3 days) |
| Current Plan Expiry Warning Days | Days before expiry when dashboard warning appears (currently 14 days) |
| Grace Period | Time after expiry when school can still access system |
| Extra Billing Status | Boolean indicating if school is within grace period (1) or not (0) |
| Soft Delete | Marking record as deleted without removing from database |
| Force Delete | Permanent removal from database (irreversible) |
| Auto-Renewal | Automatic subscription renewal without manual intervention |
| Subscription Bill | Invoice generated when subscription expires |
| Due Date | end_date + additional_billing_days (payment deadline) |
Related Documentationโ
Changelogโ
| Date | Version | Changes |
|---|---|---|
| 2026-03-27 | 1.0 | Initial 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