Parse and Enrich Imported Card Data
Updated
Problem statement
Stripe merchants can import active card data from another payment processor. You are given two valid CSV strings.
cardsCsvhas headercustomer_id,card_id,first_name,last_name,card_number,expiration. The expiration usesMYYorMMYY, with a two-digit year in the 21st century.usersCsvhas headercustomer_id,email.
For each card row, combine the non-empty first and last names with one space, split the expiration into an unpadded month and a four-digit year, and attach the matching user's email.
Return CSV rows beginning with customer_id,card_id,email,cardholder_name,card_number,exp_month,exp_year. Preserve card input order.
Function
parseAndEnrichCardData(cardsCsv: String, usersCsv: String) → String[]Examples
Example 1
cardsCsv = "customer_id,card_id,first_name,last_name,card_number,expiration\ncus_100,card_100,John,Doe,4242424242424242,1023\ncus_200,card_200,Jane,Doe,5555555555554444,921\ncus_300,card_300,,Roberts,6011111111111117,820"usersCsv = "customer_id,email\ncus_300,rob@example.com\ncus_100,john@example.com\ncus_200,jane@example.com"return = ["customer_id,card_id,email,cardholder_name,card_number,exp_month,exp_year","cus_100,card_100,john@example.com,John Doe,4242424242424242,10,2023","cus_200,card_200,jane@example.com,Jane Doe,5555555555554444,9,2021","cus_300,card_300,rob@example.com,Roberts,6011111111111117,8,2020"]The user rows may arrive in another order. Cards retain their original order, names are combined from non-empty pieces, and each expiration is split into month and four-digit year.
Example 2
cardsCsv = "customer_id,card_id,first_name,last_name,card_number,expiration\nc1,k1,Ada,Lovelace,4000000000000001,125\nc2,k2,Grace,,4000000000000002,1128"usersCsv = "customer_id,email\nc1,ada@pay.test\nc2,grace@pay.test"return = ["customer_id,card_id,email,cardholder_name,card_number,exp_month,exp_year","c1,k1,ada@pay.test,Ada Lovelace,4000000000000001,1,2025","c2,k2,grace@pay.test,Grace,4000000000000002,11,2028"]A three-character expiration has a one-digit month. An empty last name contributes no extra space.
Example 3
cardsCsv = "customer_id,card_id,first_name,last_name,card_number,expiration"usersCsv = "customer_id,email"return = ["customer_id,card_id,email,cardholder_name,card_number,exp_month,exp_year"]When there are no card records, return only the output header.
Constraints
- Each CSV contains its exact header followed by between
0and100000data rows. - Fields contain no commas, line breaks, or surrounding whitespace.
- Customer and card IDs are unique in their respective inputs, and every card customer has exactly one user row.
- At least one of first name and last name is non-empty.
- Every expiration has length
3or4, represents a month from1through12, and ends with a two-digit 21st-century year.
More Stripe Phone Screen questions
- Business Account KYC Verification — Parts 1–5PHONE SCREEN · Seen Nov 2026
- Financial Account LedgerOA · PHONE SCREEN · Seen Nov 2026
- Merchant Matching, Parts 1–2: Shared Fields and Weighted ThresholdsPHONE SCREEN · Seen Nov 2026
- Parse Boolean Rule ExpressionsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Merchant Payout Scheduler, Part 2: Per-Merchant SchedulesPHONE SCREEN · Seen Nov 2026
- Transaction Fee Calculator — Parts 1–2: Basic Fee Calculation and Conditional Fee RulesPHONE SCREEN · Seen Nov 2026
- Render a Task Tree from CSV RowsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Invoice / Payment ReconciliationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Linked Merchants Within Two HopsPHONE SCREEN · Seen Nov 2026
- Portfolio Valuation, Part 1PHONE SCREEN · Seen Nov 2026
Similar questions at other companies
- Summarize Server Healthcheck LogsNVIDIA · PHONE SCREENNVIDIA interview questions
- Aggregate Values by LetterRiot Games · PHONE SCREEN
- Count Repeated WordsDatadog · PHONE SCREENDatadog interview questions
- Most Frequent Call Path From Function Trace LogsRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
- Video Cache Hit Rates from a CSV LogTubi · PHONE SCREEN
- Resolve Variable Equations with Dependency ErrorsApplied Intuition · PHONE SCREENApplied Intuition interview questions
- Chatbot Away-Status RefactorOpenAI · PHONE SCREENOpenAI interview questions
- Spreadsheet With Dependent CellsCharacter.AI · PHONE SCREEN
- Custom Record and Free-Form Field ParserNetflix · PHONE SCREENNetflix interview questions
- Chemical Formula WeightAgoda · PHONE SCREENAgoda interview questions