A one-stop backend service powering PayEasy, a fast, secure, and seamless payment system that allows users to make payments as easily as sending a message. This repository contains the server-side logic that handles user authentication, transaction processing, wallet management, and third-party integrations.
PayEasy is a simple, intuitive payment solution that enables:
- Instant money transfers between users
- QR code and link-based payments
- Wallet funding via bank or card
- Payment request handling
- Merchant checkout integrations
Backend features are optimized for real-time performance, data security, and extensibility.
- 🔐 Secure user authentication & JWT token management
- 🏦 Multi-wallet system with transaction history
- ⚡ Instant P2P payments and payment requests
- 🧾 Webhook-ready merchant API
- 🧠 Fraud detection & rate limiting
- 🔁 Integration with payment providers (e.g., Stripe, Paystack)
- 📈 Analytics and reporting module (optional)
Client App (Mobile/Web)
↓
FastAPI Backend (REST API)
↓
Business Logic Layer (Services)
↓
Database (PostgreSQL) Payment Providers (e.g. Stripe)
↓ ↓
Redis (Queue for async jobs, rate limits)
- Auth Module: OAuth2 & JWT-based user authentication.
- Wallet Module: Multi-wallet support with balance tracking, transaction logs.
- Transaction Engine: Handles validations, debits/credits, rollback on failure.
- Payout Processor: Sends funds to bank or card via external payment APIs.
- Webhook Listener: Accepts callbacks from payment gateways for status updates.
- Background Jobs: Celery workers process scheduled/async tasks (e.g. email, retry payments).
- User initiates payment request via
/wallet/transfer - Auth middleware validates user token
- Request is routed to
TransferService - Internal checks (balance, limits, fraud detection)
- Transaction is committed to DB
- Recipient wallet is credited
- Notification is triggered (push/email/SMS)
- HTTPS-only communication
- Rate limiting on sensitive endpoints (Redis)
- CSRF protection on public APIs
- Scoped access tokens for third-party clients
- Encrypted credentials & secrets
- Stateless API (horizontal scaling via Docker + Kubernetes)
- Async task processing via Celery and Redis
- Modular microservice-ready architecture
| Layer | Tech |
|---|---|
| Language | Python 3.10+ |
| Framework | FastAPI |
| Database | PostgreSQL |
| ORM | SQLAlchemy |
| Auth | JWT, OAuth2 |
| Messaging | Celery + Redis (async tasks) |
| Payments | Stripe, Paystack (pluggable SDK) |
| Deployment | Docker, Uvicorn, NGINX |
/
├── app/
│ ├── api/ # API route handlers
│ ├── core/ # Auth, config, constants
│ ├── models/ # SQLAlchemy models
│ ├── services/ # Business logic (payments, wallets, etc.)
│ ├── schemas/ # Pydantic request/response schemas
│ └── utils/ # Utility functions and integrations
├── tests/ # Unit and integration tests
├── alembic/ # Database migrations
├── docker/ # Docker configs
├── .env.example # Environment variables template
├── Dockerfile # App Dockerfile
├── requirements.txt # Python dependencies
└── main.py # App entrypoint- Python 3.10+
- Docker & Docker Compose
- PostgreSQL (or use Dockerized DB)
# Clone the repo
$ git clone https://github.com/your-org/payeasy-backend.git
$ cd payeasy-backend
# Copy environment file and update config
$ cp .env.example .env
# Run the project
$ docker-compose up --buildApp will be accessible at: http://localhost:8000
| Endpoint | Method | Description |
|---|---|---|
/auth/login |
POST | User login and token issue |
/wallet |
GET | Get wallet balance and info |
/wallet/transfer |
POST | Send funds to another user |
/payment/request |
POST | Generate a payment request link |
/checkout/{merchant_id} |
POST | Process payment for merchants |
Interactive API docs available at http://localhost:8000/docs
# Run tests with pytest
$ pytest- ✨ Simplicity: Clean code, intuitive API design, readable service layer
- 🔒 Security: Strong encryption, secure token flows, third-party audits
- ⚙️ Modularity: Easily pluggable with new payment providers or services
- 🌍 Accessibility: Mobile-first, RESTful API, clear docs
- Add wallet top-up via virtual account
- WebSocket-based real-time payment updates
- Multi-language support
- Admin dashboard & analytics
MIT License. See LICENSE for details.