Skip to content

Latest commit

 

History

40 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PayFlow — Enterprise Payment Processing Platform | FastAPI + PostgreSQL + Kafka

PayFlow is a production-style payment processing backend built with FastAPI, PostgreSQL, and event-driven architecture.

The system demonstrates real-world financial engineering concepts:

  • Idempotent payment processing
  • Transaction consistency and ACID guarantees
  • Retry handling for transient failures
  • Reconciliation workflows
  • Secure authentication
  • Event-driven processing with Kafka
  • Cloud-native deployment patterns

Built to simulate challenges found in modern banking and fintech platforms.

Payment workflow events:

payment.created payment.validated payment.processed payment.settled payment.failed payment.reconciled

The system demonstrates real-world financial engineering concepts:

  • Idempotent payment processing
  • Transaction consistency and ACID guarantees
  • Retry handling for transient failures
  • Reconciliation workflows
  • Secure authentication
  • Event-driven processing with Kafka
  • Cloud-native deployment patterns

Built to simulate challenges found in modern banking and fintech platforms.

Payment workflow events: payments ↓ payment_attempts ← retry/attempt tracking

payments ↓ idempotency_key ← duplicate-payment protection

accounts ↓ transactions ← account transaction history

FastAPI ↓ PostgreSQL/payflow ↓ CRUD/API endpoints ↓ Kafka events ↓ Redis/cache ↓ Celery/background processing


Core Features

Payment Processing

  • POST /initiate-payment → Idempotent payment creation using unique request keys

  • GET /payment-status/{payment_id} → Real-time tracking of transaction state


Reliability & Fault Tolerance

  • Retry mechanism with exponential backoff
  • Safe handling of transient failures
  • Idempotency guarantees to prevent duplicate charges

Reconciliation Engine

  • POST /reconcile → Batch process to detect and fix inconsistent or failed transactions

Security

  • JWT-based authentication
  • Secure password hashing (Passlib)
  • RBAC-ready architecture

Observability

  • Structured logging for traceability
  • Metrics-ready design for monitoring systems

System Architecture

Architecture

Client | v FastAPI API Gateway | v Payment Service | +---- PostgreSQL (ACID Transactions) | +---- Kafka Event Bus | +---- Redis Cache | +---- Celery Workers | +---- Monitoring / Logging

KAFKA

Event-Driven Workflow

Payment lifecycle events:

payment.created | v payment.validated | v payment.processing | v payment.completed

Failure scenarios:

payment.failed payment.retry payment.reconciled

Design Principles:

  • Clean separation of concerns (API → Service → DB)
  • Stateless, scalable API design
  • Transaction-safe operations with rollback support
  • Fault isolation and recovery mechanisms

Key Engineering Highlights

  • Designed idempotent APIs to ensure safe retries
  • Implemented ACID-compliant transactions for financial consistency
  • Built retry logic with exponential backoff for resilience
  • Modeled domain entities: accounts, payments, audit logs
  • Structured backend for horizontal scalability

Tech Stack

  • Backend: Python, FastAPI
  • Database: PostgreSQL
  • Auth: JWT, Passlib
  • Infrastructure: Docker, Docker Compose
  • Cloud Ready: AWS (Lambda, SQS, RDS) / GCP (Cloud Run, Pub/Sub)

Project Structure

backend/
├── api/         # Route handlers
├── core/        # Config, security, utilities
├── models/      # SQLAlchemy models
├── schemas/     # Pydantic schemas
├── services/    # Business logic layer
├── db/          # DB session management
└── main.py

Getting Started

1. Clone the repo

git clone https://github.com/ManibalaSinha/enterprise-transaction-platform.git
cd enterprise-transaction-platform

2. Configure environment

3. Run with Docker

docker-compose up --build

Access:


API Example

Create Payment

POST /initiate-payment
{
  "amount": 100,
  "currency": "USD",
  "idempotency_key": "abc123"
}

Response

{
  "payment_id": "uuid",
  "status": "pending"
}

Scalability & Performance

  • Supports high-throughput transaction systems
  • Designed for horizontal scaling and high-throughput transaction processing.
  • Stateless services enable horizontal scaling
  • Ready for queue-based async processing (SQS / PubSub)

Future Enhancements

  • Stripe webhook integration (real payment gateway)
  • Event-driven architecture (Kafka / PubSub)
  • Rate limiting & throttling
  • Fraud detection layer
  • Admin dashboard & analytics
  • CI/CD with automated testing

This project demonstrates:

  • Real-world payment system design
  • Strong understanding of distributed system challenges
  • Backend expertise in FastAPI + PostgreSQL
  • Production-ready thinking (reliability, consistency, scaling)

a system built for real financial workflows


Author

Manibala Sinha Senior Backend Engineer | Python | FastAPI

GitHub: https://github.com/ManibalaSinha

=======

PayFlow — Enterprise Payment Processing Platform | FastAPI + PostgreSQL + Kafka

PayFlow is a production-style payment processing backend built with FastAPI, PostgreSQL, and event-driven architecture.

The system demonstrates real-world financial engineering concepts:

  • Idempotent payment processing
  • Transaction consistency and ACID guarantees
  • Retry handling for transient failures
  • Reconciliation workflows
  • Secure authentication
  • Event-driven processing with Kafka
  • Cloud-native deployment patterns

Built to simulate challenges found in modern banking and fintech platforms.

Payment workflow events:

payment.created payment.validated payment.processed payment.settled payment.failed payment.reconciled

The system demonstrates real-world financial engineering concepts:

  • Idempotent payment processing
  • Transaction consistency and ACID guarantees
  • Retry handling for transient failures
  • Reconciliation workflows
  • Secure authentication
  • Event-driven processing with Kafka
  • Cloud-native deployment patterns

Built to simulate challenges found in modern banking and fintech platforms.

Payment workflow events: payments ↓ payment_attempts ← retry/attempt tracking

payments ↓ idempotency_key ← duplicate-payment protection

accounts ↓ transactions ← account transaction history

FastAPI ↓ PostgreSQL/payflow ↓ CRUD/API endpoints ↓ Kafka events ↓ Redis/cache ↓ Celery/background processing


Core Features

Payment Processing

  • POST /initiate-payment → Idempotent payment creation using unique request keys

  • GET /payment-status/{payment_id} → Real-time tracking of transaction state


Reliability & Fault Tolerance

  • Retry mechanism with exponential backoff
  • Safe handling of transient failures
  • Idempotency guarantees to prevent duplicate charges

Reconciliation Engine

  • POST /reconcile → Batch process to detect and fix inconsistent or failed transactions

Security

  • JWT-based authentication
  • Secure password hashing (Passlib)
  • RBAC-ready architecture

Observability

  • Structured logging for traceability
  • Metrics-ready design for monitoring systems

System Architecture

Architecture

Client | v FastAPI API Gateway | v Payment Service | +---- PostgreSQL (ACID Transactions) | +---- Kafka Event Bus | +---- Redis Cache | +---- Celery Workers | +---- Monitoring / Logging

KAFKA

Event-Driven Workflow

Payment lifecycle events:

payment.created | v payment.validated | v payment.processing | v payment.completed

Failure scenarios:

payment.failed payment.retry payment.reconciled

Design Principles:

  • Clean separation of concerns (API → Service → DB)
  • Stateless, scalable API design
  • Transaction-safe operations with rollback support
  • Fault isolation and recovery mechanisms

Key Engineering Highlights

  • Designed idempotent APIs to ensure safe retries
  • Implemented ACID-compliant transactions for financial consistency
  • Built retry logic with exponential backoff for resilience
  • Modeled domain entities: accounts, payments, audit logs
  • Structured backend for horizontal scalability

Tech Stack

  • Backend: Python, FastAPI
  • Database: PostgreSQL
  • Auth: JWT, Passlib
  • Infrastructure: Docker, Docker Compose
  • Cloud Ready: AWS (Lambda, SQS, RDS) / GCP (Cloud Run, Pub/Sub)

Project Structure

backend/
├── api/         # Route handlers
├── core/        # Config, security, utilities
├── models/      # SQLAlchemy models
├── schemas/     # Pydantic schemas
├── services/    # Business logic layer
├── db/          # DB session management
└── main.py

Getting Started

1. Clone the repo

git clone https://github.com/ManibalaSinha/enterprise-transaction-platform.git
cd enterprise-transaction-platform

2. Configure environment

3. Run with Docker

docker-compose up --build

Access:


API Example

Create Payment

POST /initiate-payment
{
  "amount": 100,
  "currency": "USD",
  "idempotency_key": "abc123"
}

Response

{
  "payment_id": "uuid",
  "status": "pending"
}

Scalability & Performance

  • Supports high-throughput transaction systems
  • Designed for horizontal scaling and high-throughput transaction processing.
  • Stateless services enable horizontal scaling
  • Ready for queue-based async processing (SQS / PubSub)

Future Enhancements

  • Stripe webhook integration (real payment gateway)
  • Event-driven architecture (Kafka / PubSub)
  • Rate limiting & throttling
  • Fraud detection layer
  • Admin dashboard & analytics
  • CI/CD with automated testing

This project demonstrates:

  • Real-world payment system design
  • Strong understanding of distributed system challenges
  • Backend expertise in FastAPI + PostgreSQL
  • Production-ready thinking (reliability, consistency, scaling)

a system built for real financial workflows


Author

Manibala Sinha Senior Backend Engineer | Python | FastAPI

5bdfaff (payment protected) c0b0d70 (Order)

About

Digital Banking platform with secure authentication, robust API design, and a responsive user interface,Idempotent payment processing Retry logic for transient errors Batch reconciliation of payments PostgreSQL, Cloud deployment-ready (AWS/GCP)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages