Skip to content

Commit 1e2e7a1

Browse files
committed
Add Razorpay payment integration - PR ready with minimal changes
1 parent 721552c commit 1e2e7a1

File tree

1 file changed

+60
-27
lines changed

1 file changed

+60
-27
lines changed

README.md

Lines changed: 60 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,9 @@
1-
# Full Stack FastAPI Payment Template
1+
# Full Stack FastAPI Template
22

33
<a href="https://github.com/fastapi/full-stack-fastapi-template/actions?query=workflow%3ATest" target="_blank"><img src="https://github.com/fastapi/full-stack-fastapi-template/workflows/Test/badge.svg" alt="Test"></a>
44
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/full-stack-fastapi-template" target="_blank"><img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/full-stack-fastapi-template.svg" alt="Coverage"></a>
55

6-
This repository is a fork of the official Full Stack FastAPI Template with a focused goal: to provide a production-ready starting point that adds payments and billing capabilities to the original template.
7-
8-
Goal: extend the upstream template with common payment patterns (one-time payments, subscriptions, invoices, webhook handling, and example frontend flows) so teams can bootstrap apps that require monetization without wiring payments from scratch.
9-
10-
This project remains compatible with the parent template and intends to track upstream improvements where possible. Parent (upstream) repository: https://github.com/fastapi/full-stack-fastapi-template
11-
12-
## Progress / Features in development
13-
14-
The sections below list the main payment-related features being added to this fork. Items marked with a checkbox indicate progress; this list will be kept up-to-date as work advances.
15-
16-
- [x] Repository fork and integration tests (keep upstream compatibility)
17-
- [x] Example Stripe integration (checkout session, client/server flow)
18-
- [ ] Webhook handlers with secure signature verification
19-
- [ ] Subscription models and billing webhooks (plans, trials)
20-
- [ ] Invoice generation and management endpoints
21-
- [ ] Frontend payment UI components (checkout, billing settings, invoices)
22-
- [ ] End-to-end tests for payment flows (Playwright)
23-
- [ ] Example environment configuration and deployment notes for production payments
24-
25-
If you'd like to contribute or request a specific payment provider or feature, open an issue or submit a pull request.
6+
A modern, full-stack FastAPI template with React frontend, authentication, and payment gateway integration.
267

278
## Technology Stack and Features
289

@@ -44,30 +25,35 @@ If you'd like to contribute or request a specific payment provider or feature, o
4425
- 📞 [Traefik](https://traefik.io) as a reverse proxy / load balancer.
4526
- 🚢 Deployment instructions using Docker Compose, including how to set up a frontend Traefik proxy to handle automatic HTTPS certificates.
4627
- 🏭 CI (continuous integration) and CD (continuous deployment) based on GitHub Actions.
28+
- 💳 **Payment Gateway Integration** with Razorpay for one-time payments, webhook handling, and payment analytics.
4729

4830
### Dashboard Login
4931

50-
[![API docs](img/login.png)](https://github.com/fastapi/full-stack-fastapi-template)
32+
[![Login](img/login.png)](https://github.com/fastapi/full-stack-fastapi-template)
5133

5234
### Dashboard - Admin
5335

54-
[![API docs](img/dashboard.png)](https://github.com/fastapi/full-stack-fastapi-template)
36+
[![Dashboard](img/dashboard.png)](https://github.com/fastapi/full-stack-fastapi-template)
5537

5638
### Dashboard - Create User
5739

58-
[![API docs](img/dashboard-create.png)](https://github.com/fastapi/full-stack-fastapi-template)
40+
[![Create User](img/dashboard-create.png)](https://github.com/fastapi/full-stack-fastapi-template)
5941

6042
### Dashboard - Items
6143

62-
[![API docs](img/dashboard-items.png)](https://github.com/fastapi/full-stack-fastapi-template)
44+
[![Items](img/dashboard-items.png)](https://github.com/fastapi/full-stack-fastapi-template)
6345

6446
### Dashboard - User Settings
6547

66-
[![API docs](img/dashboard-user-settings.png)](https://github.com/fastapi/full-stack-fastapi-template)
48+
[![User Settings](img/dashboard-user-settings.png)](https://github.com/fastapi/full-stack-fastapi-template)
6749

6850
### Dashboard - Dark Mode
6951

70-
[![API docs](img/dashboard-dark.png)](https://github.com/fastapi/full-stack-fastapi-template)
52+
[![Dark Mode](img/dashboard-dark.png)](https://github.com/fastapi/full-stack-fastapi-template)
53+
54+
### Payment Checkout
55+
56+
[![Payment Checkout](img/checkout.png)](https://github.com/fastapi/full-stack-fastapi-template)
7157

7258
### Interactive API Documentation
7359

@@ -161,6 +147,53 @@ You can (and should) pass these as environment variables from secrets.
161147

162148
Read the [deployment.md](./deployment.md) docs for more details.
163149

150+
## Payment Integration (Razorpay)
151+
152+
This template now includes Razorpay payment gateway integration for accepting one-time payments.
153+
154+
### Setup
155+
156+
1. **Create Razorpay Account**: Sign up at [https://dashboard.razorpay.com/signup](https://dashboard.razorpay.com/signup)
157+
2. **Get API Keys**: Navigate to Settings → API Keys in Razorpay Dashboard
158+
3. **Configure Environment Variables**: Add to `.env`:
159+
```bash
160+
RAZORPAY_KEY_ID=rzp_test_xxxxxxxxxxxxx
161+
RAZORPAY_KEY_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxx
162+
RAZORPAY_WEBHOOK_SECRET=your_webhook_secret_here # Optional for production
163+
```
164+
165+
### Features
166+
167+
- **Order Creation**: Backend creates Razorpay orders and saves to database
168+
- **Payment Verification**: Secure signature verification for payment confirmation
169+
- **Webhook Handling**: Real-time payment status updates via webhooks
170+
- **Frontend Integration**: React components for checkout, success, and failure pages
171+
- **Payment Analytics**: Dashboard showing payment history and statistics
172+
- **Database Models**: Order and Payment models with proper relationships
173+
174+
### API Endpoints
175+
176+
- `POST /api/v1/payments/create-order` - Create payment order (requires auth)
177+
- `POST /api/v1/payments/verify` - Verify payment signature (requires auth)
178+
- `POST /api/v1/payments/webhook` - Razorpay webhook handler (public, signature verified)
179+
- `GET /api/v1/payments/orders` - List user orders (requires auth)
180+
- `GET /api/v1/payments/orders/{order_id}` - Get order details (requires auth)
181+
182+
### Database Schema
183+
184+
New tables added:
185+
- `order` - Stores payment orders with Razorpay order IDs
186+
- `payment` - Stores payment records linked to orders
187+
188+
Migrations are handled automatically via Alembic. See [backend/README.md](./backend/README.md#database-migrations-with-alembic) for details.
189+
190+
### Documentation
191+
192+
For detailed setup and configuration:
193+
- Payment API details: [backend/README.md](./backend/README.md#payment-api-endpoints)
194+
- Database migrations: [backend/README.md](./backend/README.md#database-migrations-with-alembic)
195+
- Development guide: [development.md](./development.md)
196+
164197
### Generate Secret Keys
165198

166199
Some environment variables in the `.env` file have a default value of `changethis`.

0 commit comments

Comments
 (0)