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?
Before drawing anything, ask these:
Taking 2-3 minutes to ask these before touching the whiteboard signals seniority. Junior candidates jump to drawing. Senior candidates clarify.
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.
Your interviewer wants to hear you think about failure:
See system design: payout system for the payout-specific version.
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