System Design: Online Donation Platform for a 3-Day Campaign
Context
You are designing a donation platform for a time-bounded, high-traffic, three-day campaign. Users provide minimal personal information and donate arbitrary amounts split across multiple organizations. The platform's payment scope is limited to charging donors and depositing funds into the company’s account. No real-time fund-splitting to organizations is required; allocation is recorded for later internal distribution.
Assume:
-
High burst traffic around campaign marketing pushes.
-
Use of a third-party payment processor (PSP) that supports idempotent charges and webhooks.
-
PCI scope is minimized via tokenization/hosted fields.
Requirements
Design an end-to-end architecture and data model. Address:
-
Synchronous vs asynchronous payment flows; justify when to use async.
-
Detailed async workflow: API layer, idempotency keys, queue, workers, retries with exponential backoff and jitter, dead-letter handling.
-
How to guarantee idempotent charges across network retries.
-
Failure handling, reconciliation/reporting, duplicate submission prevention.
-
Security/PII and payment compliance, rate limiting, observability, and scaling for bursty traffic.
-
API contracts, database schema, and a strategy for partial failures and eventual consistency.