SaasCore Docs
  • Get Started
  • Configuration
    • Database
    • Stripe
      • Product ID and Price ID
      • API keys
      • Stripe Webhook
    • Emails
      • Cron Jobs
    • Claudinary
    • Chat plugin
    • Upstash Redis
    • OAuth with Google and GitHub
    • Subscription types and plans
    • Affiliate program
    • Google Analytics Api
  • Landing page
    • Header
    • Hero
      • Discount
      • AvatarCircles
    • Other components
  • Authentication Flow
    • For Admins
    • For Clients
      • OAuth
      • Credentials
    • For Affiliates
  • Payments
    • Payment Flow Scenarios
      • Scenario 1: Registered Client
      • Scenario 2: Direct Subscription from Home Page
      • Upgrading/Downgrading/Canceling Subscriptions
    • Pricing Table
  • Component Protection
  • Pending ...
Powered by GitBook
On this page
  • Code snippet of config file located at lib/Config/main.ts
  • Subscription Types and Stripe Configuration
  • 1. Free Plan
  • 2. Recurring Plan
  • 3. One-time Plan
  1. Configuration

Subscription types and plans

The configuration files of your application is located in lib/config folder.

/auth.config.ts and /auth.ts files are responsible for authentication

Code snippet of config file located at lib/Config/main.ts

export const config: Data = {
  ...,
     plans: [
        {
            name: SubscriptionPlan.STARTER,
            label: "Starter",
            featured: false,
            type: "FREE",
            stripeProductId: null,
            price: {
                value: "$0",
                stripePriceId: null,
            },
            description: "Description of your Starter plan",
            button: {
                label: "Get started for free",
                href: "/auth/sign-up",
            },
            features: {
                available: ["Feature 1", "Feature 2"],
                unavailable: [
                    "Feature 3",
                    "Feature 4",
                    "Feature 5",
                    "Feature 6",
                ],
            },
        },

        {
            name: SubscriptionPlan.PREMIUM,
            label: "Premium",
            type: "RECURRING",
            featured: false,
            stripeProductId: "xxxxxxxxxxxxxxxxxx",
            price: {
                Monthly: {
                    value: "$9",
                    stripePriceId: "xxxxxxxxxxxxxxxxxx",
                },
                Annually: {
                    value: "$90",
                    stripePriceId: "xxxxxxxxxxxxxxxxxx",
                },
            },
            description: "Description of your Premium plan.",
            button: {
                label: "Checkout",
                href: "",
            },
            features: {
                available: ["Feature 1", "Feature 2", "Feature 3", "Feature 4"],
                unavailable: ["Feature 5", "Feature 6"],
            },
        },

        {
            name: SubscriptionPlan.PLUS,
            label: "Plus",
            type: "RECURRING",
            featured: true,
            stripeProductId: "xxxxxxxxxxxxxxxxxx",
            price: {
                Annually: {
                    value: "$190",
                    stripePriceId: "",
                },
                Monthly: {
                    value: "$19",
                    stripePriceId: "",
                },
            },
            button: {
                label: "Checkout",
                href: "",
            },
            description: "Description of your Entreprise plan.",

            features: {
                available: [
                    "Feature 1",
                    "Feature 2",
                    "Feature 3",
                    "Feature 4",
                    "Feature 5",
                    "Feature 6",
                ],
                unavailable: [],
            },
        },

        {
            name: SubscriptionPlan.ENTREPRISE,
            label: "Enterprise",
            type: "ONETIME",
            featured: false,
            stripeProductId: "xxxxxxxxxxxxxxxxxx",
            price: {
                value: "$900",
                stripePriceId: "xxxxxxxxxxxxxxxxxx",
            },

            description: "Description of your Entreprise plan.",
            button: {
                label: "Checkout",
                href: "",
            },
            features: {
                available: [
                    "Feature 1",
                    "Feature 2",
                    "Feature 3",
                    "Feature 4",
                    "Feature 5",
                    "Feature 6",
                ],
                unavailable: [],
            },
        },
    ],
    ...etc
};

Subscription Types and Stripe Configuration

SaasCore offers three subscription types: Free, Recurring, and One-time. Each type has a specific Stripe configuration.

1. Free Plan

The Free plan does not require Stripe integration.

{
  stripeProductId: null,
  price: {
    value: "$0",
    stripePriceId: null,
  }
}

2. Recurring Plan

The Recurring plan offers monthly and annual billing options.

{
  stripeProductId: "prod_Q9IlnhsXwxNtfW",
  price: {
    Monthly: {
      value: "$9",
      stripePriceId: "price_1PJ09dD8PnrtK1gBjgxxxxxx",
    },
    Annually: {
      value: "$90",
      stripePriceId: "price_1PJ0ATD8PnrtK1gB0C6xxxxxx",
    },
  }
}

3. One-time Plan

The One-time plan is a single payment option.

{
  stripeProductId: "prod_Q9IlnhsXwxNtfW",
  price: {
    value: "$900",
    stripePriceId: "price_1PJ0ATD8PnrtK1gBpmxxxxxx",
  }
}

PS: Plan names should be determined at both the config object level and the Prisma schema level.

enum SubscriptionPlan {
  STARTER
  PREMIUM
  ENTREPRISE
  PLUS
}
PreviousOAuth with Google and GitHubNextAffiliate program

Last updated 6 months ago