iComply API Documentation
  • Getting Started
  • Authentication
  • Data Structures
  • Natural Person Portal
    • React.js Integration
  • Webhooks
  • Reference
    • API Reference
      • Entities
      • Natural Persons
      • Legal Entities
      • AML Screening
      • Supporting Documents
Powered by GitBook
On this page
  1. Natural Person Portal

React.js Integration

This section described how to integrate the Natural Person Into a React.js application.

Our Natural Person is JavaScript based and therefore the steps to integrate it into a React.js application are a little different than integrating it into a dynamic website or HTML page.

const useScript = url => {
    useEffect(() => {
      const script = document.createElement('script');
      script.src = url;
      script.async = true;
      script.onload = () => {
        window.iComply.init(document.getElementById('iComply'), {
          callback(serverResponse) {
            fetch('${API}/icomplyListener', {
              method: 'POST',
              mode: 'cors',
              headers: {
                'Content-Type': 'application/json',
                Accept: 'application/json',
                Authorization: 'Bearer ${AT}',
              },
              body: JSON.stringify(serverResponse),
            }).then(res =>
              serverResponse.summaryResult == 'PASS'
                ? window.confirm('Automated ID Verification successful.') &&
                  window.location.replace('${APP_URL}/oauth/auth?response_type=code&scope=signature&client_&redirect_uri=${APP}/signup'),
                : window.confirm('Automated ID Verification unsuccessful.'),
            );
          },
          verificationIdCallback: function (verificationId) {
              console.log(verificationId)
          }
        });
      };
      document.body.appendChild(script);
      return () => {
        document.body.removeChild(script);
      };
    }, [url]);
  };
  useScript('https://verify.icomplykyc.com/icomply-min.js');

Please note this is just an example of how the iComply Natural Person Portal scripts can be integrated into a React.js application. Your exact implementation will varry depending on your application logic and onboarding funnel.

PreviousNatural Person PortalNextWebhooks

Last updated 3 years ago