AfriPay — Multi-provider payment gateway for Africa (.NET 9)
# AfriPay — Payment Processing Platform for Africa
> A production-grade, multi-provider payment gateway built with .NET 9, DDD, and CQRS — designed for the African fintech ecosystem.
---
## Table of Contents
- Overview
- Key Features
- Architecture
- Layered Architecture
- Domain Model
- Infrastructure
- Payment Flows
- Payment Lifecycle
- Refund Flow
- KYB State Machine
- Webhook Outbox Pattern
- API Reference
- Tech Stack
- Getting Started
- Prerequisites
- Local Setup
- Docker Compose
- Configuration
- Deployment
- CI/CD Pipeline
- Infrastructure Diagram
- Monitoring & Observability
- Security
- Testing
- Project Structure
---
## Overview
**AfriPay** is a comprehensive payment processing API targeting the African market. It abstracts multiple payment providers (MTN MoMo, PayPal, Stripe, Wave) behind a unified interface, enabling merchants to accept payments in multiple currencies with a single integration.
Built with enterprise patterns — Clean Architecture, Domain-Driven Design, CQRS via MediatR, and the Outbox Pattern — AfriPay handles the full payment lifecycle: initiation, provider routing, status tracking, refunds, chargebacks, payouts, KYB compliance, and real-time webhook delivery.
---
## Key Features
| Category | Features |
|---|---|
| **Payments** | Multi-provider routing, idempotent initiation, status tracking, cancellation |
| **Refunds** | Full & partial refunds, reason codes, ledger reconciliation |
| **KYB/Compliance** | Document upload, 7-step review workflow, admin approval |
| **Balance** | Per-currency merchant balance ledger, settlement jobs |
| **Payouts** | Manual & scheduled payouts, bank/wallet destinations |
| **Subscriptions** | Recurring billing plans, automatic renewal, failure handling |
| **Disputes** | Chargeback opening, evidence submission, win/loss resolution |
| **Webhooks** | Guaranteed delivery via outbox pattern, HMAC-SHA256 signatures, exponential backoff retry |
| **Analytics** | Sales summaries, payout anal …