Design UPI Payments (PhonePe / Google Pay)

UPI payment app inspired by PhonePe and Google Pay on NPCI's UPI network: a transaction saved as pending under an idempotency key before money moves, switch calls from a queue with timeouts, status served from a cache, UPI ID name lookup, push and SMS notifications, daily reconciliation against NPCI settlement files, and pre-payment risk checks. A teaching design.

Functional requirements

  • Users can pay a UPI ID or a QR code from a linked bank account.
  • Users see the payee's verified name before confirming.
  • Users can check whether a payment succeeded, failed or is pending.
  • Payer and payee are notified when a payment completes.
  • A retried request never debits twice.
  • Every transaction is reconciled against NPCI's settlement records, and stuck payments are reversed automatically.

Non-functional requirements

  • Pay request latency: p99 < 500ms to accept; result within a few seconds.
  • Status check latency: p99 < 100ms.
  • Scale: 200M monthly users, 6K requests/s at peak, with 5x spikes during festival sales.
  • Availability: 99.95%; no payment is ever lost or duplicated.
  • Every transaction is reconciled within one day.

How the design evolves

Stage 1: Call the Switch, Then Save

See why saving a payment only after it completes loses money and double-charges.

What was missing: Nothing yet.

Why that's risky: If the server crashes after the payer's bank debits but before the save, the app has no record of the payment. If the user taps Pay again after a timeout, it's charged twice. Every request holds a thread for the whole bank round trip.

What gets added: One server that calls NPCI's UPI switch for each payment, waits for the answer, then saves the transaction.

Trade-offs: Simple and synchronous, but the database learns about the money last.

Stage 2: Record First, with an Idempotency Key

Make every payment exist before money moves, and make retries safe.

What was missing: A payment existed only after it finished, and retries made new payments.

Why that's risky: The payment service still waits on the bank round trip, and a slow bank ties up its threads. Status checks hit the database directly.

What gets added: The payment service saves each transaction as pending, under the client's idempotency key, before calling the switch. A retry with the same key finds the existing transaction. Status moves forward only (pending to success, failed or deemed) through conditional updates. A status service answers "did it go through?".

Trade-offs: One extra write per payment buys a record of every attempt.

Stage 3: Switch Calls from a Queue, Name Lookup and a Status Cache

Stop slow banks from blocking the app, and answer status and name lookups from memory.

What was missing: Payment requests waited on banks, and every status check read the database.

Why that's risky: Nobody is told when a payment completes, and nothing catches transactions stuck in pending if the switch never answered.

What gets added: The payment service saves the pending transaction, queues it and returns. Switch workers call NPCI with a timeout and record the result in the database and a status cache. The app polls status from the cache. A VPA service resolves a UPI ID or QR code to the payee's verified name from a cache before the user confirms.

Trade-offs: The app shows "processing" for a second or two instead of blocking, which is what UPI apps actually do.

Stage 4: Notifications and Reconciliation

Tell both sides what happened, and make sure every rupee matches NPCI's books by the end of the day.

What was missing: No notifications, and no check that the app's records match the money that actually moved.

Why that's risky: No fraud screening, no per-user limits, and one load balancer in front of everything.

What gets added: Completed and failed payments go onto an events queue. A notification worker sends push and SMS to payer and payee. A reconciliation worker matches every transaction against NPCI's settlement files and resolves anything pending or mismatched with a credit or an automatic reversal, within NPCI's deadlines.

Trade-offs: Reconciliation runs in batches, so a stuck payment can take hours to resolve. That's why UPI apps say "money will be refunded within 48 hours".

Stage 5: Risk Checks, Limits, Redundancy and Monitoring

Block fraud before money moves, and see a failing bank before users flood support.

What was missing: Fraud was found only after money moved, and a bank outage showed up as angry users rather than an alert.

Why that's risky: Remaining risk is low. A bank-wide outage still fails its payments, but the app can warn users before they try.

What gets added: A risk service that scores each payment from recent activity per device, account and payee, and blocks it or asks for extra checks. A rate limiter with per-user daily caps. A second load balancer, a replicated transactions database, and monitoring of success rate per bank, switch timeouts and pending counts.

Trade-offs: Risk scoring adds a few milliseconds to every payment, and a small share of genuine payments get extra checks.

PRISM
System Design Interview
Round 1 of 4 · Architecture Design · 60:00 remaining
PRISM logo
AI Interview
Interview Prep
Interview Challenges
Build & Stress Test NEW
System Architectures
Design & Fix NEW
Interactive Roadmap System Design Guides
Notifications
  • No new notifications
Feedback
Signed in
Send feedback
Phase
Build & Stress Test
Phase 01: Thinking in Systems
Upcoming

Components

User
CDN
Load Balancer
Server
Cache
Database
Blob Storage
Search Index
Queue
Worker
Rate Limiter
Service
API Gateway
Reverse Proxy
WebSocket Server
Third-party API

Inspector

Notes
Use clear names so your design intent is easy to understand.
Good
Name by business meaning
"Order API", "Restaurant Service"
Avoid
Generic names = zero signal
"Server 1", "API", "Queue"
A short description for each component makes feedback much better.
100%
Start by identifying:
  • Users & entry points
  • APIs & services
  • Databases & storage
  • Traffic flow & scale

Round 1 of 4 Architecture Design

Run a simulation to see results.

Time Remaining
60:00
System Design Interview

What are the core functional requirements?
What are the key non-functional constraints?

Questions

Start Evaluation to unlock questions.

EVALUATE MODE

Test yourself like it's the real thing.

A structured 4-module evaluation that mirrors how top companies assess system design candidates.

Architecture Design
Draw your system on the canvas. Define components, connections, and data flow.
FR & NFR Requirements
Answer functional and non-functional requirement questions about your design.
MCQ Round
Multiple choice questions testing your depth on the chosen system.
Tradeoff Analysis
Justify your design decisions and defend your architectural tradeoffs.
AI Report Generated
Choose a Problem
No problem selected
  • 30 min
  • 45 min
  • 60 min
Round 2 of 4
MCQ Round
Answer multiple-choice questions based on your design.

Exit Interview?

You're in the middle of an interview session. Leaving now will end your current attempt.

Your progress will be saved.

Open a saved design

Select a design to load into the canvas.

My Evaluations

Your past evaluation sessions

Here’s a simple request flow that follows the expected layer order.

External User
→
Edge CDN → API Gateway → Load Balancer
→
Compute App Servers / Services
→
DataAccess Cache
→
Storage Database / Search Index
→
Async Queue → Worker

Tip: keep arrows moving forward through layers (Edge → Compute → Storage). Avoid sending storage back to compute.

Evaluation Instructions

Read the rules carefully before starting. The test auto-submits on refresh.

Before you start

  • Build your architecture on the canvas. The timer starts when you click Start Evaluation.
  • Don't forget to answer Functional Requirement and Non Functional Requirements.
  • When satisfied with your design, click Next to lock it and view the questions.
  • Please answer final step questions to complete the evaluation.

Dos

  • Do read each question carefully before answering.
  • Do include required components to maximize component coverage.
  • Do save a copy of your design if you want to keep it before submission.

Don'ts

  • Don't refresh or close the tab during an active evaluation — this will auto-submit your answers.
  • Don't switch app modes or open another tab while the evaluation is running.
  • Don't attempt to edit the design after clicking Next; the workspace will be locked.

All the best!!

Confirm

Input

Notice

Evaluation Report

Evaluation Complete

Generating Your Report

Hang tight — our AI is evaluating your design…

Did you know?

Loading…

Share feedback

Tell us what worked well and what we can improve.

Let's personalize this

Answer a couple of quick questions so we can tailor your journey and missions.

Your welcome gift: of Full PRISM Access

You can change these answers from Mission Control until your missions are done.

Your personalized missions are ready

We tailored these first steps based on your answers.

    PRISM Welcome Gift

    This is a personal welcome gift from PRISM.

    Congratulations.

    You explored PRISM.

    You earned Apprentice.

    As a welcome gift, unlock Full PRISM Access for the configured trial duration.

    This starts Trial. Trial timer begins only after you activate this gift.

    Welcome to PRISM

    We've prepared a personalized Apprentice Journey based on your goals and experience.

    This journey introduces you to the capabilities of PRISM that are most relevant to you.

    Complete all 5 missions to earn your Apprentice title. 5 MISSIONS

    PRISM Surprise Offer

    Complete your Apprentice Journey to unlock a special gift from PRISM.

    • No payment required
    • No credit card required
    • Just complete the journey
    MISSION CONTROL
    0 / 8 missions complete
    NEXT UP Continue your missions
    View full roadmap →
    Mission Complete 0 / 8 Completed Next: Keep going
    SYSTEM BRIEF

    System Constraints

    What the system must do — every item is a user-facing behaviour your architecture must support.

      ↑ Engineering Constraints

      These are the failure modes you must design against — latency SLAs, durability targets, traffic ceilings.

        ⇆ Architecture Constraints

        Core Concepts to Master

        Your Journey
        PHASE – –
        0 / 0 0%
        0
        Mock Interview Checklist

        Pick a topic to start

        Explore concept overviews, real-system examples, key tradeoffs, and interview talking points for each roadmap section.

        Phase Mastered

        You've conquered this phase. These are the skills you now own:

          +500 XP

          Company Interview Paths

          Progress Summary