Add subscription billing with plans, upgrades, downgrades, and lifecycle management
Adds complete subscription billing with Stripe integration, plan management, and customer portal.
/plugin marketplace add vanman2024/ai-dev-marketplace/plugin install payments@ai-dev-marketplace[subscription-type]šØ EXECUTION NOTICE FOR CLAUDE
When you invoke this command via SlashCommand, the system returns THESE INSTRUCTIONS below.
YOU are the executor. This is NOT an autonomous subprocess.
Immediately after SlashCommand returns, start executing Phase 0, then Phase 1, etc.
See @CLAUDE.md section "SlashCommand Execution - YOU Are The Executor" for detailed explanation.
CRITICAL: All generated files must follow security rules:
@docs/security/SECURITY-RULES.md
Key requirements:
Arguments: $ARGUMENTS
Goal: Add complete subscription billing system with Stripe integration, plan management, and customer portal
Phase 1: Discovery and Planning
Actions:
Phase 2: Stripe Product Setup
Actions: Task(description="Configure Stripe products and pricing", subagent_type="payments:subscription-manager-agent", prompt="You are the subscription-manager-agent. Set up Stripe subscription products and pricing for $ARGUMENTS subscription type.
SECURITY CRITICAL: Use placeholders for ALL Stripe keys. Never include actual API keys. Create .env.example with placeholder keys only.
Create config/stripe-products.json with 3 tiers (Starter, Professional, Enterprise) including name, description, monthly price, trial days, and feature list.
Create scripts/setup-stripe-products script (js or py based on detected framework) to read config and create products in Stripe using API.
Add to .env.example: STRIPE_SECRET_KEY, STRIPE_PUBLISHABLE_KEY, STRIPE_WEBHOOK_SECRET with placeholder values.
Update .gitignore to protect .env files.")
Phase 3: Database Schema
Actions: Task(description="Create subscription database schema", subagent_type="payments:payments-architect", prompt="You are the payments-architect agent. Create database schema for subscription management.
Tables needed:
subscriptions: id, user_id, stripe_customer_id, stripe_subscription_id, stripe_price_id, status (active/canceled/past_due/trialing/incomplete), current_period_start, current_period_end, cancel_at_period_end, trial_end, created_at, updated_at
subscription_items: id, subscription_id, stripe_subscription_item_id, stripe_price_id, quantity, created_at
invoices: id, user_id, subscription_id, stripe_invoice_id, amount_paid, currency, status (paid/open/void/uncollectible), invoice_pdf, created_at
Create migration file based on detected database (Supabase SQL, Alembic for Python, Prisma for Node.js).
Add indexes on user_id, stripe_customer_id, stripe_subscription_id, and status.")
Phase 4: Backend API
Actions: Task(description="Build subscription API endpoints", subagent_type="payments:subscription-manager-agent", prompt="You are the subscription-manager-agent. Build backend API endpoints for subscription management.
SECURITY: Read Stripe keys from environment variables only. Validate webhook signatures. Never expose secret keys to frontend.
Create endpoints:
Implement based on detected framework (FastAPI with Pydantic, Express with middleware, or Next.js API routes).
Include error handling and logging.")
Phase 5: Frontend Components
Actions: Task(description="Build subscription UI components", subagent_type="payments:subscription-manager-agent", prompt="You are the subscription-manager-agent. Build frontend components for subscription management.
SECURITY: Use Stripe publishable key only (safe for frontend). Load from environment variable.
Create components:
Use Stripe Elements for payment. Handle loading and error states. Responsive with Tailwind CSS.
Framework-specific: Next.js App Router with server components, React hooks, or Vue Composition API.")
Phase 6: Customer Portal
Actions: Task(description="Integrate Stripe Customer Portal", subagent_type="payments:subscription-manager-agent", prompt="You are the subscription-manager-agent. Integrate Stripe Customer Portal for self-service management.
SECURITY: Create portal sessions server-side only. Validate user authentication. Use secret key server-side only.
Create POST /api/subscriptions/portal endpoint that creates Stripe billing portal session and returns URL.
Add Manage Billing button in account settings that calls portal endpoint and redirects user.
Create docs/stripe-portal-setup.md with instructions for configuring portal in Stripe Dashboard (enable payment methods, invoices, subscription cancellation, set branding).")
Phase 7: Testing
Actions:
Phase 8: Documentation
Actions:
Update TodoWrite: Mark all phases complete