PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/System Design/Capital One

Validate virtual credit card transactions from encoded IDs

Last updated: Apr 20, 2026

Quick Overview

This question evaluates understanding of virtual credit card product trade-offs and the ability to design data models and deterministic validation logic for encoded transaction attributes, testing competencies in payment systems, data encoding/decoding, and rule-based validation.

  • medium
  • Capital One
  • System Design
  • Machine Learning Engineer

Validate virtual credit card transactions from encoded IDs

Company: Capital One

Role: Machine Learning Engineer

Category: System Design

Difficulty: medium

Interview Round: Onsite

You are designing logic for a **virtual credit card** product. ## Part 1: Product reasoning Explain key benefits and drawbacks of virtual credit cards for: - end users, - the issuer (e.g., a bank). ## Part 2: Transaction validation rules A transaction is described by: - `card_number`: a 16-digit string - `transaction_id`: an 8-digit string - `amount`: integer dollars Certain attributes are encoded in the digits: ### Transaction ID (8 digits, positions counted from left starting at 1) - If the **7th** digit is `1` ⇒ transaction is **online**; if `0` ⇒ **offline/in-person**. - If the **6th** digit is `1` ⇒ type is **charge**; if `0` ⇒ type is **authorization**. ### Card number (16 digits, positions counted from left starting at 1) - If the **15th** digit is `1` ⇒ **merchant-bound**; if `0` ⇒ **not merchant-bound**. - If the **14th** digit is `1` ⇒ network is **Master**; if `0` ⇒ **Visa**. - If the **13th** digit is `1` ⇒ **multi-use**; if `0` ⇒ **one-time-use**. ### Validity rules by network A transaction is valid if it satisfies the rules for its network: **Visa**: valid iff - (`merchant_bound` AND `multi_use`) OR - (`online` AND `amount < 100` AND type is NOT `authorization`) **Master**: valid iff - (`amount < 100` AND (online OR offline) AND NOT `merchant_bound`) OR - (`merchant_bound` AND `amount > 100`) ## Tasks 1. Describe an approach (data model + validation flow) to determine whether a transaction is valid. 2. For the following example, determine whether it is valid: - `card_number = "1234567891011111"` - `transaction_id = "50781100"` - `amount = 150` 3. Explain how you would test this logic (unit tests and edge cases).

Quick Answer: This question evaluates understanding of virtual credit card product trade-offs and the ability to design data models and deterministic validation logic for encoded transaction attributes, testing competencies in payment systems, data encoding/decoding, and rule-based validation.

Related Interview Questions

  • Evaluate credit-limit increase profitability - Capital One (medium)
  • Design a geography-aware virtual card service - Capital One (medium)
  • Design a mobile banking app backend - Capital One (medium)
  • Design a highly reliable account balance system - Capital One (medium)
  • Design a cross-region event processing platform - Capital One (medium)
Capital One logo
Capital One
Dec 15, 2025, 12:00 AM
Machine Learning Engineer
Onsite
System Design
7
0

You are designing logic for a virtual credit card product.

Part 1: Product reasoning

Explain key benefits and drawbacks of virtual credit cards for:

  • end users,
  • the issuer (e.g., a bank).

Part 2: Transaction validation rules

A transaction is described by:

  • card_number : a 16-digit string
  • transaction_id : an 8-digit string
  • amount : integer dollars

Certain attributes are encoded in the digits:

Transaction ID (8 digits, positions counted from left starting at 1)

  • If the 7th digit is 1 ⇒ transaction is online ; if 0 ⇒ offline/in-person .
  • If the 6th digit is 1 ⇒ type is charge ; if 0 ⇒ type is authorization .

Card number (16 digits, positions counted from left starting at 1)

  • If the 15th digit is 1 ⇒ merchant-bound ; if 0 ⇒ not merchant-bound .
  • If the 14th digit is 1 ⇒ network is Master ; if 0 ⇒ Visa .
  • If the 13th digit is 1 ⇒ multi-use ; if 0 ⇒ one-time-use .

Validity rules by network

A transaction is valid if it satisfies the rules for its network:

Visa: valid iff

  • ( merchant_bound AND multi_use ) OR
  • ( online AND amount < 100 AND type is NOT authorization )

Master: valid iff

  • ( amount < 100 AND (online OR offline) AND NOT merchant_bound ) OR
  • ( merchant_bound AND amount > 100 )

Tasks

  1. Describe an approach (data model + validation flow) to determine whether a transaction is valid.
  2. For the following example, determine whether it is valid:
    • card_number = "1234567891011111"
    • transaction_id = "50781100"
    • amount = 150
  3. Explain how you would test this logic (unit tests and edge cases).

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Capital One•More Machine Learning Engineer•Capital One Machine Learning Engineer•Capital One System Design•Machine Learning Engineer System Design
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.