Back to Portfolio

E-Commerce Payment Processing System

Group Project · Backend Architecture & Security

FastAPIPostgreSQLStripeACIDIdempotency

This repository is private

The Problem

An e-commerce platform needed a secure, reliable payment processing system with proper transaction handling. The system had to handle concurrent orders, prevent double-charging, process webhooks asynchronously, and maintain ACID compliance for all financial operations.

Architecture Decisions

  • Idempotent payment operations — idempotency keys prevent double-charging from retry scenarios.
  • Transaction isolation — serializable isolation level for concurrent order processing.
  • Webhook-based async confirmation — payment gateway webhooks update order status asynchronously.
  • Exponential backoff retry — failed payment attempts retry with increasing delays.

System Design

places (1:N)has (1:N)contains (1:N)can_have (1:N)usersorderspaymentstransactionsrefunds
01
Client

HTTP request originates from the frontend application or external API consumer.

02
API Gateway

Request enters through the gateway which handles routing, rate limiting, and initial validation.

03
Auth Middleware

Authentication and authorization checks. Validates JWT tokens or API keys before proceeding.

04
Service Layer

Business logic execution. Orchestrates use cases and coordinates between components.

Key Technical Highlights

  • ACID compliance for financial operations with serializable isolation
  • Secure transaction handling with automated rollback capabilities
  • Clean API design separating payment concerns from order management
  • Idempotency key enforcement at the database level (UNIQUE constraint)

Results / Impact

Reliable payment processing with zero data loss. The clean separation of payment concerns from order management made the system maintainable and testable. Transaction safety guarantees gave the team confidence to handle peak traffic during sales events.

Have a similar system to build?