NextFire main logoNextFire
Docs X
Introduction
Get Started
Clone repo
Run the app
Configuration
Firebase
Create firebase app
Authentication
Firestore
Storage
Functions
Global configuration
Public
Site config
Payments
Stripe
One time
Subscriptions
Webhooks
Usage
Project structure
Static pages
Public pages
Protected pages
Auth
Client auth
Server auth
Data fetching
Firestore client
Firestore admin
Functions
Storage
Content
Blog
Documentation
Components
Markdown
Cards
Diagrams
Filetree
Lists
Maths
Notes
Steps
Table
Tabs
Public
Deep
Deeper
Even deeper
  1. Payments
  2. More
  3. Subscriptions

Subscription Payments

Guide to set up recurring subscription payments in your SaaS starter boilerplate using Stripe.

Subscription Payments

This guide explains how to configure recurring subscription payments in your SaaS using Stripe. Subscriptions are ideal for SaaS plans such as Pro and Business that charge users on a recurring basis (monthly or yearly).

1

Create Subscription Products in Stripe

  1. Log in to your Stripe Dashboard.
  2. Navigate to Products and click Add Product.
  3. Create two products:
    • Pro
    • Business
  4. For each product, create two prices:
    • Monthly: recurring every month
    • Yearly: recurring every year
  5. Save each price to generate a Price ID in Stripe. Example:
    • price_1ProMonthlyXXX
    • price_1ProYearlyXXX
    • price_1BusinessMonthlyXXX
    • price_1BusinessYearlyXXX
2

Configure Environment Variables

Copy the generated Price IDs from Stripe and add them to your .env.local file:

NEXT_PUBLIC_STRIPE_PRO_MONTHLY_PLAN_ID=price_1ProMonthlyXXX
NEXT_PUBLIC_STRIPE_PRO_YEARLY_PLAN_ID=price_1ProYearlyXXX
NEXT_PUBLIC_STRIPE_BUSINESS_MONTHLY_PLAN_ID=price_1BusinessMonthlyXXX
NEXT_PUBLIC_STRIPE_BUSINESS_YEARLY_PLAN_ID=price_1BusinessYearlyXXX

These variables allow to correctly reference each plan and billing interval.

3

Include SubscriptionsPricingSection in Landing Page

To display subscription options on your landing page, import and include the SubscriptionsPricingSection component in:

app/(public)/(landing)/page.tsx

Example usage:

import { SubscriptionsPricingSection } from "@/components/landing/SubscriptionsPricingSection"

export default function LandingPage() {
  return (
    <>
      {/* Other landing sections */}
      <SubscriptionsPricingSection />
    </>
  )
}

The component automatically pulls your environment variables to render pricing and checkout buttons for all plans and intervals.

4

Subscription Behavior

  • Cancellation: When a user cancels a subscription, it remains active until the next billing period (next month for monthly, next year for yearly).
  • Downgrades: If a user downgrades from a higher plan to a lower plan, the change also takes effect in the next billing period.
  • Upgrades: When a user upgrades a subscription plan, the change takes effect immediately and billing is adjusted pro-rata by Stripe.
5

Configure Stripe Customer Portal

To allow users to manage their subscriptions (upgrade, downgrade, or cancel) directly:

  1. Go to Stripe Dashboard → Customer Portal.
  2. Enable the portal and configure which actions customers can take:
    • Update payment methods
    • Upgrade or downgrade subscription plans
    • Cancel subscription (effective next billing period)
  3. Integrate your app with the Customer Portal session by generating a session server-side and redirecting users to the portal.

This ensures your customers can self-manage subscriptions without manual intervention.

Tips

  • Always test subscriptions in Stripe test mode before going live.
  • Ensure all Price IDs in .env.local match the products and intervals in Stripe.
  • Customize the SubscriptionsPricingSection UI to match your branding and layout.
  • Use the Stripe Customer Portal to simplify subscription management and reduce support overhead.
One timeWebhooks

On this page

Tips

Content

FeedbackEdit page

© 2025 Ship IT.

Rubix Studios logo