A complete, production-ready SaaS subscription billing system built with Laravel 12, Stripe, and React. This project demonstrates a full-stack implementation of subscription management with both an API-first architecture and an admin dashboard.
Modern landing page with pricing plans, tech stack, and API documentation downloads
Dashboard overview with key metrics and recent activity
Full CRUD interface for subscription plans with Stripe synchronization
View and manage all customer subscriptions
User management with payment history
- Authentication - Register, login, logout with Laravel Sanctum tokens
- Subscription Management - Subscribe, cancel, resume, change plans, and refunds
- Payment Methods - Add, remove, and set default payment methods
- Invoices - View invoice history and download PDFs
- Plans - Browse available subscription plans
- Dashboard Overview - Key metrics and recent activity
- Plan Management - Full CRUD with Stripe sync (products & prices)
- User Management - View users, payment history, and subscription status
- Subscription Management - View, cancel, and refund subscriptions
- Activity Logs - Webhook events and payment logs
- Service layer architecture for clean, testable code
- Real-time Stripe webhook handling
- Automatic Stripe product/price synchronization
- Secure API with Laravel Sanctum
- Modern React frontend with Inertia.js
| Technology | Purpose |
|---|---|
| Laravel 12 | PHP Framework |
| React 18 | Frontend Library |
| Inertia.js | Modern Monolith |
| Laravel Cashier | Stripe Billing |
| Laravel Sanctum | API Authentication |
| Tailwind CSS | Styling |
| MySQL | Database |
| Stripe | Payment Processing |
- PHP 8.2+
- Composer
- Node.js 18+
- MySQL
- Stripe Account (Test Mode)
-
Clone the repository
git clone https://github.com/yourusername/laravel-stripe-saas-billing.git cd laravel-stripe-saas-billing -
Install dependencies
composer install npm install
-
Environment configuration
cp .env.example .env php artisan key:generate
-
Configure your
.envfileDB_DATABASE=your_database DB_USERNAME=your_username DB_PASSWORD=your_password STRIPE_KEY=pk_test_xxxxx STRIPE_SECRET=sk_test_xxxxx STRIPE_WEBHOOK_SECRET=whsec_xxxxx
-
Run migrations and seeders
php artisan migrate php artisan db:seed
-
Build assets and start the server
npm run dev php artisan serve
-
Set up Stripe webhook (for local development)
stripe listen --forward-to localhost:8000/api/v1/webhook/stripe
http://localhost:8000/api/v1
All protected endpoints require a Bearer token:
Authorization: Bearer {your-token}
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /auth/register |
Register new user | No |
| POST | /auth/login |
Login user | No |
| POST | /auth/logout |
Logout user | Yes |
| GET | /auth/me |
Get current user | Yes |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /plans |
List all active plans | No |
| GET | /plans/{id} |
Get plan details | No |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /subscriptions/me |
Get current subscription | Yes |
| POST | /subscriptions |
Create subscription | Yes |
| POST | /subscriptions/cancel |
Cancel subscription | Yes |
| POST | /subscriptions/resume |
Resume subscription | Yes |
| PUT | /subscriptions/change-plan |
Change plan | Yes |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /payment-methods |
List payment methods | Yes |
| POST | /payment-methods |
Add payment method | Yes |
| DELETE | /payment-methods/{id} |
Remove payment method | Yes |
| POST | /payment-methods/set-default |
Set default method | Yes |
| POST | /setup-intent |
Create setup intent | Yes |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /invoices |
List invoices | Yes |
| GET | /invoices/{id} |
Get invoice details | Yes |
| GET | /invoices/{id}/download |
Download invoice PDF | Yes |
Download the complete Postman collection with all endpoints, sample requests, and responses:
Quick Start:
- Import both files into Postman
- Select the environment from the dropdown
- Run the Register or Login request to get your auth token
- The token is automatically saved for subsequent requests
Access the admin dashboard at /admin/login
Email: admin@example.com
Password: password
Dashboard
- Total revenue, active subscriptions, and user counts
- Recent subscription activity
- Quick access to all management sections
Plans Management
- Create, edit, and delete subscription plans
- Automatic Stripe product and price synchronization
- Monthly and yearly pricing support
- Feature list management
Users Management
- View all registered users
- User payment history
- Subscription status overview
Subscriptions Management
- View all subscriptions with status
- Cancel subscriptions
- Issue refunds
Logs
- Webhook event history
- Payment transaction logs
app/
├── Http/
│ ├── Controllers/
│ │ ├── Api/V1/ # API Controllers
│ │ └── Admin/ # Admin Controllers
│ ├── Requests/ # Form Requests
│ └── Resources/ # API Resources
├── Models/ # Eloquent Models
└── Services/ # Business Logic
├── PlanService.php
├── SubscriptionService.php
├── PaymentMethodService.php
└── InvoiceService.php
resources/js/
├── Components/ # Reusable Components
├── Layouts/ # Page Layouts
└── Pages/
├── Admin/ # Admin Pages
└── Welcome.jsx # Landing Page
The application handles the following Stripe webhook events:
invoice.paid- Logs successful paymentsinvoice.payment_failed- Logs failed payment attemptscustomer.subscription.updated- Syncs subscription status changescustomer.subscription.deleted- Handles subscription cancellationscharge.refunded- Logs refund transactions
Use Stripe test card numbers:
- Success:
4242 4242 4242 4242 - Decline:
4000 0000 0000 0002 - Requires Auth:
4000 0025 0000 3155
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open-sourced software licensed under the MIT license.
If you found this project helpful, please consider giving it a star!