How Subscription Billing and Chargify Integration Works
Source: autosoft-workshop/app/controllers/application_controller.rb, sessions_controller.rb, subscriptions_controller.rb
- Subscription status is validated on every single request — if status is not active, trialing, or pending_cancellation, the user is blocked
- An emergency shutdown flag exists that bypasses the Chargify subscription check entirely — used for Chargify outages
- On login, feature flags are synced from Chargify to the local database (has_workshop, has_dealership, has_inspections, etc.)
- Downgrading subscription causes loss of reserved stock and autoinspect features on the next login — data is not deleted but features become inaccessible
- "Pending cancellation" means the subscription is still active but cancel_at_end_of_period is set — full access continues until the billing period ends
- Creating a new user triggers a Chargify metered billing component update — the company is charged for the additional seat
- Deactivating a user reduces the metered billing count; reactivating adds it back — billing adjusts with user changes
- Generating a public booking API key requires the user to be an admin AND the company to be on the Platinum subscription tier
- On company creation, default counter numbers are initialized: invoices start at 50000, credits at 10000, and other document types have similar defaults
Support scenarios
- "I can't access anything, it says my subscription is inactive" → subscription status in Chargify is not active/trialing/pending_cancellation
- "Features disappeared after we changed our plan" → downgrade removed feature flags; they'll vanish on next login
- "We cancelled but it still works" → pending cancellation keeps access until end of billing period
- "Our bill went up when we added a user" → Chargify metered billing automatically increased
- "Can't generate API key" → user must be admin AND company must be on Platinum tier
- "Invoice numbers start at 50000" → that's the default counter set on company creation