Stripe & Payments

The boilerplate provides TWO DISTINCT PAYMENT SYSTEMS to handle different business needs: Better Auth's external checkout for simplicity, and a comprehensive custom checkout system for advanced scenarios.
Important: These are two separate systems with different capabilities. Choose the one that best fits your business requirements.

Two Payment Systems Overview

External Checkout Only
  • Stripe-hosted checkout pages (external redirect)
  • Customer portal for subscription management
  • Authenticated users only
  • Automatic customer & subscription management
  • Zero configuration required
Best for: Simple SaaS with standard subscription needs
Perfect for: Choose Better Auth for simplicity or Custom System for advanced features like guest checkout, installments, coupons, and multiple checkout methods.

System Architecture Comparison

Simple External Flow:
User Login โ†’ Better Auth Plugin โ†’ Stripe External Checkout โ†’ Customer Portal
Features:
  • External Stripe checkout only
  • Stripe customer portal for management
  • Authenticated users required
  • Automatic webhook processing
  • Zero custom checkout code
Limitations:
  • No guest checkout
  • No custom checkout UI
  • No installment payments
  • No coupon integration
System Selection: Better Auth uses external Stripe checkout exclusively, while the Custom System detects checkout type via metadata (source: 'custom_checkout', guest_checkout: 'true') for intelligent routing.

System Components Breakdown

Automatic Integration
  • Better Auth Stripe plugin (src/lib/better-auth/auth.ts)
  • External Stripe checkout (redirect only)
  • Customer portal integration
  • Automatic webhook processing
User Flow:
  1. User must be authenticated
  2. Redirects to Stripe checkout
  3. Returns to success page
  4. Manages subscription via Stripe portal

Quick Setup Guide

1

Configure Stripe Keys

Set up your Stripe environment variables in .env.local:
# Stripe Configuration
STRIPE_SECRET_KEY="sk_test_your_stripe_secret_key"
STRIPE_WEBHOOK_SECRET="whsec_your_webhook_secret"
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_test_your_publishable_key"

# Checkout Method
NEXT_PUBLIC_STRIPE_CHECKOUT_TYPE="EmbededForm"
2

Choose Checkout Method

Select your preferred checkout experience:
  • EmbededForm - Integrated forms (recommended)
  • ExternalForm - Stripe-hosted pages
  • ReactStripeForm - Custom React integration
  • PaymentLink - Simple payment links
3

Configure Plans

Create your subscription plans in the admin panel at /admin/plansSubscription Plans Interface:Stripe subscription plans selection interface
4

Test Payments

Use Stripe test cards to verify your payment flow

Environment Variables

Required Stripe configuration for the payment system:
# Server-side (Required)
STRIPE_SECRET_KEY="sk_test_..." # or sk_live_... for production
STRIPE_WEBHOOK_SECRET="whsec_..." # From Stripe Dashboard

# Client-side (Required)
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_test_..." # or pk_live_...
NEXT_PUBLIC_STRIPE_CHECKOUT_TYPE="EmbededForm" # See checkout methods

# Optional
NEXT_PUBLIC_BILLING_MODE="subscription" # or "oneTime"

System Feature Comparison

๐Ÿ”Œ

Better Auth System

External checkout only

โœ…
Zero configuration setup
โœ…
Automatic customer creation
โœ…
Stripe customer portal
โœ…
Real-time webhook sync
โŒ
Guest checkout support
โŒ
Custom checkout UI
โŒ
Payment installments
โŒ
Coupon integration
๐ŸŽฏ

Custom Boilerplate System

Complete checkout suite

โœ…
4 checkout methods
โœ…
Guest checkout + auto-account
โœ…
Payment installments (split)
โœ…
Coupon code support
โœ…
One-time or subscriptions
โœ…
Multi-seat subscriptions
โœ…
Custom webhook processing
โœ…
Conversion optimization

Which System Should You Choose?

Choose Better Auth System if:
  • You want zero configuration
  • Simple subscription model is sufficient
  • Users can create accounts before purchasing
  • You prefer Stripe-hosted checkout pages
  • You don't need custom checkout flows
Choose Custom Boilerplate System if:
  • You need guest checkout (no account required)
  • You want to optimize conversion rates
  • You need payment installments (BNPL)
  • You want coupon/discount support
  • You need multiple checkout methods
  • You require custom checkout UI/UX
Pro Tip: You can start with Better Auth for simplicity and migrate to the Custom System later if you need advanced features like guest checkout or installments.

Stripe & Payments Topics

Payment system ready! Your application has enterprise-grade payment processing with flexible checkout options and comprehensive subscription management.
    Stripe & Payments | ShipSaaS Documentation | ShipSaaS - Launch your SaaS with AI in days