React

React SDK implementation

Temporary Implementation (Using Vanilla SDK)


import React, { useEffect } from 'react';

const VerificationComponent = () => {
useEffect(() => {
// Load Prembly SDK
const script = document.createElement('script');
script.src = 'https://js.prembly.com/v1/inline/widget-v3.js';
script.async = true;
document.body.appendChild(script);

return () => { 
  document.body.removeChild(script); 
}; 

}, []);

const handleVerification = (error, data) => {
if (error) {
console.error('Verification Error:', error);
return;
}
console.log('Verification Success:', data);
};

const startVerification = () => {
if (window.IdentityKYC) {
window.IdentityKYC.verify({
widget_id: "your-widget-id",
widget_key: "your-widget-key",
first_name: "John",
last_name: "Doe",
email: "[email protected]",
callback: handleVerification
});
}
};

return (



Start Verification


);
};

export default VerificationComponent;