Design a Fastag Toll Payment System
Design a low-latency, idempotent toll-payment system for vehicle tags, lane decisions, balances, and reconciliation.
Problem statement
The reported interview prompt was ‘Design FastTag system’ and explicitly discussed APIs, entities, payment idempotency, a Redis cache for frequent vehicle details, and scalability.
For this complete practice scenario, assume an RFID tag identifies a vehicle at a toll lane, the service validates the tag and prepaid account, records at most one charge per passage, returns a lane decision quickly, and supports later settlement and reconciliation.
Treat all numeric load and outage behavior below as practice assumptions.
What to build
- For this practice scenario, an operator can register a vehicle tag and link it to an active toll account.
- For this practice scenario, a toll lane can submit a tag read and receive an allow or deny decision with a reason.
- For this practice scenario, one physical passage creates at most one toll charge even when lane events are retried or duplicated.
- For this practice scenario, account owners can view balance, passage, and charge history.
- For this practice scenario, operators can settle toll revenue and reconcile uncertain or offline passage events.
At scale
- Source fact: payment idempotency, frequently accessed vehicle-detail caching, and scalability were explicit discussion topics.
- Practice assumption: 20 million active tags, 50,000 toll lanes, and peaks of 10,000 passage events per second.
- Practice assumption: the online lane decision should return within 300 ms at p99 when dependencies are healthy.
- Practice assumption: lane devices may retry or send duplicate reads and may buffer events during short network outages.
- Practice assumption: prepaid balance and charge history are durable financial records, while cached vehicle metadata may be briefly stale under a defined policy.