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
- Industry standard payment processor
- Comprehensive API and dashboard
- Extensive documentation and support
- Learn more about Stripe setup
2. Polar.sh
- Modern payment platform
- Developer-friendly API
- Built-in subscription management
- Learn more about Polar.sh setup
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
- Always use environment variables for sensitive data
- Implement proper webhook signature verification
- Use authenticated routes for subscription management
- Implement proper error handling for failed payments