← Questions

Design a basic credit card system

0
AmazonOO designLast asked Oct 2025

An object-oriented design interview question asked in Amazon's technical phone screen, last asked Oct 2025. It tests object-oriented design and payments.

Design the classes of a basic credit card system. A customer has an account with a credit limit and one or more cards. Cards make purchases, which are authorized against the available credit; the customer makes payments, which lower the balance. The system records every transaction and can report the balance.

Requirements

  • Functional: open an account with a credit limit; issue cards on it; authorize or decline a purchase; record purchases, payments and refunds; report the balance and available credit; block a lost card.
  • Non-functional: balances always exact (no floating point for money); every change recorded so the balance can be rebuilt from the transactions; easy to add features such as statements, interest, fees and rewards later.

Clarifying questions

  • One card per account, or several cards sharing one limit?
  • Can a payment exceed the balance, giving a credit balance?
  • Is authorization separate from settlement (a hold first, the charge later)?
  • What validation is needed: expiry date, card status, merchant category limits?

What a strong answer covers

  • Classes and responsibilities: Customer, Account (limit, balance, transactions), Card (number, expiry, status, belongs to an account), Transaction (type, amount, time, card, merchant), and a service such as AuthorizationService that decides approve or decline.
  • The purchase flow: validate the card (active, not expired), check amount <= limit - balance, record the transaction and update the balance in one step; a declined purchase recorded with its reason.
  • Money as integer cents or a decimal type; transactions append-only, with reversals and refunds as new transactions rather than edits.
  • State changes guarded against concurrent purchases on the same account.
  • Extension points: statements built from transactions by period, rewards and fees as rules applied to transactions, so new features do not change Account.

Follow-ups

  • Add monthly statements with a minimum payment and interest on the unpaid balance.
  • Add a rewards program with different rates per merchant category.
  • Two purchases on the same account arrive at the same moment. How do you make sure the limit holds?

Where it's asked

  • Amazon · Technical phone screen · Last asked Oct 202560 min · Live coding in a shared editor that does not run code, plus Leadership Principles questions · No AI

What it tests

object-oriented design · payments

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing