Know Your Customer (KYC)

Overview

The KYC component launches the external KYC process by HyperVerge and handles its result. Every user must be approved by the KYC process before a ticket purchase is possible. However, the user’s payment data is already collected and validated in the Cart module and only upon the KYC approval the user’s payment is captured and the ticket is issued.


Dependencies

Hooks

*useCheckout, providing the following function: * handleKYCandCapture (function): Launches the KYC and handles its result. On approval the payment is captured and the ticket is issued. The custom callback functions onSuccess and onError are called respectively.


Example

This is a simplified code example. To see a full example using our prebuilt components, visit the Kyc component in the CLUX repository. In this example, the prebuilt useNotifications hook is used to signify the KYC result to the user.

import React from 'react'

// core functions
import { useCheckout, useNotifications } from 'blocklotto-sdk';

export default function Kyc() {
    const { handleKYCandCapture } = useCheckout();
    const notify = useNotifications();

    const handleSuccess = async (message) => {
        notify({ type: "success", message: "KYC successful"});
    }

    const handleError = (message) => {
        notify({ type: "error", message });
        history.push("/");
    }
    return (
        <div>...<div>
        <button onClick={(e) => handleKYCandCapture(e, handleSuccess, handleError)}>Continue</Button>
    )
}

KYC Example