Stripe

Stripe

Starter-SaaS uses Stripe (opens in a new tab) for payment.

.env
STRIPE_API_KEY=""
STRIPE_WEBHOOK_SECRET=""
STRIPE_PRO_MONTHLY_PLAN_ID=""
STRIPE_BASIC_MONTHLY_PLAN_ID=""
STRIPE_REDIRECT="http://localhost:3000/dashboard/billing"

You need to create products from your Stripe dashboard (opens in a new tab).

As soon as your product is created you need to retrieve the price_id, which looks like this price_1OMtbbkuJEyrabcCm1Tjhk.

You must put it in the .env file in the key : STRIPE_BASIC_MONTHLY_PLAN_ID or STRIPE_PRO_MONTHLY_PLAN_ID.

config/subscriptions.ts
export const freePlan: SubscriptionPlan = {
  name: 'Free',
  description:
    'The free plan is limited to 3 posts. Upgrade to the PRO plan for unlimited posts.',
  stripePriceId: '',
};
 
export const basicPlan: SubscriptionPlan = {
  name: 'BASIC',
  description: 'The Basic plan has unlimited posts.',
  stripePriceId: process.env.STRIPE_BASIC_MONTHLY_PLAN_ID || '',
};
 
export const proPlan: SubscriptionPlan = {
  name: 'PRO',
  description: 'The PRO plan has unlimited posts.',
  stripePriceId: process.env.STRIPE_PRO_MONTHLY_PLAN_ID || '',
};