Skip to content

kangwa/payments-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Payments System

Build Status License Contributors Issues

A modular payments system designed for merchants to process transactions seamlessly. Inspired by Hyperswitch, this system offers multi-organization support, secure transactions, and an event-driven architecture.

Table of Contents

Features

✅ Multi-merchant support
✅ Secure and encrypted transactions
✅ Event-driven architecture using Kafka/RabbitMQ
✅ Role-based access control (RBAC)
✅ Webhook support for real-time notifications
✅ Multi-currency support
✅ API-first design with REST & GraphQL
✅ Modular architecture for easy extensibility
✅ Built-in audit logging

Tech Stack

  • Backend: Python (FastAPI, SQLModel, SQLAlchemy)
  • Database: PostgreSQL / SQLite (for local development)
  • Message Queue: Kafka / RabbitMQ
  • Authentication: OAuth2, JWT
  • Infrastructure: Docker, Kubernetes
  • Logging & Monitoring: Prometheus, Grafana
  • Frontend: React (for the merchant dashboard)

Installation

Prerequisites

  • Python 3.10+
  • PostgreSQL
  • Docker (optional, for containerized setup)
  • Redis (for caching and queueing)

Setup

  1. Clone the repository:

    git clone https://github.com/your-org/payments-system.git
    cd payments-system
  2. Install dependencies:

    pip install -r requirements.txt
  3. Set up environment variables:

    cp .env.example .env

    Edit .env and provide necessary configurations.

  4. Run the database migrations:

    alembic upgrade head
  5. Start the server:

    uvicorn app.main:app --reload

Usage

To test the API, run:

curl -X GET http://localhost:8000/health

Or access the interactive API docs:

API Reference

Example API endpoints:

Authentication

Login

POST /auth/login

Request Body:

{
  "email": "[email protected]",
  "password": "securepassword"
}

Response:

{
  "access_token": "jwt_token_here",
  "token_type": "bearer"
}

Transactions

Create Transaction

POST /transactions/

Request Body:

{
  "amount": 1000,
  "currency": "USD",
  "merchant_id": "uuid_here",
  "payment_method": "credit_card"
}

Architecture

The system follows a modular, event-driven architecture:

.
├── app/
│   ├── accounts/
│   ├── payments/
│   ├── notifications/
│   ├── transactions/
│   ├── database/
│   ├── common/
│   ├── main.py
├── migrations/
├── tests/
├── Dockerfile
├── README.md

Development

Running Tests

pytest tests/

Linting

flake8 .

Formatting

black .

Contributing

We welcome contributions! Please check out our Contributing Guide.

Roadmap

  • Implement webhook event subscriptions
  • Add support for Apple Pay and Google Pay
  • Enhance fraud detection with ML models

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For questions and support, reach out to:

About

fast api payments service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published