Integration Interview Round: Read Three Parts of the API Docs Before You Code

An integration interview round hands you an unfamiliar API and a goal to reach with it. You write a small program that calls the API and gets the job done. The trap is to start coding from the first example request. That code works on the demo data. It breaks on the parts the docs cover further down. So before you write anything, read three parts of the docs. The first is how a list call tells you there’s another page. The second is which calls are safe to repeat after a timeout. The third is which errors mean “retry” and which mean “stop”. Then get the happy path running end to end. Add those three cases in that order. Say each one out loud as you add it. Below, one Android engineer works a refund task in a Stripe-style integration round. The post shows the code that fails and the version that holds. It ends with a script you can reuse.

The integration interview round scores code that runs against an API you just met

Stripe is the best-known example. Interviewing.io’s Stripe guide lists a one-hour Integrations round in the onsite for roles below Staff. It says candidates use the Stripe API on problems based on real merchant integrations. Engineers interviewing for Stripe’s own integrations org skip it, by the same account. The guide has no visible date. Interviewing.io sells mock interviews. Its details come from its own sources rather than from Stripe. So ask your recruiter for the exact format. Our post on the recruiter prep call before an onsite covers which questions to ask.

The same guide says AI use in Stripe interviews is strictly prohibited. It also says the questions are language-agnostic. So you’ll read the docs yourself, in a language you pick. That matters for Android engineers. In an app, Retrofit, OkHttp and the backend team handle most of this round’s content. Here you own all of it.

Meet Bilal, an Android engineer with five years of Kotlin. His task sounds small. List every payment on a test account, then refund each one above $500. He has an API key, a docs page and an hour.

Read the docs for three answers before you write the first call

The quick-start example is the part of the docs everyone reads. It shows one request and one response. It rarely shows the second page, the dropped connection or the rate limit. Those live in sections with dull names like Pagination, Idempotent requests and Errors.

Stripe’s own docs make good practice material, because each section states its rule plainly. Your round may use a mock API with different field names. The same three questions still apply. Bilal spends his first eight minutes on them and writes one line of notes per answer.

A list call that ignores has_more passes the demo and misses most of the data

Stripe’s pagination docs say a list call returns 10 objects by default. The limit parameter goes up to 100. Each response carries a has_more flag. To get the next page, you pass the last object’s ID as starting_after.

Bilal’s test account holds 230 payments. Here’s the first version he would have written from the quick-start example. The client is a simplified stand-in for the API, written for this post.

// Reads one page and stops
val payments = api.listPayments().data

We ran this against a small Kotlin mock of that contract. It returned 10 payments out of 230. Nothing failed, so the bug is silent. If the demo account had held eight payments, it would have looked correct. The version that follows the cursor returned all 230.

val all = mutableListOf<Payment>()
var cursor: String? = null
do {
    val page = api.listPayments(limit = 100, startingAfter = cursor)
    all += page.data
    cursor = page.data.lastOrNull()?.id
} while (page.hasMore)

An interviewer can tell in one glance which version you wrote. A loop on has_more is visible proof that you read the pagination section.

A retried refund without an idempotency key can refund twice

Refunds are writes. Retries get dangerous on writes. Stripe’s guide to low-level error handling describes the case. A connection can drop after the server got the request but before you got the response. Reconnecting doesn’t tell you whether the first request worked. A blind retry can run the operation a second time.

The fix is an idempotency key. Stripe’s idempotency docs say every POST request accepts an Idempotency-Key header. Stripe saves the first result for a key. A retry with the same key gets that saved result back, even when it was a 500 error. If the retry sends different parameters, Stripe returns an error. Keys can be pruned once they’re at least 24 hours old. GET and DELETE calls don’t need one.

Our mock dropped the connection once, after the refund was recorded. A retry loop with no key created two refunds for one payment. The same loop with one key per payment created one.

// One key per payment, reused on every retry of that payment
val key = UUID.randomUUID().toString()
repeat(3) {
    try { return api.createRefund(payment.id, idempotencyKey = key) }
    catch (e: IOException) { /* same key next time */ }
}

Watch where the key is created. It sits outside the retry loop. A new key inside the loop would make every retry look like a new refund.

Retry the rate limit and the dropped connection, but stop on a bad request

The third answer decides what your loop does with each error. Stripe’s rate limit docs say Stripe returns HTTP 429 when you send too many requests. They advise retrying with exponential backoff and some random jitter. The low-level error guide says a 400 for bad parameters won’t get better on retry. You fix the request instead. It also describes a Stripe-Should-Retry header that answers the question directly when present.

Bilal’s loop fires dozens of refunds back to back, so a 429 is plausible. He sorts errors into three buckets. Network errors and 429 get a retry with backoff and the same key. A 4xx other than 429 gets logged with the payment ID. Then the loop moves on. Anything else stops the run and prints what’s left.

Bilal orders the work by what each gap would cost him. He gets the happy path running by minute 25. Pagination goes in next, because it changes the result. Idempotent retries come third. Error buckets come last. If time runs out, the gaps he leaves are the least visible ones.

Say each decision as you add it

The code shows what you did. Your narration shows that you read the docs on purpose. Here’s the script Bilal uses, adapted to any API.

“Before I write anything, I’m reading the pagination, idempotency and error sections. One note each.”

“Lists return ten by default, with a has_more flag and a starting_after cursor. I’ll loop on that and ask for 100 per page.”

“Refunds are POSTs, so a timeout could hide a refund that went through. I’ll make one key per payment and reuse it on retries.”

“429 and network errors get a retry with backoff. A 400 means my request is wrong, so I log it and keep going.”

“First I’ll get one refund working end to end. Then pagination, then retries, then the error cases.”

Each line names the doc section behind it. The interviewer hears where each behavior came from. The second and third lines state the failure before the fix. That shows you know what breaks without it. The last line is a plan. If the hour runs short, the interviewer already knows what you meant to add next.

The integration round shares one skill with Stripe’s debugging round. In both, you read code or docs you didn’t write before you change anything. That round has its own version of this trap. Our post on finding the bug and still not passing covers it.

Leave a Comment