← Expedia Interview InsightsSoftware Engineer

Expedia·Software Engineer·Onsite - System Design / Architecture·Senior

Senior
Jun 2026

Summary

System design round at Expedia for a software engineering role. The main problem was designing a synchronous order cancellation and refund processor, which sounds contained but ends up touching a lot of moving parts fast.

Questions Asked (6)

Q1

Design a synchronous order cancellation and refund processor. The API must return a definitive success or failure only after the cancellation and refund are fully resolved, not fire-and-forget. Walk through validating order state, issuing the refund via a payment gateway, updating order/payment/inventory atomically, and staying within acceptable latency.

System DesignAPI & IntegrationsTechnical Trade-offs
Author's notes

This one sprawled in ways I didn't anticipate.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then walk through the synchronous flow step-by-step: validate order state, call the payment gateway, and update order/payment/inventory atomically. Emphasize how you handle failures, idempotency, and latency while ensuring the API returns only after full resolution.

Pro tip: Design for idempotency and partial failures from the start—use idempotency keys for the refund and a saga or compensation pattern for atomicity across services. Also, set a strict timeout budget for the gateway call and have a fallback to avoid blocking the client indefinitely.

1. Clarify requirements and constraints

Ask about expected latency, consistency guarantees, failure handling, and whether the refund must be synchronous with the cancellation. Confirm the payment gateway's capabilities (e.g., idempotency, timeouts).

2. Validate order state and business rules

Check that the order is in a cancellable state (e.g., not shipped, not already cancelled) and that the refund amount is correct. Ensure the user has permission to cancel.

3. Issue refund via payment gateway

Call the payment gateway synchronously with an idempotency key to avoid duplicate refunds. Handle gateway timeouts and errors gracefully, possibly with retries or a fallback.

4. Atomically update order, payment, and inventory

Use a transaction or saga to update the order status to cancelled, record the refund, and restock inventory. Ensure all updates succeed or roll back to maintain consistency.

5. Return definitive response and handle latency

Return success only after all steps complete. If latency is a concern, discuss trade-offs like async processing with polling or webhooks, but adhere to the synchronous requirement.

Key Points to Mention

  • Idempotency: Use idempotency keys for refund requests to prevent duplicate charges on retries.
  • Atomicity: Use database transactions or a saga pattern with compensating actions to keep order, payment, and inventory consistent.
  • Latency: Set timeouts on the payment gateway call and consider circuit breakers; discuss the trade-off between synchronous and asynchronous processing.
  • Failure handling: Define clear error responses for validation failures, gateway errors, and partial failures; ensure the system can recover.
  • Concurrency: Handle concurrent cancellation requests for the same order using locking or optimistic concurrency control.
  • Observability: Log and monitor the cancellation flow to track success rates, latency, and failures.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

How would you handle partial failure in this system, specifically when the refund succeeds at the payment gateway but the database update then fails?

System DesignTechnical Trade-offs
Author's notes

Said 'rollback' reflexively and immediately knew it was wrong.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Acknowledge the dual-write problem and propose a solution that ensures eventual consistency, such as the Saga pattern with compensating transactions or transactional outbox. Emphasize idempotency, reconciliation, and monitoring to detect and recover from such failures.

Pro tip: Mention that you would design the system to make the database update idempotent and retryable, and that you'd use a reconciliation job to detect and fix inconsistencies, showing you think beyond the immediate failure.

1. Identify the failure scenario

Clearly state the problem: a partial failure where the refund succeeds at the gateway but the database update fails, leading to inconsistency.

2. Choose a consistency strategy

Discuss approaches like Saga pattern (with compensating transactions), transactional outbox, or two-phase commit, weighing trade-offs between consistency and availability.

3. Ensure idempotency and retries

Explain how to make operations idempotent (e.g., using idempotency keys) and implement retries with exponential backoff to handle transient failures.

4. Implement reconciliation and monitoring

Describe a reconciliation process (e.g., scheduled job) to detect and resolve inconsistencies, and monitoring/alerting to catch failures early.

5. Consider user experience and business impact

Address how to handle the user-facing side, such as notifying the user of the refund status and ensuring support teams can intervene if needed.

Key Points to Mention

  • Dual-write problem and eventual consistency
  • Saga pattern with compensating transactions
  • Transactional outbox pattern
  • Idempotency keys for safe retries
  • Reconciliation jobs to detect and fix inconsistencies
  • Monitoring, alerting, and logging for observability

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

How do idempotency keys make retries safe in this refund flow, and where exactly do you enforce them?

API & IntegrationsSystem Design
Author's notes

Felt more comfortable here.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Explain that idempotency keys ensure a refund is processed exactly once even if the request is retried, by using a unique key per refund attempt and enforcing it at the API gateway or service layer. Then describe where enforcement happens: typically at the entry point (API gateway) and persisted in a database with a unique constraint, so duplicate requests are detected and the original response is returned.

Pro tip: Mention that idempotency keys should be stored with the response and a TTL, and that the key must be generated by the client, not the server, to guarantee uniqueness across retries.

1. Define idempotency and its importance in refunds

Clarify that idempotency means multiple identical requests have the same effect as one, which prevents duplicate refunds when retries occur due to network issues or timeouts.

2. Explain how idempotency keys work

Describe that the client generates a unique key (e.g., UUID) for each refund request and includes it in the request header or body. The server uses this key to detect and ignore duplicate requests.

3. Identify enforcement points

Specify that enforcement happens at the API gateway (for early rejection) and at the refund service/database layer (for persistence and atomicity). The key is stored with a unique constraint, and the response is cached.

4. Describe the retry flow with idempotency

Walk through a scenario: client sends refund request with key, server processes and stores key+response. If client retries with same key, server returns the stored response without reprocessing.

5. Discuss edge cases and best practices

Mention handling of concurrent requests with the same key (using locks or atomic operations), key expiration, and ensuring keys are unique per refund attempt (not per refund).

Key Points to Mention

  • Idempotency key is a unique identifier generated by the client for each refund attempt.
  • Enforcement at API gateway to reject duplicates early, and at service layer with database unique constraint for atomicity.
  • Store the idempotency key along with the response and a TTL to handle retries and avoid storage bloat.
  • Use of database transactions or locks to handle concurrent requests with the same key.
  • Return the original response for duplicate requests to ensure consistency.
  • Idempotency keys prevent duplicate refunds, which is critical in financial systems like Expedia's.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

Compare using a distributed transaction versus a saga with compensation for coordinating the refund, order update, and inventory update. Which would you choose and why?

System DesignTechnical Trade-offs
Author's notes

Went with saga.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the business context and requirements, then compare distributed transactions (2PC) and sagas with compensation on key dimensions like consistency, availability, complexity, and performance. Conclude with a clear recommendation, typically favoring sagas for microservices-based travel platforms like Expedia due to scalability and resilience, but acknowledge when 2PC might be appropriate.

Pro tip: Emphasize that in travel systems, partial failures are common and user experience matters; sagas allow for graceful degradation and compensating actions that can be designed to be idempotent and retryable, which is crucial for high-volume booking flows.

1. Clarify Requirements and Context

Ask about consistency needs, latency requirements, failure scenarios, and whether the system is distributed across microservices. This shows you understand the problem before jumping to solutions.

2. Explain Distributed Transactions (2PC)

Describe how 2PC works with a coordinator, prepare/commit phases, and its guarantees (atomicity). Mention drawbacks: blocking, single point of failure, latency, and unsuitability for long-running or cross-service operations.

3. Explain Sagas with Compensation

Describe saga pattern: a sequence of local transactions, each with a compensating action for rollback. Highlight benefits: eventual consistency, non-blocking, resilience, and suitability for microservices. Mention challenges: complexity of compensation logic, idempotency, and lack of isolation.

4. Compare on Key Dimensions

Contrast the two approaches on consistency (strong vs eventual), availability, performance, complexity, and failure handling. Relate to the specific use case of refund, order update, and inventory update.

5. Make a Recommendation

Choose saga with compensation for Expedia's microservices architecture, justifying with scalability, resilience, and alignment with business needs. Acknowledge that 2PC might be used in limited scopes but is generally avoided.

Key Points to Mention

  • CAP theorem and the trade-off between consistency and availability in distributed systems.
  • 2PC's blocking nature and coordinator failure risks, leading to reduced availability.
  • Saga's eventual consistency and the need for idempotent compensating actions.
  • The importance of idempotency and retry mechanisms in compensation logic.
  • Expedia's microservices architecture and the need for scalable, loosely coupled services.
  • Real-world examples: booking a trip involves multiple services (payment, inventory, order) where saga is commonly used.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q5

How would you apply timeouts and circuit breakers around the payment gateway calls in this synchronous flow?

System DesignAPI & Integrations
Author's notes

Short answer: tight timeouts on the gateway call, circuit breaker to fail fast when the gateway is degraded, and a clear error response back to the caller rather than hanging.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by acknowledging the synchronous nature of the flow and the need to prevent payment gateway latency from cascading into user-facing failures. Then, propose a layered resilience strategy: timeouts to bound each call, circuit breakers to fail fast when the gateway is unhealthy, and fallbacks or retries with backoff for transient errors. Emphasize configuration, monitoring, and testing to ensure the solution is production-ready.

Pro tip: Mention that timeouts should be set slightly above the gateway's p99 latency and that circuit breakers should be tuned to trip on a combination of error rate and slow calls, not just failures. Also, highlight the importance of idempotency keys to safely retry payment requests without double-charging.

1. Define timeout strategy

Set a connect timeout (e.g., 1s) and a read timeout (e.g., 3s) based on the gateway's performance SLAs. Ensure timeouts are shorter than the overall request deadline to avoid cascading delays.

2. Implement circuit breaker

Wrap the payment call in a circuit breaker that opens after a threshold of failures or slow calls (e.g., 50% failure rate over 20 requests). When open, fail fast and optionally fall back to a queued retry or alternate payment method.

3. Handle retries and idempotency

For transient errors (e.g., network timeouts), retry with exponential backoff and jitter, but only if the operation is idempotent. Use idempotency keys to prevent duplicate charges.

4. Monitor and alert

Emit metrics for timeout occurrences, circuit breaker state changes, and retry counts. Set alerts on circuit breaker trips and high timeout rates to detect gateway degradation early.

5. Test and tune

Use chaos engineering to simulate gateway latency and failures, and load testing to validate timeout and circuit breaker settings. Continuously adjust thresholds based on production data.

Key Points to Mention

  • Timeout values should be derived from the gateway's p99 latency and be less than the overall request deadline.
  • Circuit breaker patterns: closed, open, half-open states, and how to configure failure thresholds and reset timeouts.
  • Use of idempotency keys to safely retry payment requests without double-charging.
  • Fallback strategies: queue for later processing, alternate payment provider, or graceful user error message.
  • Monitoring and alerting on circuit breaker state and timeout metrics to ensure observability.
  • Testing via chaos engineering and load testing to validate resilience configurations.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q6

Why would a team choose a synchronous cancellation flow over an asynchronous one, and what are the trade-offs?

Technical Trade-offsAdaptability & Ambiguity
Author's notes

Easiest part of the whole interview.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying what synchronous and asynchronous cancellation mean in the context of distributed systems, then explain when a synchronous flow is preferable (e.g., immediate consistency, simpler error handling) and when it's not (e.g., scalability, fault tolerance). Discuss trade-offs in terms of latency, complexity, reliability, and user experience, and tie it back to real-world scenarios like booking systems at Expedia.

Pro tip: Acknowledge that the choice often depends on business requirements and system constraints; showing you can weigh trade-offs rather than advocating for one approach demonstrates senior-level thinking.

1. Define the concepts

Briefly define synchronous and asynchronous cancellation flows, highlighting that synchronous blocks the caller until completion while asynchronous returns immediately and processes in the background.

2. Identify scenarios favoring synchronous

Explain situations where synchronous is beneficial, such as when immediate confirmation is required, when the operation is quick and reliable, or when strong consistency is critical (e.g., canceling a booking to release inventory instantly).

3. Discuss trade-offs

Compare trade-offs: synchronous offers simplicity and immediate feedback but can lead to higher latency, reduced throughput, and cascading failures; asynchronous improves scalability and resilience but adds complexity, eventual consistency, and potential user confusion.

4. Relate to real-world context

Connect to Expedia's domain: for example, canceling a hotel reservation might need synchronous to update availability, while canceling a flight might be asynchronous to handle downstream systems.

5. Conclude with a balanced view

Summarize that the choice depends on factors like latency requirements, consistency needs, and system architecture, and mention that hybrid approaches (e.g., synchronous for user-facing, asynchronous for backend) are common.

Key Points to Mention

  • Latency and user experience: synchronous provides immediate feedback but may increase response time.
  • Consistency: synchronous ensures strong consistency, while asynchronous leads to eventual consistency.
  • Scalability and fault tolerance: asynchronous decouples services, improving resilience and throughput.
  • Complexity: asynchronous requires handling retries, idempotency, and monitoring, increasing operational overhead.
  • Error handling: synchronous allows immediate error propagation, while asynchronous needs dead-letter queues and alerting.
  • Business requirements: cancellation policies, SLAs, and downstream system capabilities drive the decision.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.