All Products
Search
Document Center

ID Verification:UniApp integration

Last Updated:Jun 17, 2026

Use the ID Verification UniApp plugin to integrate eKYC remote identity verification into your UniApp application.

Before you begin

Some developers have repackaged the Alibaba Cloud ID Verification SDK into third-party plugins and sell them on various platforms. Alibaba Cloud assumes no responsibility or legal liability for issues arising from these unofficial plugins or services. For stability and security, use only the official Alibaba Cloud SDK.

Configure dependencies

To integrate the UniApp plugin, see the DCloud official documentation or follow these steps:

  1. Go to Client SDK release notes to download the UniApp SDK and decompress it to the `nativePlugins` directory in your project.

  2. Import the local plugin.

    1. In the manifest.json file, click App Native Plugin Configuration.

    2. In the App Native Plugin Configuration section, click Select Local Plugin.

    3. In the Select Local Plugin dialog box, select the plugin to package.

  3. Create a custom debug base.

    1. To create a custom debug base, choose Run > Run To Phone Or Emulator > Create Custom Debug Base in the manifest.json file.

    2. To set a custom debug base, in the manifest.json file, choose Run > Run To Phone Or Emulator > Create Custom Debug Base > Run To Android/iOS App Base.

      Note

      To package the release version, choose Publish > Native App - Cloud Packaging.

Call the service

  1. Call the initWithOptions method to initialize the SDK. This method accepts an options JSON object.

    The options parameter, which is null by default, specifies optional data collection settings.

    Important
    • The ID Verification client includes a built-in security module known as the device helper. The device helper provides various data reporting regions to meet local data collection compliance requirements. You can set CustomUrl and CustomHost to specify different reporting sites based on user attributes.

    • Only one data reporting region can be specified per application session lifecycle. The region for server-side queries must match the reporting region. The supported regions vary by product. For more information, see Supported regions.

    • For each region, the CustomUrl is as follows:

      • China (Hong Kong): https://cloudauth-device.cn-hongkong.aliyuncs.com

      • Singapore: https://cloudauth-device.ap-southeast-1.aliyuncs.com

      • Indonesia (Jakarta): https://cloudauth-device.ap-southeast-5.aliyuncs.com

      • US (Silicon Valley): https://cloudauth-device.us-west-1.aliyuncs.com

      • Germany (Frankfurt): https://cloudauth-device.eu-central-1.aliyuncs.com

      • Malaysia (Kuala Lumpur): https://cloudauth-device.ap-southeast-3.aliyuncs.com

    Parameter

    Description

    Example

    IPv6

    Indicates whether to use an IPv6 domain name to report device information:

    • 0 (default): No (uses an IPv4 domain name)

    • 1: Yes (uses an IPv6 domain name)

    "1"

    DataSwitch

    Controls when to report device information:

    • 0 (default): When the SDK initializes

    • 1: When you obtain a token

    Note

    The default setting is recommended.

    "1"

    CustomUrl

    Sets the server domain name for data reporting.

    See CustomUrl for each region.

    CustomHost

    Sets the server host for data reporting.

    "cloudauth-device.ap-southeast-1.aliyuncs.com"

    Note

    This example is for the Singapore region. For server hosts in other regions, see CustomUrl for each region.

  2. Call `getMetaInfo` to retrieve the MetaInfo data. Pass this value when calling the ID Verification server to start a verification request.

  3. To start the verification, call `startVerify` and pass the transactionId obtained from the server-side Initialize API.

  4. Call the startVerify() method to initiate a verification request.

    The `startVerify()` method accepts the following parameters:

    • transactionId: A required parameter.

    • extParams: Optional extension parameters.

      To configure the extension parameters (extParams), see the native Android and iOS SDK documentation.

      Android

      Key

      Description

      Example (String type)

      IdentityParams.OcrResultButtonColor

      Button color on the OCR result page.

      #FF0000

      IdentityParams.RoundProgressColor

      Circle color during face scanning.

      #FF0000

      IdentityParams.ShowBlbumIcon

      Show album upload entry during OCR:

      • 1 (default): Show

      • 0: Do not show

      1

      IdentityParams.ShowOcrResult

      Show OCR recognition result page:

      • 1 (default): Show

      • 0: Do not show

      1

      IdentityParams.EditOcrResult

      OCR result page editable:

      • 1 (default): Editable

      • 0: Not editable

      1

      IdentityParams.MaxErrorTimes

      Maximum retries.

      Range: 3–10. Default: 10.

      10

      IdentityParams.CardOcrTimeOutPeriod

      OCR recognition timeout.

      Range: 20–60 seconds. Default: 20 seconds.

      20

      IdentityParams.FaceVerifyTimeOutPeriod

      Liveness detection timeout.

      Range: 20–60 seconds. Default: 20 seconds.

      20

      IdentityParams.OcrResultTimeOutPeriod

      OCR result page edit timeout.

      Default: unlimited.

      60

      IdentityParams.SdkLanguage

      You can customize the display language for the SDK. By default, the SDK uses your mobile device's system language.

      Note

      For a list of supported languages, see Customize languages for the Android and iOS SDKs.

      zh-Hans

      IdentityParams.CloseButtonLayout

      Layout of the Close button:

      • left (default): Left side

      • right: Right side

      left

      IdentityParams.WaterMark

      Watermark text after successful OCR.

      Test watermark text

      IdentityParams.Protocol

      SDK Protocol.

      Note

      Obtain protocol from the server-side Initialize API to reduce internal API calls and improve performance.

      None

      iOS

      Key

      Description

      Example (string)

      kIdentityParamKeyNextButtonColor

      The color of the bottom button on the OCR recognition result page.

      #FF0000

      kIdentityParamKeyRoundProgressColor

      The color of the circular progress indicator during the face scan.

      #FF0000

      kIdentityParamKeyOcrSelectPhoto

      Specifies whether to show the photo album upload entry during the ID OCR recognition step:

      • 1 (default): Show

      • 0: Do not show

      1

      kIdentityParamKeyShowOcrResult

      Specifies whether to show the recognition result page after the ID OCR recognition step:

      • 1 (default): Show

      • 0: Do not show

      1

      kIdentityParamKeyEditOcrResult

      Specifies whether the recognition result page is editable during the ID OCR recognition step:

      • 1 (default): Editable

      • 0: Not editable

      1

      kIdentityParamKeyMaxRetryCount

      Maximum number of retries. Valid values: 3 to 10. Default value: 10.

      10

      kIdentityParamKeyCardOcrTimeOutPeriod

      Timeout period for the OCR recognition step. Valid values: 20 to 60 seconds. Default value: 20 seconds.

      20

      kIdentityParamKeyFaceVerifyTimeOutPeriod

      Timeout period for the liveness detection step. Valid values: 20 to 60 seconds. Default value: 20 seconds.

      20

      kIdentityParamKeyCardOcrEditTimeOutPeriod

      The duration (in seconds) that the OCR recognition result page remains editable. Valid values: 60 to 180. By default, the duration is unlimited.

      180

      kIdentityParamKeyLanguage

      Sets the SDK language. By default, the SDK uses the operating system's language.

      Note

      For a list of supported languages, see Customize languages for the Android and iOS SDKs.

      zh-Hans

      kIdentityParamKeyDefaultLanguage

      Sets the default SDK language. For a list of valid values, refer to kIdentityParamKeyLanguage.

      The default value is en (English).

      en

      kIdentityParamKeyCloseButtonPosition

      The position of the close button in the SDK UI:

      • left (default)

      • right

      left

      kIdentityParamKeyWatermark

      The watermark text displayed after successful OCR recognition.

      Test watermark text

      kIdentityParamKeyProtocol

      The SDK protocol.

      Note

      Obtain the protocol by calling the server-side Initialize API and pass it in this parameter. This reduces internal SDK API interactions and improves network performance.

      968412EB*******...

      The following example shows how to pass parameters:

      // For Android,
      aliyunVerify.startVerify({
        transactionId:"<verification_id>",// Enter the transactionId obtained from the server.
        SdkLanguage:"cn"// Pass the fields in the extension parameters.	
      }, function(t){
        console.log(t)
      });
      
      // Response format
      {
        code:1000,				 // Error code
        message:"CODE_VERIFY_SUCCESS"		// Error code description
      }
  5. Call the setCustomUI() method to customize UI colors.

    params: Data in JSON format. For details about UI customization, see the native SDK documentation:

Complete code example

<template>
  <view class="button-sp-area">
  <button type="primary" plain="true" @click="init">init</button>
  <button type="primary" plain="true" @click="getMetaInfo">getMetaInfo</button>
  <button type="primary" plain="true" @click="verify">verify</button>
  <button type="primary" plain="true" @click="setCustomUi">setCustomUi</button>
		
  </view>
</template>

<script>
const aliyunVerify = uni.requireNativePlugin('VerifyIntlUniPlugin');
	
export default {
  data() {
    return {
      title: ''
    }
  },
  onLoad() {
			
  },
  methods: {
    init:function() {
      console.log("init");
      const json={
        CustomUrl:"https://cloudauth-device.ap-southeast-5.aliyuncs.com",
        CustomHost:"cloudauth-device.ap-southeast-5.aliyuncs.com"
      };
      aliyunVerify.initWithOptions(json);
    },
    getMetaInfo:function() {
      console.log("getMetaInfo");
      var t = aliyunVerify.getMetaInfo();
      console.log(t);
      uni.showToast({
        title: t,
        icon: 'none'
      });
    },
    setCustomUi:function(){
      const json={
        faceConfig:{faceBGColor:"#FF00FF"}
      };
      var t = aliyunVerify.setCustomUI(JSON.stringify(json));
      console.log("setCustomUi"+t);
    },
    verify:function(){
      console.log("Face Verify");
      aliyunVerify.startVerify({
          transactionId:"xxxxx",// Verification ID
        }, 
       function(t){
         console.log(t);
         const msg = JSON.stringify(t);
         console.log(msg);
         // uni.showToast({
         // 	title: t,
         // 	icon: 'none'
         // });
       });
    }
  }
}
</script>
<style>
button {
  margin-top: 30upx;
  margin-bottom: 30upx;
}

.button-sp-area {
  margin: 0 auto;
  width: 60%;
}

.content {
  text-align: center;
  height: 400upx;
}

.wrapper {
  flex-direction: column;
  justify-content: center;
}

.button {
  width: 200px;
  margin-top: 30px;
  margin-left: 20px;
  padding-top: 20px;
  padding-bottom: 20px;
  border-width: 2px;
  border-style: solid;
  border-color: #458B00;
  background-color: #458B00;
}

.text {
  font-size: 30px;
  color: #666666;
  text-align: center;
}
</style>

For a complete example, download the UniApp Demo from Client SDK release notes.

Important

This demo is for reference only. Use the latest SDK version for your application.

Error codes

Error code

Description

1000

Verification successful.

This result is for reference only. Call the server-side CheckResult API for the final verification result.

1001

Verification failed.

To get detailed failure reasons, call the server-side CheckResult API.

1002

System error.

1003

SDK initialization failed. Check if the client time is correct.

1004

Camera permission error. To resolve this issue:

  1. Before verification, ensure that the app has camera permission.

  2. If the permission error persists after you grant the permission, clear the app cache and retry.

1005

Network error.

1006

User exited.

1007

Invalid TransactionId.

1009

Client timestamp error.

1011

Incorrect certificate type submitted.

1012

Key information from the detected certificate is missing or the format check failed.

1013

Poor image quality.

1014

The error count exceeded the upper limit.

1015

The Android system version is too low.

1016

Camera permission not granted.