Stripe software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.
No verified questions yet for Stripe.
PaymentProcessor class will manage different types of payments, ensuring they can be processed securely and reliably.Requirements: initiate_payment(payment_method: str, amount: float) -> str approve_transaction(transaction_id: str) -> bool decline_transaction(transaction_id: str) -> bool get_transaction(transaction_id: str) -> dict initiate_payment('credit_card', 100.00) → Output: transaction_id: 'txn_12345' approve_transaction('txn_12345') → Output: True def add_server(self, server: str) -> None: def remove_server(self, server: str) -> None: def get_next_server(self) -> str: def health_check(self) -> List[str]: def log_request(self, server: str) -> None: load_balancer = LoadBalancer()
load_balancer.add_server("server1")
load_balancer.add_server("server2")
load_balancer.get_next_server() "server1" server1 on the first call. load_balancer.add_server("server3")
load_balancer.get_next_server()
load_balancer.get_next_server() "server2" server1, the next in line is server2 followed by server3. process_transaction(transaction_id: str, amount: float) - Processes a transaction and updates internal state. get_transaction_status(transaction_id: str) - Retrieves the status of a specific transaction. refund_transaction(transaction_id: str) - Issues a refund for a completed transaction and updates the status. 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.tp = TransactionProcessor() tp.process_transaction('txn_001', 100.0) tp.get_transaction_status('txn_001') → Output: 'successful' tp = TransactionProcessor() tp.process_transaction('txn_002', 50.0) tp.refund_transaction('txn_002') tp.get_transaction_status('txn_002') → Output: 'refunded' 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. create_campaign('001', 'Holiday Sales', 10000.0, '2023-11-01', '2023-11-30') Campaign created. pause_campaign('001') Campaign paused. POST /charges: Creates a new charge.GET /charges/{chargeId}: Retrieves the status of a specific charge.GET /charges: Lists all transactions based on pagination parameters.POST /charges with body {amount: 1000, currency: 'usd', source: 'tok_visa'}201 Created with body {id: 'ch_1FZh2I2eZvKYlo2C4H2gGm7', status: 'succeeded'}Example 2:GET /charges/ch_1FZh2I2eZvKYlo2C4H2gGm7200 OK with body {id: 'ch_1FZh2I2eZvKYlo2C4H2gGm7', status: 'succeeded'}chargeId, an amount in cents, and a currency string, e.g., 'usd'.get(key: int): int: Retrieves the value of the key if the key exists in the cache, otherwise returns -1.put(key: int, value: int): void: Updates the value of the key if the key exists, and if the cache reaches its capacity, it should invalidate the least recently used item before inserting a new item.put(1, 1)NoneInput: put(2, 2)NoneInput: get(1)1Input: put(3, 3)NoneInput: get(2)-1Sign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free