Design a Digital Wallet Service
| Difficulty: Medium | Source: awesome-low-level-design |
Requirements
- Create account, manage personal info
- Add and remove payment methods (credit cards, bank accounts)
- Fund transfers between users and external accounts
- Transaction history and statements
- Multiple currencies, currency conversions
- Security of user info and transactions
- Concurrent transactions
- Scalable
Class Diagram

Classes, Interfaces and Enumerations
| Class/Interface | Description |
|---|---|
| User | id, name, email, password, list of accounts |
| Account | id, user, account number, currency, balance, transactions; deposit/withdraw methods |
| Transaction | id, source account, destination, amount, currency, timestamp |
| PaymentMethod | Abstract base class; extended by CreditCard and BankAccount |
| CreditCard | Concrete payment method for credit card details |
| BankAccount | Concrete payment method for bank account details |
| Currency | Enum for supported currencies |
| CurrencyConverter | Static conversion method for currency exchange |
| DigitalWallet | Singleton; synchronized methods for thread-safe transaction processing |
Design Patterns Used
| Pattern | Application |
|---|---|
| Singleton | DigitalWallet has a single instance managing all users and transactions |
| Abstract Class/Polymorphism | PaymentMethod abstract base with CreditCard and BankAccount subclasses |
Code Implementations
| Language | Source Code |
|---|---|
| Java | View on GitHub |
| Python | View on GitHub |
| C++ | View on GitHub |
| C# | View on GitHub |
| Go | View on GitHub |