Stripe logo

Stripe Medium Interview Questions

14 medium-level practice questions for Stripe technical interviews

Stripe software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer
coding Medium Verified Question #1

1. Shipping Cost Calculator


Category: Algorithm coding problem
You are building a shipping cost calculator for an international e-commerce platform. The cost depends on the destination country and the product...
Input: Integer(s)
Output: Computed result
coding Medium Verified Question #2

2. Transaction Fee Calculator


Category: Trie-based coding problem
You are building a fee calculation system for a payment processing platform. Given transaction data as a CSV string, calculate fees based on payment...
Input: String
Output: Computed result
coding Medium Verified Question #3

3. Bitmap to Image Conversion


Category: Grid/matrix coding problem
You are designing a bitmap character rendering system. Given a lookup table mapping characters to 2D binary arrays, implement functionality to print,...
Input: 2D grid
Output: Printed output
coding Medium Verified Question #4

4. [Onsite Integration] Bike Map


Category: Trie-based coding problem
You are building a map visualization tool that generates static maps from location data. Implement a system that reads GPS coordinates, constructs...
Input: Array
Output: Computed result
coding Medium Verified Question #5

5. Content Validation Pipeline


Category: String coding problem
A platform ingests user-generated content records in a simplified CSV format. Before indexing or displaying any content, each record must pass a...
Input: Array of strings
Output: Array
coding Medium Verified Question #6

6. Support Ticket Dispatcher


Category: Graph coding problem
A customer support platform assigns incoming tickets to agents to keep workloads balanced. You are given a list of agent names and a list of tickets...
Input: Graph (nodes and edges)
Output: Array
coding Medium Verified Question #7

7. Order Payment Reconciler


Category: String coding problem
A billing system needs to match incoming payments to open orders. Each payment arrives as a comma-separated string with three fields: a payment ID, a...
Input: List
Output: Computed result
coding Medium Verified Question #8

8. Service Usage Cost Calculator


Category: Array coding problem
A cloud billing module computes the total cost for a customer's monthly usage. You are given a usage_report specifying the target region and...
Input: Array
Output: Computed result
coding Medium graph #1

1. Graph — Find the shortest transaction path


Background: In Stripe's payment processing system, understanding transaction flows is crucial for identifying bottlenecks and optimizing performance. This problem is related to ensuring that transaction paths are efficient.
Problem statement: You are given a directed graph where each node represents a transaction, and an edge from A to B indicates that transaction A directly leads to transaction B. Write a function that finds the shortest path from a given start transaction to an end transaction. Return the path as a list of transactions. If there is no path, return an empty list.
Function/class signature:
  • def find_shortest_transaction_path(transactions: List[Tuple[str, str]], start: str, end: str) -> List[str]:


Example 1:
  • Input: transactions = [("A", "B"), ("B", "C"), ("A", "C")], start = "A", end = "C"

  • Output: ['A', 'C']

  • Explanation: The direct path from A to C has the shortest length.


Example 2:
  • Input: transactions = [("A", "B"), ("B", "C"), ("C", "A")], start = "A", end = "D"

  • Output: []

  • Explanation: There is no transaction D present.


Constraints:
  • The number of transactions will not exceed 1000.

  • Each transaction is represented as a unique string.
coding Medium hash map #2

2. [Hash_map] — Find unprocessed payments from a list

Background: Stripe processes millions of transactions daily. Occasionally, payments may not be fully completed due to various issues (e.g., network failures, user cancellations). Identifying unprocessed payments quickly can help improve user experience and operational efficiency.
Problem statement: You are given a list of payment IDs. Some payments are successfully processed, while others remain unprocessed, indicated by their accompanying status (either processed or unprocessed). Create a function that returns all payment IDs that are unprocessed.
Function/class signature:
  • def find_unprocessed_payments(payment_list: List[Tuple[str, str]]) -> List[str]:


Example 1:
Input: payment_list = [('abc123', 'processed'), ('xyz789', 'unprocessed'), ('qwe456', 'processed')]
Output: ['xyz789']
Explanation: Only the payment with ID xyz789 is unprocessed.
Example 2:
Input: payment_list = [('p1', 'unprocessed'), ('p2', 'unprocessed'), ('p3', 'processed')]
Output: ['p1', 'p2']
Explanation: Both payments p1 and p2 are classified as unprocessed.
Constraints:
  • The length of payment_list can be between 1 and 10^5.

  • Each payment ID is a string of up to 100 characters.

  • Each status is guaranteed to be either processed or unprocessed.

system design Medium api design #3

3. Design PaymentProcessor — a class to handle payment processing


Background: Stripe is a payment processing platform that requires efficient handling of various payment methods to support business transactions. The PaymentProcessor class will manage different types of payments, ensuring they can be processed securely and reliably.
Requirements:
1. The class must support initiating transactions with different payment methods (e.g., credit card, bank transfer).
2. It must implement methods to handle transaction approvals and declines.
3. The processor should maintain a log of all transactions.
4. Implement a method to retrieve transaction details using a unique transaction ID.
5. Ensure that all methods handle concurrency appropriately.
Class API:
  • initiate_payment(payment_method: str, amount: float) -> str

- Initiates a payment and returns a transaction ID.
  • approve_transaction(transaction_id: str) -> bool

- Approves the transaction and returns success status.
  • decline_transaction(transaction_id: str) -> bool

- Declines the transaction and returns success status.
  • get_transaction(transaction_id: str) -> dict

- Returns the transaction details for the given ID.
Example 1:
Input:
  • initiate_payment('credit_card', 100.00) → Output: transaction_id: 'txn_12345'

Explanation: The payment is initiated successfully, returning a unique transaction ID.
Example 2:
Input:
  • approve_transaction('txn_12345') → Output: True

Explanation: The transaction is approved.
Constraints:
  • Maximum of 1000 transactions in memory at any one time.

  • Methods must be thread-safe to handle concurrent requests.
system design Medium distributed systems #4

4. System Design: Design a Load Balancer

Background: Stripe handles high volumes of payment transactions, necessitating an effective distribution of incoming traffic to ensure reliability and performance. Designing a load balancer helps manage requests efficiently across multiple servers.
Requirements:
1. Support for multiple instances of back-end servers to distribute traffic.
2. Health checks to monitor the status of the servers.
3. Algorithms for load distribution (e.g., round-robin, least connections).
4. Ability to handle sticky sessions when required.
5. Logging functionality for monitoring and analytics.
Class API:
  • def add_server(self, server: str) -> None:

Adds a new server to the load balancer.
  • def remove_server(self, server: str) -> None:

Removes a server from the load balancer.
  • def get_next_server(self) -> str:

Returns the next server to which a request should be directed.
  • def health_check(self) -> List[str]:

Returns a list of healthy servers.
  • def log_request(self, server: str) -> None:

Logs a request sent to a server for analytics.
Example 1:
Input:
load_balancer = LoadBalancer()  
load_balancer.add_server("server1")  
load_balancer.add_server("server2")  
load_balancer.get_next_server()

Output:
"server1"
Explanation:
The load balancer routes to server1 on the first call.
Example 2:
Input:
load_balancer.add_server("server3")  
load_balancer.get_next_server()  
load_balancer.get_next_server()

Output:
"server2"
Explanation:
After server1, the next in line is server2 followed by server3.
Constraints:
  • Maximum of 100 servers can be added.

  • Health checks should occur every 10 seconds.

  • Must support up to 1000 simultaneous requests.
system design Medium api design #5

5. [System Design] — Design a TransactionProcessor that simulates transaction handling for Stripe

Background: Stripe processes millions of transactions every day and needs an efficient system to handle various types of transactions reliably. This class will simulate the processing of these transactions in a way that can be used for both testing new features and validating current functionality.
Requirements:
1. process_transaction(transaction_id: str, amount: float) - Processes a transaction and updates internal state.
2. get_transaction_status(transaction_id: str) - Retrieves the status of a specific transaction.
3. refund_transaction(transaction_id: str) - Issues a refund for a completed transaction and updates the status.
4. Internal mechanisms to track successful, failed, and refunded transactions.
5. Ensure thread-safe operation when processing transactions concurrently.
Class API:
  • process_transaction(transaction_id: str, amount: float) -> None - Processes the transaction identified by transaction_id with the specified amount.

  • get_transaction_status(transaction_id: str) -> str - Returns the status of the specified transaction.

  • refund_transaction(transaction_id: str) -> bool - Refunds the transaction and returns True if successful, False otherwise.

Example 1:
Input: tp = TransactionProcessor()
Sequence:
tp.process_transaction('txn_001', 100.0)
tp.get_transaction_status('txn_001') → Output: 'successful'
Explanation: The transaction is processed and marked as successful.
Example 2:
Input: tp = TransactionProcessor()
Sequence:
tp.process_transaction('txn_002', 50.0)
tp.refund_transaction('txn_002')
tp.get_transaction_status('txn_002') → Output: 'refunded'
Explanation: The transaction is processed and subsequently refunded.
Constraints:
  • Maximum 100,000 transactions can be processed.

  • All transaction IDs are unique strings.

  • Operation must handle concurrent processing without data corruption.
system design Medium api design #6

6. Design CampaignManager — A class to manage marketing campaigns for Stripe

Background: Stripe runs numerous marketing campaigns to attract new customers and retain existing ones. A robust system is necessary to organize, track, and analyze the effectiveness of these campaigns. This helps in optimizing marketing strategies and ensuring a good return on investment.
Requirements:
1. Ability to create a new campaign with a unique identifier.
2. Track the status of the campaign (active, paused, completed).
3. Fetch all campaigns within a specified date range.
4. Calculate total spend and returns for a particular campaign.
5. List all campaigns with a specific status.
6. Allow pausing and resuming campaigns.
Class API:
  • def create_campaign(id: str, name: str, budget: float, start_date: str, end_date: str) -> None: Creates a new campaign.

  • def update_campaign_status(id: str, status: str) -> None: Updates the status of the campaign.

  • def fetch_campaigns(start_date: str, end_date: str) -> List[Dict]: Returns all campaigns within the date range.

  • def calculate_returns(id: str) -> float: Calculates returns for the specific campaign based on its spend and performance metrics.

  • def list_campaigns_by_status(status: str) -> List[Dict]: Lists all campaigns with a specified status.

  • def pause_campaign(id: str) -> None: Pauses an active campaign.

  • def resume_campaign(id: str) -> None: Resumes a paused campaign.

Example 1:
Input: create_campaign('001', 'Holiday Sales', 10000.0, '2023-11-01', '2023-11-30')
Output: Campaign created.
Explanation: A new marketing campaign 'Holiday Sales' has been created with the specified budget and dates.
Example 2:
Input: pause_campaign('001')
Output: Campaign paused.
Constraints:
  • Maximum 1000 campaigns can be created.

  • Budget must be a positive float.

  • Date format must be 'YYYY-MM-DD'.

  • Campaign IDs must be unique and non-empty.

Start practicing Stripe questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free