app/worker/invoice_generator.pySchedule: Every hour at
:00 (e.g., 13:00, 14:00, 15:00)
What It Does
- Finds due subscriptions — Queries all
ACTIVEsubscriptions wherecurrent_period_end <= now() - Generates invoices — Creates a
DRAFTinvoice with all line items calculated - Renews subscriptions — Advances the billing period to the next interval
- Prevents duplicates — Checks for existing invoices for the period before creating
The Invoice Calculation
For each subscription:Log Output
Troubleshooting
Invoices not being generated?-
Check the worker is running:
-
Verify subscription
current_period_endis in the past: -
Check for existing invoices for the period (duplicate prevention may be skipping):