# Stripe interview prep

## Can two checkout retries create one payment?

Original Opend practice case · Updated 2026-11-30

[Cite this case](https://opend.in/prep/stripe#payment-retries)

Order A17 costs $48. A slow checkout causes a browser retry at the same moment a worker retries a timed-out API call. Neither caller knows whether the first request succeeded. Describe what your service records before it talks to Stripe.

**Short answer** — Give a logical payment attempt one durable identity. Replay that attempt with its original key and parameters, and reconcile its payment state when the outcome is ambiguous.

### Two callers converge on payment attempt A17-1

- **Browser and worker** — Both request payment for order A17, attempt 1.

- **One durable attempt** — A unique order-and-attempt record owns the key, amount, currency and status.

- **One downstream identity** — Every replay reads that row. The provider response or a reconciled event resolves it.

### Separate a retry from a second purchase

Start with the business invariant. Two tabs can send different HTTP request IDs for the same checkout. Have the service assign the attempt identity and compare the requested amount and currency with the saved record. Concurrent inserts race on a unique constraint. The loser loads the winning row and returns its status. A customer deliberately starting a second payment after a declined attempt follows a separate business transition.

### Explain the limit of the provider key

For Stripe API v1, an idempotent replay can return the original error response, including a 500 after execution began. Generating a fresh key to clear that error risks another operation. Retrieve the known payment object when possible and keep unresolved attempts available for reconciliation. Keep the order-to-payment mapping beyond the provider’s key retention window so a late client retry cannot silently become a fresh purchase.

[Stripe API v1 idempotency semantics](https://docs.stripe.com/api/idempotent_requests)

### Fulfil the order once

Webhook delivery introduces a second duplication boundary. Store the event durably, acknowledge it and process it asynchronously. Make fulfilment conditional on the order’s current state and payment identity. Separate events may describe the same business outcome, so checking the event ID alone is insufficient. Test a successful payment followed by a late notification for an earlier state. The receipt should remain issued exactly once.

[Stripe webhook delivery and event ordering](https://docs.stripe.com/webhooks)

### Three requests that look similar in a log

| Input | Attempt record | Decision |
| --- | --- | --- |
| A17 · $48 · timeout | A17-1 exists | Recover original result |
| A17 · $84 · same key | Amount differs | Reject the conflict |
| A18 · $48 · new order | New instruction | Create its own attempt |

### What if the payment succeeded and the process crashed before sending the receipt?

Recover the payment identity, then transition the order to paid and create a uniquely keyed fulfilment task in one database transaction. The task needs its own delivery semantics. Charging safely does not by itself make sending an email or issuing a ticket idempotent.

Prepare for engineering conversations about APIs and reliable money movement. This is a practice plan, not a confirmed Stripe interview sequence; ask your recruiter for the loop for your role.

## Coding & problem solving

Practice a small, testable solution. Explain data structures, complexity and edge cases aloud.

## LLD / HLD

Model a payment state machine. Explain idempotency, reconciliation and what happens when a client times out.

## Practical systems & work discussion

Walk through one project you shipped: the constraint, your decision, a failure, and the result you can substantiate.

## Practice questions

These are Opend practice prompts, not verified interview questions.

### How would you make a payment request safe to retry?

- Define the invariant: one business operation must not create two charges.
- Scope an idempotency key to the caller and operation; atomically store its request fingerprint and result.
- Test simultaneous retries, reused keys with different bodies, and a timeout after the external charge succeeds.

### How would you process duplicate, out-of-order webhooks?

- Authenticate the event before accepting it, then acknowledge after durable storage.
- Deduplicate event IDs and separate transport retries from business-state transitions.
- Reconcile against authoritative state; do not assume arrival order is event order.

### What should I explain about a project I shipped?

- Choose one real constraint and explain the tradeoff you owned.
- Show the failure case you tested and one measured result. Be explicit about what you did versus the team.

[Live roles](https://opend.in/jobs?company=Stripe)

## Sources

- [Stripe API: idempotent requests](https://docs.stripe.com/api/idempotent_requests)
- [Stripe careers](https://stripe.com/jobs)
