Credit Service: Design a Microservice for Managing User Credit Lines and Transactions
Interview Experience
Round 1 System Design
Problem
Design a Credit Service that manages revolving credit lines for users. The service must support: granting/updating credit limits, authorizing charges against available credit, posting payments, and querying current balance and available credit. It must handle concurrent requests safely — two simultaneous charges should not both succeed if they together exceed the limit.
Key operations:
- authorize(user_id, amount) -> approved/declined + auth_code
- capture(auth_code, amount) -> settle a previously authorized charge
- payment(user_id, amount) -> reduce outstanding balance
- get_balance(user_id) -> {limit, used, available, pending_auth}
Follow-ups
- How do you prevent double-spend under concurrent authorizations? Optimistic vs. pessimistic locking tradeoffs?
- Describe your data model — what tables/collections and indexes?
- What happens if a capture comes in after an authorization has expired?
- How do you design for 99.99% uptime when the underlying database has planned maintenance windows?
Full Details
Round 1 System Design
Problem
Design a Credit Service that manages revolving credit lines for users. The service must support: granting/updating credit limits, authorizing charges against available credit, posting payments, and querying current balance and available credit. It must handle concurrent requests safely — two simultaneous charges should not both succeed if they together exceed the limit.
Key operations:
- authorize(user_id, amount) -> approved/declined + auth_code
- capture(auth_code, amount) -> settle a previously authorized charge
- payment(user_id, amount) -> reduce outstanding balance
- get_balance(user_id) -> {limit, used, available, pending_auth}
Follow-ups
- How do you prevent double-spend under concurrent authorizations? Optimistic vs. pessimistic locking tradeoffs?
- Describe your data model — what tables/collections and indexes?
- What happens if a capture comes in after an authorization has expired?
- How do you design for 99.99% uptime when the underlying database has planned maintenance windows?
About This Question
This is a candidate experience report from a clay interview during the phone round.
It covers the following topics: Phone, System Design, Sql, System Design, Onsite .