Skip to content

PayEasy is a comprehensive payment processing system designed to simplify and streamline financial transactions. Built entirely with Python, this project aims to provide a secure, reliable, and user-friendly platform for handling various types of payments.

Notifications You must be signed in to change notification settings

teambits009/PayEasy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

💸 PayEasy - Backend Logic

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.


⚙️ What is PayEasy?

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.


🧩 Key Backend Features

  • 🔐 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)

🏗️ Technical Design

1. Architecture Overview

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)

2. Core Modules

  • 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).

3. Data Flow (e.g., Send Money)

  1. User initiates payment request via /wallet/transfer
  2. Auth middleware validates user token
  3. Request is routed to TransferService
  4. Internal checks (balance, limits, fraud detection)
  5. Transaction is committed to DB
  6. Recipient wallet is credited
  7. Notification is triggered (push/email/SMS)

4. Security Practices

  • HTTPS-only communication
  • Rate limiting on sensitive endpoints (Redis)
  • CSRF protection on public APIs
  • Scoped access tokens for third-party clients
  • Encrypted credentials & secrets

5. Scalability

  • Stateless API (horizontal scaling via Docker + Kubernetes)
  • Async task processing via Celery and Redis
  • Modular microservice-ready architecture

🛠️ Tech Stack

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

📂 Project Structure

/
├── 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

🚀 Getting Started (Local Dev)

Prerequisites

  • Python 3.10+
  • Docker & Docker Compose
  • PostgreSQL (or use Dockerized DB)

Setup

# 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 --build

App will be accessible at: http://localhost:8000


✅ API Endpoints

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


🧪 Testing

# Run tests with pytest
$ pytest

🧠 Design Goals

  • ✨ 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

🗺️ Roadmap

  • Add wallet top-up via virtual account
  • WebSocket-based real-time payment updates
  • Multi-language support
  • Admin dashboard & analytics

📄 License

MIT License. See LICENSE for details.


📬 Contact

About

PayEasy is a comprehensive payment processing system designed to simplify and streamline financial transactions. Built entirely with Python, this project aims to provide a secure, reliable, and user-friendly platform for handling various types of payments.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages