← Back to blog Stripe OA 2026 Quick-Hit | State Machine + Fraud Detection + API
Stripe

Stripe OA 2026 Quick-Hit | State Machine + Fraud Detection + API

2026-05-23

Stripe's OA is back in the 2026 spring cycle — still "given a real business scenario, write readable, extensible, testable code". Unlike Optiver / HRT pure-algo OAs, Stripe is an "engineer OA": long prompts, abstract, and demands sensible interface design + edge handling. Below: three problem lines by real-question density, plus a 7-day sprint.

Stripe OA Snapshot (2026)

Dimension Detail
Platform In-house IDE (HackerRank-lite)
Duration 2 hours
Questions 1–2 multi-part
Difficulty LC Medium pace + business wrapping
Grading Auto tests + code-quality review

Problem 1: Payment State Machine

class ChargeStateMachine:
    TRANSITIONS = {
        'pending':     {'authorize', 'void'},
        'authorized':  {'capture', 'void'},
        'captured':    {'refund'},
        'voided':      set(),
        'refunded':    set(),
    }
    NEXT = {
        ('pending', 'authorize'):   'authorized',
        ('pending', 'void'):        'voided',
        ('authorized', 'capture'):  'captured',
        ('authorized', 'void'):     'voided',
        ('captured', 'refund'):     'refunded',
    }

    def __init__(self):
        self.state = {}

    def apply(self, charge_id, event):
        cur = self.state.get(charge_id, 'pending')
        if event not in self.TRANSITIONS[cur]:
            raise ValueError(f'illegal: {cur} → {event}')
        self.state[charge_id] = self.NEXT[(cur, event)]
        return self.state[charge_id]

def process(events):
    sm = ChargeStateMachine()
    out = {}
    for cid, ev in events:
        try:
            out[cid] = sm.apply(cid, ev)
        except ValueError:
            pass
    return out

Review checkpoints: illegal transitions throw, unknown charge_id defaults to pending, transition table is explicit.

Problem 2: Fraud Detection (Sliding Window)

from collections import deque, defaultdict

def first_fraud_idx(events, threshold=1000, window_sec=600):
    qs = defaultdict(deque)
    sums = defaultdict(float)
    for i, (uid, amt, ts) in enumerate(events):
        q, s = qs[uid], sums
        q.append((ts, amt))
        s[uid] += amt
        while q and ts - q[0][0] > window_sec:
            _, old_amt = q.popleft()
            s[uid] -= old_amt
        if s[uid] >= threshold:
            return i
    return -1

Time complexity: amortized O(n). Advanced variants (~25% per community reports) add FX conversion across currencies.

Problem 3: API Parsing

import json

def parse(payload, money_fields=('amount', 'amount_captured', 'amount_refunded')):
    obj = json.loads(payload) if isinstance(payload, str) else payload
    result = {
        'type': obj.get('type'),
        'id':   obj.get('data', {}).get('object', {}).get('id'),
    }
    def walk(node):
        if isinstance(node, dict):
            for k, v in node.items():
                if k in money_fields and isinstance(v, int):
                    node[k] = v / 100.0
                else:
                    walk(v)
        elif isinstance(node, list):
            for v in node:
                walk(v)
    walk(obj)
    result['cleaned'] = obj
    return result

Stripe webhooks nest 5+ layers — recurse, don't assume structure.

7-Day Sprint

Day Task
D1 State machine: 3 classics (order / subscription / charge)
D2 Sliding-window aggregation: 10-min, rolling, sliding median
D3 JSON nested parsing + recursive / iterative
D4 LC 1095 / 705 / 706 + interface design
D5 Full mock Stripe OA (timed 2 hours)
D6 Mock debrief + 2 targeted gap problems
D7 Read stripe.com/docs API style + 1 interface problem

Real-Question Signals


FAQ

Which language for Stripe OA?

Python / Java / Go / Ruby / TypeScript supported. Community reports: ~70% Python, ~15% Go, ~10% Java.

1 problem or 2?

Role-dependent. Backend / API SDE typically 1 multi-part; Infra / Payments occasionally 2.

How does auto-test + human review balance?

Auto tests must pass; review evaluates readability, naming, reuse, error handling.

Cooldown if failed?

Usually 6 months. Switching teams (Payments → Atlas) may not reset the bucket, but referrer can re-evaluate.


Preparing Stripe OA / VO?

We were glad to help this cohort pass the Stripe OA. Many candidates told us LeetCode practice never simulated the "200-line prompt + interface design + auto tests + human review" quadruple pressure — they froze on OA day.

If you're prepping Stripe, Plaid, Brex, or Mercury payment / FinTech SDE OA / VO and feel directionless, contact oavoservice. We tailor OA assistance to your gaps and connect state machine + fraud detection + API parsing into a single practice loop.

👉 Add WeChat: Coding0201grab the Stripe 2026 prep pack.


Contact

Email: [email protected]
Telegram: @OAVOProxy