How we made KYC processing idempotent so retries, duplicate events, and parallel workers do not create duplicate side effects. We relied on durable step state and database guarantees. This post focuses on patterns, not proprietary implementation details.

🔁 How we made KYC processing idempotent so retries, duplicate events, and parallel workers do not create duplicate side effects. We relied on durable step state and database guarantees. This post focuses on patterns, not proprietary implementation details.
| Challenge | Approach | Results |
|---|---|---|
|
|
|
KYC (Know Your Customer) workflows are inherently messy: upstream systems retry, events can arrive out of order, and verification providers occasionally time out. If your pipeline assumes “exactly once,” it will eventually do the same work twice — and that’s where duplicate side effects and inconsistent state show up.
We wanted a design that:
This post shares the engineering patterns behind an idempotent, resumable KYC pipeline — without exposing proprietary code, infrastructure, or vendor-specific secret sauce.
When identity checks are slow or inconsistent, people don’t experience it as “distributed systems are hard.” They experience it as:
We optimized for two member-facing outcomes:
⚖️ This post uses “retry” to mean safe reprocessing of the same request in the presence of duplicates, timeouts, and crashes. It does not mean retrying identity checks until someone passes. When a user does not meet verification requirements, the outcome is final or routed to review according to policy.
🔁 What we mean by “retry” in SoLo’s KYC experience: a member re-attempting verification after a prior attempt ended due to a technical error, a data issue (e.g., incomplete/incorrect information), or a denial. We design the backend so these repeats are safe and consistent, and we also apply fraud-prevention controls and rate limits so retries can’t be abused. We intentionally keep the specifics internal.
| Engineering guarantee | What it prevents | Member-visible outcome |
|---|---|---|
| Step-level idempotency | Re-running the same validations after retries | Faster completion with fewer repeated prompts |
| Resumability (durable checkpoints) | Starting over after crashes/timeouts | "Pick up where you left off" flows instead of loops |
| Concurrency safety via DB invariants | Conflicting writes and inconsistent decisions across workers | Consistent outcomes that feel fair and predictable |
| Durable audit trail | Support dead-ends ("we can't tell what happened") | Faster resolutions and fewer repeated verification attempts |
This is the practical scenario we cared about most. Someone on mobile hits a timeout, retries, and expects progress, not a reset.

Alt: Every retry first checks durable step state. Completed steps are skipped. Incomplete steps run once and are recorded. Retries are for technical reliability and duplicate requests, not for changing a failed verification outcome.
The core idea is step-level durability:
ON CONFLICT DO NOTHING ensure no duplicate writes occur.This gives you:
To keep outcomes consistent, it helps to treat KYC as an attempt with a small, explicit state machine.

Alt: A minimal attempt lifecycle. The key is monotonic progress. Retries move forward or re-read state, and they don’t restart the attempt.
These invariants are what make the system feel fair and predictable to members:
| Failure mode | What happens in the system (pattern) | Member-visible outcome |
|---|---|---|
| Provider timeout / transient error | Retry re-reads durable step state first; only executes missing steps | No "start over" loop; faster completion on retry |
| Duplicate events / repeated requests | Read-before-write + dedupe keys prevent duplicate work | Consistent progress and decisions |
| Out-of-order events | Durable step state is the source of truth; orchestration reconciles order | Fewer confusing reversals in outcome |
| Crash mid-attempt | Durable checkpoints allow resuming from the last recorded step | "Pick up where you left off" experience |
| Parallel workers | DB invariants (unique indexes + ON CONFLICT DO NOTHING) ensure no duplicate writes, even when multiple workers process the same attempt concurrently | Fairness: no inconsistent decisions from races |
Note: “retry” scenarios above include both technical/data issues and re-attempts after a denial. Retries are constrained by fraud-prevention controls and rate limits to prevent abuse.
For production workflows, idempotency should be measurable.
This pattern pairs well with standard KYC data practices:
Most KYC systems live in an “at-least-once” world:
If your pipeline is a single monolithic function, a retry often means:
The result isn’t just waste — it can become correctness risk.
At a high level, treat verification as an orchestration problem: a controller runs a sequence of steps, each step writes a durable result, and the database enforces uniqueness.

Alt: Orchestrator processes a verification attempt concurrently with other workers, runs steps, persists step outcomes idempotently, and produces a final outcome with an audit trail. We also have a post on what changed in Version 4, plus one on building a guard-railed AI voice agent for recovery operations.
Instead of relying on “the workflow ran,” we persist “which steps ran” and “what they concluded,” so we can safely:
skip completed work,
resume after crashes,
prevent duplicate side effects.
For each step we store:
step name (e.g., “DOB”, “phone”, “address” — names are illustrative)
status (success/failed)
a small metadata payload needed to keep downstream behavior consistent (more on that below)
We explicitly avoid storing secrets or raw provider payloads in this pattern for external-facing designs. The goal is “enough to resume deterministically,” not “store everything.”
Idempotency is easier when the system enforces correctness at the data layer rather than at the coordination layer. Rather than preventing concurrent work, we allow it and rely on DB constraints to prevent duplicate writes:

Alt: Both workers process the same attempt concurrently. Safety is enforced at write time — the second INSERT is silently ignored by the database.
When multiple workers race, correctness should not depend on timing. The database can enforce invariants like:
This pattern is powerful because:
Principle: if the DB can guarantee it with a constraint, prefer that over application-level locks.
One subtle issue: skipping a step should not change downstream behavior.
Example: a step may compute a derived flag or intermediate status that later steps rely on. If we skip the step, downstream logic still needs the same context it would have had if the step executed live.
So we persist a minimal metadata shape such as:
When the step is skipped, the orchestrator:
This prevents “skip drift” — where skipping completed work accidentally changes the final result.
The same step-level approach applies to failures:
A practical rule:
Step-level records enable:
At minimum, you can derive:
To keep this post broadly useful (and safe for external publication), we’re avoiding:
But the transferable implementation outline looks like:
[ ] Identify the workflow’s side effects (writes, messages, notifications) and how to dedupe them
[ ] Define durable attempt + step concepts with a minimal state model
[ ] Make every retry read-before-write
[ ] Add DB-level invariants (uniqueness constraints) wherever possible
[ ] Record failures and normalize error codes for debugging
[ ] Instrument metrics for time-to-complete, retries, skips, and resume success
Idempotency isn’t a nice-to-have in verification workflows. It’s foundational. When your pipeline can safely retry, resume, and run under concurrency, reliability becomes a property of the system rather than a heroic on-call effort.
The best part is that these patterns are not KYC-specific. Any multi-step workflow with side effects, such as onboarding, risk checks, provisioning, or payments, benefits from the same “durable step state + DB guarantees” approach.
