KYC/KYB Data Integration Workflows

Integrating identity verification (Sumsub, Persona) into payment flows. Handling "Pending Review" states, webhooks, and preventing onboarding friction.

Identity verification (KYC/KYB) is the gatekeeper of fintech. Technically, it is an asynchronous workflow that interrupts the user journey. You cannot await a KYC response like a database query; it may take 5 seconds (AI check) or 5 days (Manual Review). The architecture must handle these long-running states without blocking the user interface or losing the context of the signup.

The State Machine Integration

The user entity needs a dedicated verification_status state machine:

unverified: Default state. Restricted access.

pending_check: Docs uploaded, waiting for provider webhook.

approved: Webhook received with decision: accept. Limits lifted.

manual_review: Provider flagged ambiguity. Operations team alerted.

rejected: Final terminal state. Offboarding triggers.

Critical Logic: The payment endpoints must have middleware checking if status == approved before allowing money movement.

Webhook Security and Race Conditions

KYC providers notify success via webhooks.

Signature Verification: You must verify the provider's HMAC signature to ensure the "Approved" signal isn't faked by an attacker.

Race Conditions: If a user is rejected but the webhook is delayed, they might slip a transaction through. Best practice is to query the status at the moment of transaction (synchronous check) for high-risk actions, rather than relying solely on the cached status from the webhook.

Frequently Asked Questions

What is KYB (Know Your Business)?

It's KYC for companies. It involves parsing corporate registries and identifying "UBOs" (Ultimate Beneficial Owners). The data model is complex: 1 Business -> Many UBOs -> Each UBO needs KYC.

How do you handle "Soft Failures"?

If an ID is blurry, don't reject. Transition to resubmission_requested and trigger a UI prompt for the user to try again.

Related Guides