D
Docs
Documentation Subscription System

Subscription System

The SprintKit includes a comprehensive subscription management system built on top of Stripe, providing flexible billing, plan management, and organization-level subscriptions.

Overview

The subscription system is designed around organization-based subscriptions, where each organization can have its own subscription plan. This enables multi-tenant SaaS applications where different organizations can subscribe to different tiers of service.

Key Features

  • Multi-tier subscription plans with monthly and annual billing
  • Stripe integration for secure payment processing
  • Organization-scoped subscriptions for multi-tenancy
  • Flexible plan configuration with customizable limits and features
  • Trial periods and promotional pricing support
  • Webhook-driven subscription lifecycle management
  • Permission-based access control for subscription management
  • Comprehensive API for subscription operations

Architecture

The subscription system consists of several key components:

Database Schema

  • subscription_plans - Global subscription plan definitions
  • subscription - Individual subscription instances linked to organizations
  • Stripe integration - External payment processing and subscription management

Core Services

  • subscriptionService - Core business logic for subscription operations
  • stripeService - Stripe API integration and webhook handling
  • Permission system - Access control for subscription operations

API Endpoints

The system provides REST APIs for:

  • Creating and managing subscription plans
  • Organization subscription management
  • Stripe checkout session creation
  • Billing portal access
  • Webhook event processing

Subscription Plans

Subscription plans define the available tiers of service with:

  • Plan identification (name, display name, description)
  • Pricing structure (monthly/annual rates)
  • Feature lists (what's included in each plan)
  • Usage limits (seats, storage, API calls, projects)
  • Trial periods and promotional flags
  • Stripe price IDs for payment processing

Default Plans

The system comes with three pre-configured plans:

  1. Starter - Basic plan for small teams
  2. Pro - Advanced plan for growing businesses (marked as popular)
  3. Enterprise - Full-featured plan for large organizations

Subscription Lifecycle

  1. Plan Selection - User chooses a subscription plan
  2. Checkout - Stripe checkout session creation
  3. Payment - Stripe processes payment
  4. Webhook Processing - System receives Stripe events
  5. Subscription Activation - Database updated with subscription details
  6. Ongoing Management - Renewals, upgrades, cancellations

Integration Points

Stripe Integration

  • Products and Prices - Stripe entities for billing
  • Checkout Sessions - Secure payment collection
  • Webhooks - Real-time subscription updates
  • Customer Portal - Self-service billing management

Organization System

  • Scoped Subscriptions - Each organization has its own subscription
  • Permission Control - Role-based access to subscription features
  • Usage Tracking - Monitor plan limits and usage

Next Steps