Donation Platform
Design a charitable fundraising platform that accepts one-time donations and pays cleared campaign funds to verified nonprofit organizations.
Problem statement
For this exercise, assume verified nonprofit organizations create public fundraising campaigns with a goal and optional end date. Donors browse a campaign and make a one-time donation through an external tokenized payment processor: card details are entered in the processor's client-side form, which returns a token, so the platform never handles card numbers. Only donors whose account and payment method are in the United States may give, and every donation is in U.S. dollars; a modified or outdated client must not be able to create an ineligible charge. The public donation endpoint also draws spam, bots, and card-testing attempts, so automated abuse must be screened before it reaches the payment path. The platform records pending, succeeded, failed, and refunded donations, issues a receipt after confirmed success, and batches cleared net funds into payouts to the organization. One logical donation must be charged at most once despite client retries, delayed or duplicated processor callbacks, timeouts, and out-of-order delivery. A payout must never exceed cleared successful donations minus refunds and amounts already paid. Assume 100,000 active campaigns, five million registered donors, peaks of 10,000 campaign-page reads and 2,000 donation attempts per second, 300 ms p95 campaign-read latency, and 500 ms p95 donation-command acceptance excluding asynchronous processor completion. Retain the financial journal for seven years. Recurring giving, peer-to-peer transfers, reward crowdfunding, matching programs, donor-advised funds, tax-law determination, and fraud-model design are outside scope.
For this exercise, you may choose a simpler integration without webhooks. In that variant, assume the processor supports authenticated status lookup using a stable operation identity, including an idempotency key when the creation response is lost.
Responses and status queries may be delayed or repeated, so an unresolved charge remains pending until its outcome is confirmed. State whether your design uses callbacks or status queries; either choice must preserve the same donation, refund and payout guarantees.
The workload, financial lifecycle and recovery scenarios above remain practice assumptions, rather than requirements for every interview discussion.
What to build
- A verified nonprofit organization can create and manage a public fundraising campaign with a goal and optional end date.
- A donor can browse a campaign and view its descriptive details plus an approximately current total raised.
- A donor in the United States can idempotently submit one one-time donation in U.S. dollars, observe its durable outcome, and receive a receipt after confirmed success.
- The platform can batch cleared net donations into auditable payouts that never exceed the organization's eligible balance.
At scale
- For this exercise, assume 100,000 active campaigns and five million registered donors.
- For this exercise, support peaks of 10,000 campaign-page reads and 2,000 donation attempts per second.
- For this exercise, target 300 milliseconds p95 for campaign reads and 500 milliseconds p95 for accepted donation commands, excluding asynchronous processor completion.
- For this exercise, retain an immutable financial journal for seven years and never pay out more than cleared net donations.