Design a system to automatically generate PDF invoices
after the user completes the payment.
About this question
Category
System Design
Subcategory
Asynchronous & Communication
Difficulty
Easy
Est. time
35 min
What this question helps you practice
This system design prompt focuses on asynchronous work triggered by a payment event. A strong answer should avoid slowing down checkout, generate invoices reliably, store immutable documents, and handle retries, duplicates, and delivery failures.
How to practice
Define trigger and SLA
Clarify when an invoice is required, expected generation time, compliance needs, and delivery channels.
Design the async pipeline
Use payment event, queue, invoice service, PDF renderer, storage, and notification worker.
Handle edge cases
Cover duplicate events, failed rendering, retries, versioning, refunds, and user access.
Strong answer signals
Keeps payment completion fast by moving invoice generation to background processing.
Uses idempotency keys and immutable invoice records to prevent duplicate financial documents.
Includes observability, retry policy, and manual recovery for failed invoices.
Common mistakes
Generating the PDF synchronously inside the payment request path.
Ignoring duplicate payment webhooks or retry storms.
Treating invoices as editable files instead of auditable financial records.
Ready to try it?
Practice your answer in the interactive workspace.
Keep practicing
Explore frameworks and related prompts that build the same interview muscle.
