← Stripe Interview Insights

Stripe·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Stripe technical screen for a software engineer role. One coding problem, pretty focused on API chaining and runtime data handling. Left feeling okay about it but not confident I nailed the substitution piece.

Questions Asked (1)

Q1

You have a chain of 5 sequential API calls where the first two succeed but the next three fail because they use a hard-coded ID instead of the one generated at runtime by the first request. You've already extracted that ID from the first response. Write the substitution logic to replace the hard-coded ID in both request URLs and request bodies before each downstream call is sent. Also discuss safe templating approaches, handling nested JSON, and how you'd verify the substitution actually happened before dispatch.

API & IntegrationsTechnical Trade-offsRoot Cause Analysis
Author's notes

This is where I spent most of my time and still walked away unsure I got it right.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining how you would extract the runtime ID from the first response and store it in a variable. Then describe a generic substitution function that recursively traverses request URLs and JSON bodies, replacing any hard-coded placeholder with the actual ID. Finally, discuss verification steps such as logging the transformed request and asserting the absence of the placeholder before dispatch.

Pro tip: Use a unique, unmistakable placeholder (e.g., `{{RUNTIME_ID}}`) instead of a real-looking ID to avoid accidental collisions and make verification trivial. Also, consider using a templating library like Handlebars or Mustache for safe substitution, but be cautious of injection risks if the ID comes from an untrusted source.

1. Extract and store the runtime ID

Parse the first API response to extract the generated ID and store it in a variable (e.g., `runtimeId`). Ensure you handle potential parsing errors and validate the ID format.

2. Define a substitution function

Create a function that takes a request object (URL and body) and replaces all occurrences of the hard-coded placeholder with the runtime ID. For nested JSON, use a recursive traversal to handle objects and arrays.

3. Apply substitution before each downstream call

For each of the remaining API calls, pass the request through the substitution function before sending. Ensure the function is applied to both the URL and the body (including nested fields).

4. Verify substitution

Before dispatching, log or assert that the placeholder no longer exists in the request and that the runtime ID is present. Optionally, compare the transformed request against a schema or expected pattern.

5. Handle edge cases and safety

Consider using a templating engine with escaping to prevent injection, and handle cases where the placeholder might appear in unexpected places (e.g., headers). Also, ensure idempotency if the substitution is retried.

Key Points to Mention

  • Use a unique placeholder (e.g., `{{RUNTIME_ID}}`) to avoid accidental replacement of legitimate IDs.
  • Recursive traversal for nested JSON objects and arrays to ensure all occurrences are replaced.
  • Verification via logging, assertions, or schema validation before dispatch to catch missed substitutions.
  • Safe templating approaches: consider using a library (e.g., Handlebars) with proper escaping, or a custom function with strict type checks.
  • Error handling: if the runtime ID is missing or malformed, fail fast with a clear error rather than sending a bad request.
  • Idempotency and retry safety: ensure substitution is deterministic and can be safely reapplied.

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