Integration
KYC SDK
zKYC is a service package that redirects users to the zKYC page, where they go through a KYC verification process.
Before integrating the SDK on your end, you will need to register on zKYC and then generate your production / testing keys.
Call the flow
Invoke ZKYCProcess with the user/session id, your API key, the service type, and redirect URLs.
KYCButton.tsx
import React from 'react';
import { ZKYCProcess } from "zkyc-sdk-package";
export default function KYCButton() {
const handleKYC = async () => {
try {
await ZKYCProcess({
apiKey: "prod_***********************************",
failurePage: `${window.location.origin}/kyc-failed`,
successPage: `${window.location.origin}/kyc-success`,
});
} catch (error) {
console.error('KYC initiation failed:', error);
alert('Failed to start KYC process. Please try again.');
}
};
return <button onClick={handleKYC}>Start KYC Verification</button>;
}Required parameters
| Parameter | Description |
|---|---|
| apiKey | Your API key (test or production). |
| failurePage | URL to redirect the user if verification fails. |
| successPage | URL to redirect the user when verification is completed and the proof is claimed by the user. |
After success
The user will be redirected to the success page you implemented. The redirect URL will include a token query argument — fetch its value and call the API with it, as shown in the example below.
verify-token.ts
const params = new URLSearchParams(window.location.search);
const token = params.get('token');
const response = await fetch('https://api.zkyc.tech/api/kyc/flow-stage', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${apiKey}`,
},
body: JSON.stringify({ token }),
})
const data = await response.json();API response
verify-token-response.json
{
"success": true,
"data": { "flowStage": "draft" }
}Check our repo in github
Check our demo
Ask an AI
Have an AI explain this page or help you integrate the SDK.