feat: add annual billing, free trial, upgrade/downgrade, and ACH invoice support
- Add monthly/annual billing toggle with 25% annual discount on pricing page - Implement 14-day no-card free trial (server-side Stripe subscription creation) - Enable upgrade/downgrade via Stripe Customer Portal - Add admin-initiated ACH/invoice billing for enterprise customers - Add billing card to Settings page with plan info and Manage Billing button - Handle past_due status with read-only grace period access - Add trial ending and trial expired email templates - Add DB migration for billing_interval and collection_method columns - Update ONBOARDING-AND-AUTH.md documentation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
27
db/migrations/017-billing-enhancements.sql
Normal file
27
db/migrations/017-billing-enhancements.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- Migration 017: Billing Enhancements
|
||||
-- Adds support for annual billing, free trials, ACH/invoice billing,
|
||||
-- and past_due grace period status.
|
||||
|
||||
-- ============================================================================
|
||||
-- 1. Add billing_interval column (month or year)
|
||||
-- ============================================================================
|
||||
ALTER TABLE shared.organizations ADD COLUMN IF NOT EXISTS billing_interval VARCHAR(20) DEFAULT 'month';
|
||||
|
||||
-- ============================================================================
|
||||
-- 2. Add collection_method column (charge_automatically or send_invoice)
|
||||
-- ============================================================================
|
||||
ALTER TABLE shared.organizations ADD COLUMN IF NOT EXISTS collection_method VARCHAR(20) DEFAULT 'charge_automatically';
|
||||
|
||||
-- ============================================================================
|
||||
-- 3. Update status CHECK to include 'past_due'
|
||||
-- ============================================================================
|
||||
ALTER TABLE shared.organizations DROP CONSTRAINT IF EXISTS organizations_status_check;
|
||||
ALTER TABLE shared.organizations ADD CONSTRAINT organizations_status_check
|
||||
CHECK (status IN ('active', 'suspended', 'trial', 'archived', 'past_due'));
|
||||
|
||||
-- ============================================================================
|
||||
-- 4. Ensure plan_level CHECK includes SaaS tiers (idempotent with 015)
|
||||
-- ============================================================================
|
||||
ALTER TABLE shared.organizations DROP CONSTRAINT IF EXISTS organizations_plan_level_check;
|
||||
ALTER TABLE shared.organizations ADD CONSTRAINT organizations_plan_level_check
|
||||
CHECK (plan_level IN ('standard', 'premium', 'enterprise', 'starter', 'professional'));
|
||||
Reference in New Issue
Block a user