SDK Integration
TrustCredo Verification SDK
Integrate identity verification into your application with just a few lines of code.
1
Include the SDK
Add the TrustCredo SDK script to your HTML
<script src="https://verify.trustcredo.com/sdk/v1/trustcredo.js"></script>2
Initialize with API Key
Configure TrustCredo with your partner API key and callbacks
TrustCredo.init({
apiKey: 'bd61b049-4201-412f-8c11-4236adf307e2',
onSuccess: function(result) {
console.log('Verified!', result.extractedData.fullName);
// Send verificationId to your server
},
onFailure: function(result) {
console.log('Failed', result);
},
onClose: function() {
console.log('User closed modal');
}
});Callback Functions:
onSuccess— Called when verification is successful. Contains extracted user data.onFailure— Called when verification fails. Contains error details.onClose— Called when user closes the verification modal.
3
Start Verification
Trigger the verification flow when user clicks a button
document.getElementById('verify-btn').onclick = function() {
TrustCredo.startVerification({
userId: 'user_123',
userEmail: 'user@example.com',
userName: 'John Doe'
});
};Parameters:
userId— Your unique identifier for the useruserEmail— User's email addressuserName— User's display name
Try It Out
Click the button below to see the verification flow in action.
Loading SDK...
Complete Example
<!DOCTYPE html>
<html>
<head>
<title>TrustCredo Verification</title>
<script src="https://verify.trustcredo.com/sdk/v1/trustcredo.js"></script>
</head>
<body>
<button id="verify-btn">Verify Identity</button>
<script>
TrustCredo.init({
apiKey: 'bd61b049-4201-412f-8c11-4236adf307e2',
onSuccess: function(result) {
console.log('Verified!', result.extractedData.fullName);
// Send verificationId to your server
},
onFailure: function(result) {
console.log('Failed', result);
},
onClose: function() {
console.log('User closed modal');
}
});
document.getElementById('verify-btn').onclick = function() {
TrustCredo.startVerification({
userId: 'user_123',
userEmail: 'user@example.com',
userName: 'John Doe'
});
};
</script>
</body>
</html>