Make Delivery Pay Idempotent and Handle Peak-Time Multipliers

Quick Overview

Design delivery pay with retry-safe payment identity and an explicit peak-time multiplier policy. Separate exact calculation from provider execution and handle lost responses, corrections, and overlapping peak windows.

Make Delivery Pay Idempotent and Handle Peak-Time Multipliers

Company: DoorDash

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Technical Screen

Design a delivery-pay calculation and payment flow. Explain what happens when a required API call fails, how a payment remains idempotent across retries, and how to add a peak-time rule that doubles pay. ### Clarifying Questions The base pay formula, API contract, and peak-window semantics are not supplied. Clarify whether peak eligibility depends on a delivery's start time or time spent inside a window, how overlapping windows behave, and how corrections are handled. For the worked design, choose piecewise duration-based pay with half-open peak windows and a multiplier of2 whenever at least one window is active. These are explicit practice choices, not reconstructed interview rules. ### What a Strong Answer Covers Separate calculation from external payment, preserve rate and window versions, handle ambiguous API outcomes, and use a stable payment identity. Explain why retrying with a new key can cause a duplicate payout. ### Follow-up Questions - What if the provider completes payment but the response is lost? - How should a later pay correction be represented without replaying the original payment?

Overview: Design delivery pay with retry-safe payment identity and an explicit peak-time multiplier policy. Separate exact calculation from provider execution and handle lost responses, corrections, and overlapping peak windows.

DoorDash logo
DoorDash
Oct 17, 2026
mediumSoftware EngineerTechnical ScreenSoftware Engineering Fundamentals
0
0

Design a delivery-pay calculation and payment flow. Explain what happens when a required API call fails, how a payment remains idempotent across retries, and how to add a peak-time rule that doubles pay.

Clarifying Questions Guidance

The base pay formula, API contract, and peak-window semantics are not supplied. Clarify whether peak eligibility depends on a delivery's start time or time spent inside a window, how overlapping windows behave, and how corrections are handled. For the worked design, choose piecewise duration-based pay with half-open peak windows and a multiplier of2 whenever at least one window is active. These are explicit practice choices, not reconstructed interview rules.

What a Strong Answer Covers Guidance

Separate calculation from external payment, preserve rate and window versions, handle ambiguous API outcomes, and use a stable payment identity. Explain why retrying with a new key can cause a duplicate payout.

Follow-up Questions Guidance

  • What if the provider completes payment but the response is lost?
  • How should a later pay correction be represented without replaying the original payment?