Automate subscription lifecycle events using Artisan commands.
This command handles Renewals and Expirations.
php artisan tahsil:process-subscriptions-
Renewals:
- Finds active subscriptions with
auto_renew = truethat expire today. - Generates a new
Pendinginvoice for the renewal. - If a pending invoice already exists, it may cancel the subscription (to prevent double billing/orphaned states) depending on logic.
- Finds active subscriptions with
-
Expirations:
- Finds active subscriptions with
auto_renew = falsethat expire today. - Marks them as
Expired.
- Finds active subscriptions with
Add this to your application's console.php or Isolator schedule to run daily:
$schedule->command('tashil:process-subscriptions')->daily();