https://github.com/dev-vivekkumarverma/payment_integration
This is a simple fast api app for payment integration
https://github.com/dev-vivekkumarverma/payment_integration
docker docker-compose fastapi payment-gateway payment-integration python3 sqlite3 upi upi-integration upi-payment
Last synced: 2 months ago
JSON representation
This is a simple fast api app for payment integration
- Host: GitHub
- URL: https://github.com/dev-vivekkumarverma/payment_integration
- Owner: dev-vivekkumarverma
- Created: 2025-04-01T06:18:41.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-04-01T06:25:44.000Z (6 months ago)
- Last Synced: 2025-04-01T07:30:11.030Z (6 months ago)
- Topics: docker, docker-compose, fastapi, payment-gateway, payment-integration, python3, sqlite3, upi, upi-integration, upi-payment
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Payment Integration
---
# FastAPI Razorpay Donation System
---
## π Project Overview
This project is a **donation system** built using **FastAPI, HTML, CSS, JavaScript, and Razorpay** for payment processing. It allows users to donate to an organization and processes the payment via Razorpay.### Features:
- Collects **Name, Email, Phone Number, and Donation Amount** from users.
- Uses **Razorpay** to handle secure online payments.
- **FastAPI** backend to create orders and verify payments.
- **Dockerized setup** with Nginx as a reverse proxy.---
## ποΈ Project Structure
```
fastapi-razorpay-donation/
βββ backend/
β βββ main.py # FastAPI application (handles payment)
β βββ database.py # SQLite3 database setup
β βββ models.py # ORM Models
β βββ schemas.py # Pydantic models
β βββ services.py # Razorpay integration
β βββ utils.py # Helper functions
β βββ .env # Environment variables (to be created manually)
β βββ requirements.txt # Backend dependencies
β
βββ frontend/
β βββ index.html # Main donation page
β βββ donation.js # Handles form submission and Razorpay checkout
β βββ styles.css # Styling
β βββ nginx.conf # Nginx configuration
β βββ Dockerfile # Dockerfile for frontend
β
βββ docker-compose.yml # Defines services (backend, frontend, nginx)
βββ README.md # Documentation
```---
## π οΈ Setup Instructions
### 1οΈβ£ Prerequisites
- **Docker & Docker Compose** installed
- **Razorpay Account** (for API keys)
- **Git** installed (optional but recommended)### 2οΈβ£ Clone the Repository
```sh
git clone https://github.com/yourusername/fastapi-razorpay-donation.git
cd fastapi-razorpay-donation
```### 3οΈβ£ Create and Configure the `.env` File
Inside the `backend/` directory, create a `.env` file with the following content:
```
DATABASE_URL=sqlite:///data/db.sqlite3
RAZORPAY_KEY=your_razorpay_key_here
RAZORPAY_SECRET=your_razorpay_secret_here
```
πΉ **Replace placeholders** with actual values.Also change the your host IP adderss in `donation.js` :
```js
const response = await fetch("http://192.168.29.154:8000/create_payment/", { // replace this `http://192.168.29.154:8000` with your host of backend running machine```
---## π Running the Project (Dockerized)
1οΈβ£ **Build & Run Containers**
```sh
docker-compose up --build
```
2οΈβ£ **Access the App**
- Open **`http://localhost`** in your browser.
- Click the **Donate** button.
- Complete the Razorpay checkout process.---
## βΉοΈ Stopping the Containers
To stop the running containers, use:
```sh
docker-compose down
```
This will shut down and remove all running containers.---
## β Expected Behavior
- Clicking **Donate** opens the Razorpay checkout.
- If **payment is successful**, user sees a thank-you message.
- If **payment fails**, an alert is shown prompting retry.---
## β Troubleshooting
- **If Razorpay modal doesnβt appear:**
- Check browser console for errors.
- Verify backend is running (`docker ps` should show `backend` container running).
- **If API requests fail:**
- Ensure `nginx.conf` correctly proxies `/create-order` to `backend:8000`.---
## π§ Support
If you face any issues, feel free to open an issue in the repository.*This is just for tech demonstration purpose