Skip to main content

Architecture

The payment system is built on top of BetterAuth and provides:
  • Unified subscription management
  • Multiple payment provider support
  • Webhook handling
  • Subscription status tracking
  • Customer portal integration

Database Schema

The system uses a unified subscription model that supports both providers:

Available Payment Providers

1. Stripe

2. Polar.sh

Client-Side Integration

The payment system is integrated into the client using BetterAuth:

Server-Side Integration

The server-side implementation uses BetterAuth with both payment providers:

Subscription Management

The system provides a unified interface for managing subscriptions: polar.sh checkout
stripe checkout

UI Components

The boilerplate includes pre-built UI components for:
  • Subscription status display
  • Payment provider selection
  • Checkout flow
  • Customer portal access

Security Considerations

  1. Always use environment variables for sensitive data
  2. Implement proper webhook signature verification
  3. Use authenticated routes for subscription management
  4. Implement proper error handling for failed payments

Next Steps