Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Identity Verification #86

Open
luxor99 opened this issue Feb 27, 2024 · 1 comment
Open

Support for Identity Verification #86

luxor99 opened this issue Feb 27, 2024 · 1 comment

Comments

@luxor99
Copy link

luxor99 commented Feb 27, 2024

Any plans?

@zagarskas
Copy link

zagarskas commented May 6, 2024

Turns out this was all we needed to do the Identity verification process.
I had considered working this into the SDK and making a class, but for now, this is all ya need:

Simple PHP stack workflow:

  1. Send a CURL request
  2. detect if status = "active | failed | success"
  3. Catch the shareable_url variable - tell the user to visit that link

After that

  • set up webhooks on your server to "catch" the notification
  • check if passed/failed

Step 1 - CURL Request.

//setup json data and using json_encode() encode it into JSON string
$data = array(
	'client_user_id'  => $user_id_for_webhook, // make up an ID for user in our database
	'client_id'  => $_client_id, // ours
	'secret'  => $_secret, // ours
	'is_shareable'  => true, //we need them to click the link
	'template_id'  => $_template, // ours
	'gave_consent' => false, //If true accept_tos step marked as skipped
	'is_idempotent'  => true,
	//is_idempotent means only be created if one does not already exist
);

// encode that array
$send_data = json_encode( (object) $data, JSON_HEX_APOS | JSON_HEX_QUOT );

//initialize CURL
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");          
curl_setopt($ch,CURLOPT_HTTPHEADER, ["content-type: application/json"]);
curl_setopt($ch,CURLOPT_POSTFIELDS, $send_data);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); 

$resp = curl_exec( $ch );
// catch the data
curl_close( $ch );
//close the cURL 


///////////////////////////// here is your Identity verification URL
//decode the response
$response = json_decode( $resp, true );

if(!empty($response['status']) && $response['status'] == "active") {
    // then make the user click this link
    echo "Click this: ". $response['shareable_url'];
}

if(!empty($response['status']) && $response['status'] == "success") {
    // then the user filled out the form, and you need to "do stuff" or catch a webhook
    echo "Your application is completed. Thank you";
}

if(!empty($response['status']) && $response['status'] == "failed") {
    // sus
    echo "Your application is sus. We will take a look... (wait right here)";
}


// here is the whole response 
echo '<pre>'.print_r($response, true ).'</pre>';

Now, from here, that same JSON response is sent back to you via WEBHOOKS
Give these a peek, they are well done:

Closing meditation: Having this as a class would be nice within this SDK, but I can see how the usage cases would be so different for everyone that may as well just custom code this.

For example, consider our end logic here, with the different outcomes...

//when WEBHOOK received, we catch the JSON and "do stuff" with it.
//In our case, just conditional logic and DB updates.

/*###########  During Step 2 - this is a PASS in our case 
[status] => success
[steps] => Array
	(
 		[documentary_verification] => not_applicable
		[kyc_check] => success
		[risk_check] => success
		[selfie_check] => not_applicable
		[verify_sms] => success
	)
###########

###########  During Step 2 - this is a FAIL in our case
[status] => failed
[steps] => Array
	(
		[documentary_verification] => not_applicable
		[kyc_check] => failed
		[risk_check] => success
		[selfie_check] => not_applicable
		[verify_sms] => success
	)
###########

###########  During Step 2 - this is a REDO 
[steps] => Array
        (
            [documentary_verification] => not_applicable
            [kyc_check] => waiting_for_prerequisite
            [risk_check] => waiting_for_prerequisite
            [selfie_check] => not_applicable
            [verify_sms] => active
        )
###########*/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants