McTaba Labs logo
Software EngineeringThe WhiteboardProjectsEventsMasterclassesWebinarsLearn
Book Call

500+ developers already in the community

Get answers, find accountability partners, and stay ahead

Join Discord →
McTaba Labs logo

Educating 1 million students in tech by 2030.

Programs

  • HighSchool Graduates Launchpad
  • AI & Business Automation
  • Corporate Training
  • McTaba Story & Mission
  • Full-Stack Curriculum
  • Course Pricing & Plans
  • Frequently Asked Questions

Resources

  • Join Discord Community
  • Tech Events in Nairobi
  • Masterclasses
  • Free Resources
  • Learn
  • Campus
  • Africa Tech Talent Report
  • Partner With Us
  • Start a Project
  • Our Work

Contact Us

  • 124 Manyani East Road, Lavington, Nairobi
  • +254727795603
  • Book a Discovery Call

Office Hours:

Mon-Fri: 9am - 2pm EAT

Sat: 10am - 12pm EAT

© 2027 McTaba Labs - A product of Edtech Industries. All rights reserved.

Privacy PolicyTerms of ServiceRefund Policy
  1. Learn
  2. Paystack for African Developers
  3. System Design Interview: Design a Payment Service
Bonaventure OgetoBy Bonaventure Ogeto|Updated July 22, 2026

System Design Interview: Design a Payment Service

A payment service design: 1) Checkout Service (initializes with gateway, returns auth URL), 2) Webhook Processor (validates HMAC, deduplicates by reference, dispatches to Order Service), 3) Order Service (updates order status, triggers fulfillment), 4) Idempotency Store (Redis or DB unique constraint on reference), 5) Settlement Reconciler (daily job reconciling DB with gateway statements). Key decisions: how do you handle duplicate webhooks? What happens on DB failure during fulfillment? How do you verify a payment if the webhook never arrives?

In this article

  1. 1. Step 1: Clarifying Questions
  2. 2. Step 2: Core Components
  3. 3. Step 3: Failure Modes
  4. 4. Learn More

Step 1: Clarifying Questions

Before drawing anything, ask these:

  • "What countries and payment methods are we supporting?"
  • "What is the expected transaction volume — transactions per second?"
  • "Are we building for a marketplace (split payments) or a direct merchant?"
  • "Do we need recurring/subscription payments or one-time only?"
  • "What are the consistency requirements — can we tolerate eventual consistency or do we need strong consistency for order status?"

Taking 2-3 minutes to ask these before touching the whiteboard signals seniority. Junior candidates jump to drawing. Senior candidates clarify.

Step 2: Core Components

Client Browser
     |
     | POST /checkout/start
     v
Checkout Service ──── POST /transaction/initialize ──→ Paystack API
     |                                                      |
     | returns authorization_url                            | webhook
     |                                                      v
Customer Browser ←── redirect to Paystack checkout    Webhook Receiver
     |                                                      |
     | (after payment) redirect to callback URL             | validate HMAC
     |                                                      | deduplicate on reference
     v                                                      v
Callback Handler                                      Order Service
     |                                                      |
     | GET /transaction/verify/:ref                         | update orders SET status='paid'
     v                                                      | trigger fulfillment
  Paystack API                                              v
                                                      Fulfillment Service
                                                      (email, access grant, etc.)

Key database tables: orders (reference, amount, status, customer_id, created_at, paid_at), webhook_events (event_id, reference, event_type, processed_at) — the second table is your idempotency store.

Get weekly developer tips

Join 25,000+ developers. Practical guides, job tips, and new content — straight to your inbox.

No spam. Unsubscribe anytime.

Step 3: Failure Modes

Your interviewer wants to hear you think about failure:

  • Webhook never arrives — the callback redirect triggers verification. Both paths call the same fulfillment logic through the same idempotency check. Neither path double-fulfills.
  • DB write fails after Paystack confirms — use a database transaction: update order status and insert webhook event in one atomic operation. If the transaction fails, the webhook will be retried by Paystack and succeed on the next attempt (idempotency store is checked first).
  • Duplicate webhooks — insert into webhook_events with a UNIQUE constraint on (reference, event_type). Duplicate insert → constraint violation → return 200 → skip fulfillment.
  • Paystack API is down — checkout initialization fails gracefully with a user-friendly error. No partial orders. Retry from client.

Learn More

See system design: payout system for the payout-specific version.

Sign up for the McTaba newsletter

Key Takeaways

  • ✓Start by clarifying requirements: countries, payment methods, volume, consistency requirements.
  • ✓Separate concerns: checkout initialization, webhook processing, order fulfillment are three separate components.
  • ✓Idempotency is the most important concept — explain it clearly and name the implementation.
  • ✓Design for the failure case: webhook never arrives, DB write fails mid-transaction, gateway returns 5xx.
  • ✓Mention settlement reconciliation — this shows you understand the full payment lifecycle.

Frequently Asked Questions

Should I mention specific Paystack API endpoints in the interview?
Yes, if the company uses Paystack (most Nigerian/East African fintechs do). Naming POST /transaction/initialize, GET /transaction/verify, and HMAC-SHA512 webhook validation shows you know the domain, not just abstract architecture. Generic architecture answers are fine for generic companies; specific answers are better for fintech companies.
How do I handle the question "how does it scale to 1,000 TPS?"
Webhook processor scales horizontally — multiple instances reading from a message queue (SQS, RabbitMQ, or Kafka). Checkout service scales horizontally (stateless). Order service needs careful DB connection pooling. Idempotency store moves from DB UNIQUE constraint to Redis SET NX for higher throughput. Settlement reconciler is a background job — no scaling concern for the real-time path.
How long should this system design answer take?
In a 45-60 minute interview, allocate: 5 minutes for clarifying questions, 10 minutes for component overview, 15 minutes for deep-dive on one or two components (webhook processing and idempotency are good choices), 10 minutes for failure handling, 5 minutes for scale considerations, 5 minutes for questions. Do not rush — interviewers prefer depth over breadth.

Learn Paystack Integration

KES 2,999

The definitive guide to building payment systems with Paystack — from your first transaction to production-grade payment infrastructure across Africa. 9 modules, 47 lessons. Free preview available.

Start Paystack Course

Not ready? Create Free Account

Keep reading

Getting Paid to Build Paystack Integrations

Payment integration is one of the most bankable skills a developer in Africa can carry. This guide covers how to price the work, land clients, ace fintech interviews, and build a career or agency around Paystack.

Read more

Landing Fintech Clients as a Kenyan Developer

Fintech client work in Kenya is available — but it does not come through random job boards. It comes through relationships, visibility in the right communities, and demonstrating that you know the Kenyan payment ecosystem.

Read more

From Frontend Developer to Payments Engineer

A practical transition guide for frontend developers who want to move into payment engineering. Covers the backend skills you need to learn, the payment-specific concepts that matter most, and how to build credibility in fintech.

Read more

Maintaining Client Payment Integrations as Recurring Revenue

Payment integrations break quietly. A webhook stops firing, a settlement account gets flagged, an API update changes a field name. Clients pay for peace of mind that someone is watching. This is your recurring revenue opportunity.

Read more

Build a Restaurant Ordering and Payment App

A complete build guide for a restaurant ordering app that uses Paystack split payments to route money between the restaurant, delivery rider, and your platform. Covers data models, order lifecycle, real-time status tracking, and rider payout via the Transfers API.

Read more

Paystack vs DPO Pay: Engineering Comparison

DPO Pay is the dominant gateway for East and Southern African hospitality, tourism, and e-commerce. Paystack dominates Nigeria and Ghana. If your product serves both, you need both — they do not compete head-to-head in any single market except Kenya.

Read more

Explore related topics

M-Pesa & African Stack

M-Pesa Daraja API tutorials, USSD development, and WhatsApp Business API guides. The African Stack that global bootcamps do not teach.

Learn to Code in Kenya

Everything a Kenyan needs to know before writing their first line of code. Career paths, real costs, hardware requirements, and honest answers about what it takes.

Learning to Code

Roadmaps, language guides, and practical advice for learning to code and launching a programming career.

Breaking Into Tech

Practical, no-nonsense guides for anyone looking to start or change their career in tech. From choosing your first language to acing interviews.

The African Stack: Skills for This Market

The skills that make Kenyan developers hard to replace: M-Pesa, USSD, WhatsApp, fintech, and building for the African market.

Bonaventure Ogeto

Bonaventure Ogeto

Founder, McTaba Labs

Bonaventure is the founder of McTaba Labs, a coding bootcamp in Nairobi, Kenya. He has spent years building products for the African market and mentoring the next generation of developers across the continent.