ARCA & EPG Payment Proxy API
A unified backend proxy for seamless ARCA and EPG payment integrations.
A high-performance proxy API built with FastAPI that acts as an intermediary between merchants and Armenian payment systems (ARCA and EPG). It ensures secure transaction registrations, refunds, order tracking, and P2P transfers.
Technology stack
Problem
Handling multiple payment gateways caused massive code duplication. Furthermore, simultaneously processing JSON and form data led to unhandled HTTP stream consumption bugs, resulting in 500 Internal Server errors under load.
Solution
Implemented a unified HTTP client using Factory and Strategy design patterns. Developed a smart FastAPI dependency to automatically and safely extract JSON or form data without exhausting the request stream, ensuring robust data parsing.
Technical contribution
Refactored the core API clients to completely eliminate duplicated logic (DRY). Wrote generalized decorators and dependencies for merchant validation. Resolved critical request stream bugs and implemented reliable upstream error handling.
Architecture
An async-first architecture utilizing FastAPI, SQLAlchemy (AsyncSession), and HTTPX for non-blocking outbound requests, decoupled via a clean service layer pattern.
Performance considerations
Asynchronous external requests via HTTPX heavily reduce I/O latency, while optimized request body caching ensures the API can handle high-throughput traffic without memory leaks.
Security considerations
Enforces strict merchant credential validation and password encryption. Upstream API failures and firewall timeouts are gracefully caught, preventing sensitive data leakage and returning standardized error JSON responses.
Deployment model
Fully containerized using Docker and Docker Compose, making it extremely easy to deploy and integrate into any existing microservice ecosystem.
Outcome
Delivered a highly scalable, bug-free proxy service that drastically reduces onboarding time for new merchants, allowing them to connect to Armenian payment gateways through a single, clean API.