LogoLogo
  • Welcome!
  • GETTING STARTED
    • Signing Up
    • Choose a Product
    • Choose an Integration Option
    • Run Your First Test Job
    • Complete Your KYC
    • Fund Your Wallet
    • Go Live!
    • Pricing
  • SUPPORTED ID TYPES & DOCUMENTS
    • For Individuals (KYC)
      • Using ID Number
        • Supported Countries
          • Côte d'Ivoire
            • National ID (without Photo)
            • Resident ID (without Photo)
          • Ghana
            • Ghana Card
            • Ghana Card (without Photo)
            • Passport
            • Voter's ID
          • Kenya
            • Alien Card
            • KRA Pin
            • National ID
            • National ID (without Photo)
            • Passport
            • Tax Information
          • Nigeria
            • Bank Account
            • BVN
            • NIN V2
            • NIN Slip Verification
            • V_NIN (Virtual NIN)
            • Phone Number
            • Voter's ID
          • South Africa
            • National ID
            • National ID (without Photo)
            • Phone Number
            • Refugee and Asylum ID
          • Uganda
            • National ID (without Photo)
            • Basic KYC in Uganda
          • Zambia
            • Bank Account
            • TPIN
          • Zimbabwe
            • National ID (without Photo)
        • Test Data
          • Customising Sandbox Test Data
        • ID Number Regex
        • Visual Samples of Supported ID Types
      • Using Document Image
        • Continents
          • Africa
          • Asia and the Middle East
          • Europe
          • North America
          • Oceania
          • South America
    • For Businesses (KYB)
      • Supported Countries
        • Nigeria
          • Business Registration
          • Tax Information
        • Kenya
          • Business Registration
        • South Africa
          • Business Registration
      • ID Number Regex
  • PRODUCTS
    • For Individuals (KYC)
      • AML Check
        • AML News Media
      • Basic KYC
      • Biometric KYC
      • Digital Address Verification
      • Document Verification
        • Document Verification
        • Enhanced Document Verification
      • Electronic Signature
      • Enhanced KYC
      • Phone Number Verification
      • SmartSelfie™ Authentication
      • SmartSelfie™ Compare
      • Smile Secure
    • For Businesses (KYB)
      • Business Verification
  • Integration Options
    • Mobile
      • Getting Started
      • Products
        • Biometric KYC
        • BVN Consent
        • Document Verification
        • Enhanced Document Verification
        • Enhanced KYC
        • SmartSelfie™ Enrollment and Authentication
        • Enhanced SmartSelfie™ Enrollment And Authentication
      • Customization
        • UI Components
      • Offline Mode
      • Release Notes
        • Android Release Notes
        • iOS Release Notes
        • Flutter Release Notes
        • React Native Release Notes
    • No-Code
      • Smile Links
        • Link FAQs
        • Rest API
    • Server to Server
      • Ruby
        • Installation
        • Signature
        • Products
          • Basic KYC
          • Enhanced KYC
          • Biometric KYC
          • Document Verification
          • SmartSelfie™ Authentication
          • KYB - Business Verification
          • AML Check
        • Generate Token for Web Integration
        • Utilities
      • Python
        • Installation
        • Signature
        • Products
          • Basic KYC
          • Enhanced KYC
          • Biometric KYC
          • Document Verification
          • SmartSelfie™ Authentication
          • Business Verification
        • Generate Token for Web Integration
        • Utilities
      • Java
        • Release Notes
        • Installation
        • Signature
        • Products
          • Basic KYC
          • Enhanced KYC
          • Biometric KYC
          • Document Verification
          • SmartSelfie™ Authentication
        • Generate Token for Web Integration
        • Utilities
      • Node.js
        • Installation
        • Signature
        • Products
          • Basic KYC
          • Enhanced KYC
          • Biometric KYC
          • Document Verification
          • Enhanced Document Verification
          • SmartSelfie™ Authentication
          • Business Verification
        • Generate Token for Web Integration
        • Utilities
      • PHP
        • Installation
        • Signature
        • Products
          • Basic KYC
          • Enhanced KYC
          • Biometric KYC
          • Document Verification
          • SmartSelfie™ Authentication
        • Generate Token for Web Integration
        • Utilities
    • Rest API
      • Signing your API Request
        • Using Signature
      • Products
      • Postman Collection
      • Utilities
    • Web / Mobile Web
      • Web Integration
        • Installation
        • Usage
        • End User Consent
        • Support
      • Javascript SDK
        • Installation
        • Usage
        • Migration
        • Deprecated Version
          • Installation
          • Usage
          • Notes
          • Support
  • FURTHER READING
    • FAQs
      • What are your support hours?
      • How do I set up a callback?
      • How to re-enroll, deactivate or delete a user?
      • Add or remove team members
      • What are top-level keys?
      • What are partner_params?
      • How do job types map to the new product names?
      • Is there an API I can use to monitor my wallet balance?
      • Is there an API I can query to check the availability status of an ID type?
      • How do I integrate Smile ID in other countries or query other ID types?
      • What are the image types I can upload to Smile ID?
      • Why aren't Kenyan IDs returning images for some IDs queried?
      • Why are some of my bank verification requests returning 'ID authority unavailable'?
      • How can I look up a specific user's data?
      • Selfie best-practices
      • Document capture best-practices
      • What happens under the hood?
      • Guide to the user consent screen
      • What is code 2302?
      • Using the Demo App and Scanning QR codes
    • Job status
    • KYC receipts
    • Result codes
      • Error codes
    • Securing your account with two-factor authentication (2FA)
    • Security Overview
    • Troubleshooting
      • Troubleshooting error 2204 & 2205 - "You're not authorized to do that"
      • Why is my Web API job taking so long?
      • Image capture issues on web client
Powered by GitBook
On this page
  • Running Biometric KYC on Ruby
  • Get your Partner ID
  • Get your API Key
  • Create a Callback Endpoint
  • Get the User's Selfie
  • Get the ID information from your users
  • Submit the Job to Smile ID
  • Getting the Job Result
  • Interpret your Results

Was this helpful?

  1. Integration Options
  2. Server to Server
  3. Ruby
  4. Products

Biometric KYC

PreviousEnhanced KYCNextDocument Verification

Last updated 11 months ago

Was this helpful?

Required Class: WebApi Class

Running Biometric KYC on Ruby

  1. Get your Smile ID Partner ID

  2. Get your API Key

  3. Create a Endpoint

  4. Get your user's Selfie images

  5. Get the ID information from your users

  6. Submit the Job to Smile ID

  7. Interpret your results

Get your Partner ID

You can find your Partner ID in the menu list when logged into .

Get your API Key

  • Click on the Generate New API Key button

  • Copy your api key (ensure you are in the right environment)

Create a Callback Endpoint

The size of the payload sent to your callback varies based on the size of image returned by the ID authority. We recommend your callback should accept payloads up to 1.5MB in size.

Get the User's Selfie

To successfully run Biometric KYC jobs you need to submit the user's selfie. There are two types of selfies that can be submitted

  • Selfie - a single colour-image selfie of user

  • (optional but required for proof of live) Liveness images - 8 colour images of user

The selfies can either be submitted as files (with the path to the image specified during submission) or as base64 encoded strings.

Get the ID information from your users

Submit the Job to Smile ID

You can copy the sample code below and edit with your partner and job details.

require 'smile-identity-core'

# Initialize
partner_id = '<Put your partner ID here>'; #login to the Smile ID portal to view your partner id
default_callback = '<Put your default callback url here>';
api_key = '<Put your API key here>'; # copy your API key from the Smile ID portal
sid_server = '<0 | 1>'; # Use '0' for the sandbox server, use '1' for production server

connection = SmileIdentityCore::WebApi.new(partner_id, default_callback, api_key, sid_server)

# Create required tracking parameters
partner_params = {
    user_id: '<put your unique ID for the user here>',
    job_id: '<put your unique job ID here>',
    job_type: 1
};

# Create image list
# image_type_id Integer
# 0 - Selfie image jpg (if you have the full path of the selfie)
# 2 - Selfie image jpg base64 encoded (if you have the base64image string of the selfie)
# 4 - Liveness image jpg(if you have the full path of the liveness image)
# 6 - Liveness image jpg base64 encoded (if you have the base64image string of the liveness image)
image_details = [
    {
      image_type_id: <0 | 2>,
      image: '<full path to selfie image or base64image string>'
     },
     { # Not required if you don't require proof of life (note photo of photo check will still be performed on the uploaded selfie)
       image_type_id: <4 | 6>,
       image: '<full path to liveness image or base64 image string>'
     }
  ];

# Create ID number info
id_info = {
  first_name: '<first name>',
  last_name: '<surname>',
  country: '<2-letter country code>',
  id_type: '<id type>',
  id_number: '<valid id number>',
  dob: '<date of birth>', # yyyy-mm-dd
  entered: 'true' # must be a string
};

# Set options for the job
options = {
  return_job_status: <true | false>, # Set to true if you want to get the job result in sync (in addition to the result been sent to your callback). If set to false, result is sent to callback url only.
  return_history: <true | false>, # Set to true to return results of all jobs you have ran for the user in addition to current job result. You must set return_job_status to true to use this flag.
  return_image_links: <true |false>, # Set to true to receive selfie and liveness images you uploaded. You must set return_job_status to true to use this flag.
  signature: true
};

# Submit the job
response = connection.submit_job(partner_params, image_details, id_info, options)

Getting the Job Result

By default you always get the result of your job in the callback url you provided, however for some use cases you might want to get the job result in sync after submission. The flag return_job_status can be set to true if you want to get the job result in sync.

Please note that the result you get in sync by setting the return_job_status flag to true might not be the final result if human review is required for the job. We recommend you use the responses sent to your callback to build your business logic as that is where we return the final result

Response when return_job_status is set to false

If return_job_status is set to false, the response will be a JSON string containing:

{
  "smile_job_id": "<the generated smile_job_id>",
  "success": true
}

The job result will be sent to the callback url you provided, it will look as follows:

{
  "Actions": {
    "Human_Review_Compare": "Passed",
    "Human_Review_Liveness_Check": "Passed",
    "Human_Review_Update_Selfie": "Not Applicable",
    "Liveness_Check": "Passed",
    "Register_Selfie": "Approved",
    "Return_Personal_Info": "Returned",
    "Selfie_Provided": "Passed",
    "Selfie_To_ID_Authority_Compare": "Completed",
    "Selfie_To_ID_Card_Compare": "Not Applicable",
    "Selfie_To_Registered_Selfie_Compare": "Not Applicable",
    "Update_Registered_Selfie_On_File": "Not Applicable",
    "Verify_ID_Number": "Verified"
  },
  "ConfidenceValue": "99",
  "PartnerParams": {
    "job_id": "KE_TEST_100",
    "job_type": "1",
    "user_id": "KE_TESTTEST_100"
  },
  "ResultCode": "1210",
  "ResultText": "Enroll User",
  "SmileJobID": "0000056574",
  "Source": "WebAPI",
  "timestamp": "2021-05-06T08:48:50.763Z",
  "signature": "----signature-----"
}

Response when return_job_status is set to true

If you have use cases that require you to get the result in sync, you can set the return_job_status to true. We advice that you use the result sent to your callback to make final decisions as there are times when the submitted job requires human review, the final result after the review is completed can not be retrieved by setting the return_job_status to true.

If you set return_job_status to true (with image_links and history also set to true) then you will receive the JSON object containing the machine result like below:

{
  "job_success": true,
  "result": {
    "ConfidenceValue": "99",
    "Actions": {
      "Human_Review_Compare": "Not Applicable",
      "Human_Review_Liveness_Check": "Not Applicable",
      "Human_Review_Update_Selfie": "Not Applicable",
      "Liveness_Check": "Not Applicable",
      "Register_Selfie": "Approved",
      "Return_Personal_Info": "Returned",
      "Selfie_To_ID_Authority_Compare": "Completed",
      "Selfie_To_ID_Card_Compare": "Not Applicable",
      "Selfie_To_Registered_Selfie_Compare": "Not Applicable",
      "Update_Registered_Selfie_On_File": "Not Applicable",
      "Verify_ID_Number": "Verified"
    },
    "ResultText": "Enroll User",
    "PartnerParams": {
      "job_type": "1",
      "optional_info": "we are one",
      "user_id": "HBBBBBBH57g",
      "job_id": "HBBBBBBHg"
    },
    "Source": "WebAPI",
    "ResultCode": "0810",
    "SmileJobID": "0000001111"
  },
  "code": "2302",
  "job_complete": true,
  "signature": "...",
  "history": [
    {
      "ConfidenceValue": "99",
      "Actions": {
        "Human_Review_Compare": "Not Applicable",
        "Human_Review_Liveness_Check": "Not Applicable",
        "Human_Review_Update_Selfie": "Not Applicable",
        "Liveness_Check": "Not Applicable",
        "Register_Selfie": "Approved",
        "Return_Personal_Info": "Returned",
        "Selfie_To_ID_Authority_Compare": "Completed",
        "Selfie_To_ID_Card_Compare": "Not Applicable",
        "Selfie_To_Registered_Selfie_Compare": "Not Applicable",
        "Update_Registered_Selfie_On_File": "Not Applicable",
        "Verify_ID_Number": "Verified"
      },
      "ResultText": "Enroll User",
      "PartnerParams": {
        "job_type": "1",
        "optional_info": "we are one",
        "user_id": "HBBBBBBH57g",
        "job_id": "HBBBBBBHg"
      },
      "Source": "WebAPI",
      "ResultCode": "0810",
      "SmileJobID": "0000001111"
    }
  ],
  "image_links": {
    "selfie_image": "image_link"
  },
  "timestamp": "2019-10-10T12:32:04.622Z"
}

Interpret your Results

Your API Key is also in the developer section of

Responses from this product are asynchronous (based on various actions we carry out on the product) and are sent as soon as they are ready, you will need to setup a callback when submitting a job. You can read about creating a Callback URL .

We recommend that you use our to capture both of these types of images

To submit a Biometric KYC job you need the ID information of your user. Depending on the ID type you are attempting to query, the required information varies. For the comprehensive list of required information for each ID Type, check the section of the docs.

Refer to the category column of result codes of for the comprehensive list of final codes (approved or rejected) and in-progress codes (inconclusive, provisional approval or suspected for spoof).

You can read more about result codes and responses in the section of the docs.

the portal.
here
Web SDK
Supported ID Types
Biometric KYC
Callback
the portal
Generate a new API Key
Copy your API Key
Biometric KYC