All Products
Search
Document Center

ID Verification:Call examples of SDK for .NET

Last Updated:Nov 26, 2024

This topic provides examples on how to call ID Verification - KYC SDK for .NET by using server-side-only API operations. KYC is short for Know Your Customer.

Prerequisites

  • .NET Framework 4.5.0 or later is installed. Alternatively, .NET Standard 2.0 or later is installed.

  • Authentication is configured for API access by using credentials provided by Alibaba Cloud.

    Note

    For more information about how to use credentials to configure authentication for API access, see Manage access credentials.

Install the SDK

For more information about the source code of the SDK, see Package of SDK for .NET.

You can use one of the following methods to install the SDK:

  • Use the .NET CLI to install the SDK.

dotnet add package AlibabaCloud.SDK.Cloudauth_intl20220809 --version 1.1.0
dotnet add package Aliyun.Credentials
  • Use an installation package to install the SDK.

Install-Package AlibabaCloud.SDK.Cloudauth_intl20220809 -Version 1.1.0
Install-Package Aliyun.Credentials

Call examples

using AlibabaCloud.SDK.Cloudauth_intl20220809.Models;

namespace Demo
{
    public class EkycVerifyDemo
    {
        public static void Main(string[] args)
        {
            // Build client
            AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config()
            {
                Credential=new Aliyun.Credentials.Client(null)
                Endpoint = "cloudauth-intl.cn-hongkong.aliyuncs.com",
            };
            AlibabaCloud.SDK.Cloudauth_intl20220809.Client client = new AlibabaCloud.SDK.Cloudauth_intl20220809.Client(config);


            // Build request
            AlibabaCloud.SDK.Cloudauth_intl20220809.Models.EkycVerifyRequest request = new AlibabaCloud.SDK.Cloudauth_intl20220809.Models.EkycVerifyRequest
            {
              	IdOcrPictureUrl = "https://aliyun-hangzhou*****",
            		ProductCode = "eKYC_MIN",
            		MerchantBizId = "***",
            		MerchantUserId = "***",
            		DocType = "00000001",
        				Crop = "F",  
        				Authorize = "T" ,
                FacePictureUrl: "https://aliyun-hangzhou*****",
            	  DocName: "WANG**",
                DocNo:"410***************"
            };

            // Invoke API
            EkycVerifyResponse response = client.EkycVerify(request);

            // Get result
            Console.WriteLine(response.StatusCode);
            Console.WriteLine(response.Body.RequestId);
            Console.WriteLine(response.Body.Code);
            Console.WriteLine(response.Body.Message);
            Console.WriteLine(response.Body.Result.Passed);
            Console.WriteLine(response.Body.Result.SubCode);
            Console.WriteLine(response.Body.Result.TransactionId);
            Console.WriteLine(response.Body.Result.ExtIdInfo);
						Console.WriteLine(response.Body.Result.ExtFaceInfo); 
        }
    }
}