-
Notifications
You must be signed in to change notification settings - Fork 45
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
Comments
Turns out this was all we needed to do the Identity verification process. Simple PHP stack workflow:
After that
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
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
)
###########*/ |
Any plans?
The text was updated successfully, but these errors were encountered: