### Install SDK using npm Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/doc-web Install the SDK in your Node.js project using npm. ```Text cmd npm install @clear.sale/docs-web-sdk ``` -------------------------------- ### Install SDK using yarn Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/doc-web Install the SDK in your Node.js project using yarn. ```Text cmd yarn add @clear.sale/docs-web-sdk ``` -------------------------------- ### Install Dependencies Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/ios Installs all the dependencies listed in your Podfile. After this command, ensure you open the .xcworkspace file for development. ```bash pod install ``` -------------------------------- ### Initialize and Start Facial Biometrics in Swift Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/ios This snippet shows how to get an instance of AllowMe and start the facial biometrics process. Ensure you have your API key and a valid viewController and delegate. ```swift let allowMe = try AllowMe.getInstance(withApiKey: "your-api-key-here") allowMe.startBiometrics(viewController: yourViewController, delegate: yourDelegate, config: AllowMeBiometricsConfig()) ``` -------------------------------- ### Install SDK using npm Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/sdk-captura-de-documentos-web Install the SDK package using npm. This is the standard way to add the SDK to a Node.js project. ```bash npm install @clear.sale/sdk-docs-web ``` -------------------------------- ### Initialize AllowMe and Start Address Validation in AppDelegate.mm Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/react-native This snippet shows how to initialize the AllowMe instance with an API key and start the address validation process within the `didFinishLaunchingWithOptions` method of your AppDelegate.mm file. It includes error handling for both instance creation and the start method. ```Objective-C @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { {...} NSError* error = nil; AllowMe* allowMe = [AllowMe getInstanceWithApiKey:ALLOWME_API_KEY error: &error]; if(error == nil) { NSError* startError = [allowMe start]; if(startError != nil) { NSLog(@"Start Error: %@", [startError localizedDescription]); } } else { NSLog(@"AllowMe Instance Error: %@",[error localizedDescription]); } {...} } @end ``` -------------------------------- ### Install SDK using yarn Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/sdk-captura-de-documentos-web Install the SDK package using yarn. This is an alternative to npm for managing project dependencies. ```bash yarn add @clear.sale/sdk-docs-web ``` -------------------------------- ### Login Function Example Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/doc-web Example implementation of the login function, which must return an object with 'accessToken' and 'expiresIn'. The authentication token should be obtained server-side. ```javascript const login = () => { // Realiza uma requisição de autenticação e retorna o token e o tempo de expiração, // que devem ser retornados pelo método de login. return fetch('https:///clear-sale-auth', { method: 'POST', headers: { 'Content-Type': 'application/json', } }) .then(response => response.json()) .then(data => { return { accessToken: data.accessToken, expiresIn: data.expiresIn }; }); }; // Instanciação do SDK const SDK = SDKClearSale({ login, ... }); ``` -------------------------------- ### Flutter SDK Setup Method Call Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/flutter This Dart code snippet shows how to invoke the 'setup' method on the native side using platform channels in Flutter. ```dart Future _setupSDK() async { String setupResult = "Not started yet"; try { setupResult = await platform.invokeMethod('setup'); } on PlatformException catch (e) { setupResult = "Failed to setup AllowMe '\(e.message)'."; } _setAllowMeResult(setupResult); } ``` -------------------------------- ### Install Cocoapods Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/ios Installs Cocoapods if it's not already present on your system. This is a prerequisite for managing iOS project dependencies. ```bash sudo gem install cocoapods ``` -------------------------------- ### Start Address Validation Onboarding Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/flutter Initiates the onboarding process for address validation. This method is called when Flutter sends the 'start' method call. ```kotlin private fun startOnboarding(result: MethodChannel.Result) { mAllowMe.start(object: StartCallback{ override fun success() { result.success("Start Onboarding Success!") } override fun error(throwable: Throwable) { result.error("Start Onboarding Failed: ", throwable.message,null) } }) } ``` -------------------------------- ### Flutter SDK Start Method Call Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/flutter This Dart code snippet shows how to invoke the 'start' method to initialize the SDK on the native side using platform channels in Flutter. ```dart Future _startSDK() async { String startResult = "Not started yet"; try { startResult = await platform.invokeMethod('start'); } on PlatformException catch (e) { startResult = "Failed to start SDK '\(e.message)'."; } _setAllowMeResult(startResult); } ``` -------------------------------- ### Consultar Resultado de Análise de Documento (GET) Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/resultado-de-aidocs Utilize o método GET para consultar o resultado de uma análise de documento processada. Os endpoints variam entre homologação e produção. Esta consulta não tem custo. ```json > 👍 Qualquer consulta via método GET não tem cobrança! > 📘 Endereço dos nossos serviços: > > **Homologação**: **GET** > **Produção**: **GET** > > Acesse aqui a **[documentação técnica](https://devs.plataformadatatrust.clearsale.com.br/reference/obtem-o-resultado-de-uma-validacao-de-identidade-por-documento)** ``` -------------------------------- ### Start Biometrics Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/ios Initializes and starts the facial biometrics process using the AllowMeSDK. This method requires a view controller to present the biometric screens, a delegate to handle callbacks, and an optional configuration object. ```APIDOC ## Start Biometrics ### Description Initializes and starts the facial biometrics process using the AllowMeSDK. This method requires a view controller to present the biometric screens, a delegate to handle callbacks, and an optional configuration object. ### Method `startBiometrics(viewController:delegate:config:)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```swift let allowMe = try AllowMe.getInstance(withApiKey: "your-api-key-here") allowMe.startBiometrics(viewController: yourViewController, delegate: yourDelegate, config: AllowMeBiometricsConfig()) ``` ### Response #### Success Response This method initiates a process that is handled asynchronously via the `AllowMeBiometricsDelegate`. #### Response Example None directly returned; results are handled via delegate methods. ``` -------------------------------- ### Flutter Address Validation - Start Method Initialization Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/flutter This snippet demonstrates the native iOS implementation for initializing AllowMe and starting the Address Validation service during app launch. It includes basic error handling for initialization. ```swift override func application (_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { do { self.allowMe = try AllowMe.getInstance(withApiKey: ALLOWME_API_KEY) if let error = self.allowme.start() { // tratar erro } else { // sucesso } } catch let error { // tratar erro } {...} } ``` -------------------------------- ### Initialize SDK with Configuration Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/doc-web Complete example of SDK initialization, including required login function, transaction ID, environment, identity, colors, and flow types. The init() method returns a sessionId or an error. ```javascript import { SDKClearSale, FLOW_TYPES, ENVIRONMENTS } from '@clear.sale/docs-web-sdk'; // Função de login const login = () => { // Implementar lógica de login aqui. }; // Inicializar o SDK const SDK = SDKClearSale({ login, // Obrigatório. Função de login. transactionId: 'transaction-id', // Obrigatório. Transaction que deve criada previamente environment: { // Opcional. Valor padrão será ENVIRONMENTS.PRD env: ENVIRONMENTS.HML, }, identity: { // Obrigatório. Identificadores de uso. identifierId: 'app-identifier', // Identificador cpf: 'user-cpf', // CPF do usuário }, colors: { // Obrigatório. Cores usadas pelo SDK. primary: '#ff4800', // Cor primária secondary: '#ff4800', // Cor secundária tertiary: '#e6e6e6', // Cor terciária title: '#283785', // Cor do título paragraph: '#353840', // Cor do parágrafo background: '#FFFFFF', // Cor do background }, flowTypes: [FLOW_TYPES.CAPTURE, FLOW_TYPES.UPLOAD], // Opcional. Ambos os tipos serão usados com onUploadedDocumentError, // Opcional, mas se presente deve ser uma função }); // Configuração do SDK SDK.init() .then(result => { // Resultado do SDK contendo sessionId console.log(`Resultado do SDK: ${result}`); }) .catch(error => { // Em caso de erro na captura console.log(`Erro do SDK: ${error}`); }); ``` -------------------------------- ### Implement initSetup Method for AllowMe SDK Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/react-native Export the initSetup method using RCT_EXPORT_METHOD to initialize the AllowMe SDK. This method handles API key setup and returns a promise that resolves on success or rejects with an error. ```Objective-C @implementation AllowMeBridge AllowMe* mAllowMe; RCTPromiseRejectBlock mReject; RCT_EXPORT_MODULE(); RCT_EXPORT_METHOD(initSetup:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { mReject = reject; [self getAllowMeInstance]; [mAllowMe setupWithCompletion:^(NSError * setupError) { if(setupError == nil) { resolve(@"setup success"); } else { reject(@"Setup Error", [setupError localizedDescription], setupError); } }]; }; - (void) getAllowMeInstance { if (mAllowMe == nil) { NSError* error = nil; mAllowMe = [AllowMe getInstanceWithApiKey:ALLOWME_API_KEY error: &error]; if(error != nil) { mReject(@"AllowMe Instance Error", [error localizedDescription], error); } } } @end ``` -------------------------------- ### Initialize AllowMe SDK with Callback Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/android Initialize the AllowMe SDK using a callback function for success and error handling. Ensure a stable internet connection during initialization. ```kotlin allowMe.setup( { // Inicializado com Sucesso }, { // Algum erro aconteceu } ) ``` -------------------------------- ### Initialize AllowMeSDK in AppDelegate Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/ios This snippet shows how to initialize the AllowMeSDK using a singleton pattern and set up its completion handler within the application's launch process. Ensure a valid internet connection is available during setup. ```swift import AllowMeSDK @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { do { let allowMe = try AllowMe.getInstance(withApiKey: ALLOWME_API_KEY) allowMe.setup { (error) in if error != nil { // tratar erro } else { // sucesso } } } catch let error { // tratar erro } return true } {...} } ``` -------------------------------- ### Pré-carregar SDK para Reduzir Tempo de Carregamento Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/sdk-captura-de-documentos-web Chame o método `preLoad` antes da inicialização do SDK para autenticar e preparar dados, incluindo o download do modelo de machine learning. Isso melhora a experiência do usuário. ```javascript // Instanciação do SDK const SDK = SDKClearSale({ ... }); // Em algum momento da aplicação em que se possa prever o uso do SDK, // chamar o método preLoad usando a instância criada anteriormente. SDK.preLoad({ onLoaded: auth => console.log(`Pré-carregamento concluído com sucesso. ${auth}`) }); ``` -------------------------------- ### Initialize Podfile Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/ios Creates a Podfile in your project's root directory, which is used to manage dependencies. Run this command in your project's .xcodeproj directory. ```bash pod init ``` -------------------------------- ### Flutter Native Communication Channel Setup Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/flutter Implement this in your FlutterFragmentActivity to establish a communication channel with your Flutter app. It handles the initial setup of the AllowMeSDK. ```kotlin import {...} class MainActivity : FlutterFragmentActivity() { private val CHANNEL = "br.com.samples.allowme/sdk" lateinit var mAllowMe: AllowMe override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // Criação da instância AllowMe mAllowMe = AllowMe.getInstance( applicationContext, applicationContext.getString(R.string.api_key) ) } override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { super.configureFlutterEngine(flutterEngine) MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler { call, result -> when (call.method) { "setup" -> setupAllowMe(result) else -> result.notImplemented() } } } private fun setupAllowMe(result: MethodChannel.Result){ mAllowMe.setup(object: SetupCallback{ override fun success(){ result.success("Setup Allow Me success") } override fun error(throwable: Throwable){ result.error("Setup failed: ", throwable.message, null) } }) } } ``` -------------------------------- ### Set up FlutterMethodChannel and AllowMe SDK Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/flutter This code snippet demonstrates how to set up a `FlutterMethodChannel` for communication between Flutter and native iOS code. It also shows how to initialize and set up the AllowMe SDK, which is recommended to be called during application startup. ```swift import {...} @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { var allowMe: AllowMe? var methodChannel: FlutterMethodChannel? override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { let controller : FlutterViewController = window?.rootViewController as! FlutterViewController methodChannel = FlutterMethodChannel(name: "br.com.samples.allowme/sdk", binaryMessenger: controller.binaryMessenger) // Você pode chamar o setup sempre na inicialização do aplicativo iOS (recomendado). // Nesse exemplo chamaremos apenas ao clicar no botão setup do { self.allowMe = try AllowMe.getInstance(withApiKey: "your-api-key-here") } catch let error { // tratar erro } methodChannel?.setMethodCallHandler({(call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in if self.allowMe != nil { if (call.method == "setup") { self.allowMe?.setup { (error) in if error != nil { // tratar erro result(FlutterError(code: "SetupError", message: error?.localizedDescription, details: error)) } else { // sucesso result("Setup Success!!") } } } else { result(FlutterMethodNotImplemented) } } else { result(FlutterMethodNotImplemented) } }) GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } } ``` -------------------------------- ### Get AIDocs Analysis Result Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/resultado-de-aidocs Retrieve the result of an AIDocs analysis for a given transaction ID. This operation is free of charge when using the GET method. ```APIDOC ## GET /v1/transaction/{id}/ai-docs ### Description Retrieves the result of a processed AIDocs analysis using the transaction ID. ### Method GET ### Endpoint - Homologation: `https://datatrustapihml.clearsale.com.br/v1/transaction/{id}/ai-docs` - Production: `https://datatrustapi.clearsale.com.br/v1/transaction/{id}/ai-docs` ### Parameters #### Path Parameters - **id** (string) - Required - The transaction ID returned by the document analysis request. ### Response #### Success Response (200) - **type** (Enum) - Type of document sent. - **transactionId** (String) - Identifier generated by the Data Trust Platform transaction (Length: 36). - **identifierId** (String) - Identifier sent by the client (Length: *). - **processStatusCode** (Integer) - Code for the current analysis processing step. - **processStatus** (Enum) - Description of the current analysis processing step. - **statusCode** (Enum) - Code for the analysis status. - **status** (Enum) - Description of the status. - **subStatusCode** (Enum) - Code for the analysis sub-status (detailing). - **subStatus** (String) - Classification of the analysis (detailing). - **receivedDate** (DateTime) - Date the analysis was received. - **endDate** (DateTime) - Date the analysis processing ended. - **isDigital** (Boolean) - Identifies if the document is digital (true/false). - **ocr** (Array) - Data extracted from the document. Returns null if data cannot be obtained. ### Response Example ```json { "type": 1, "transactionId": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "identifierId": "1234567890", "processStatusCode": 2, "processStatus": "Concluído", "statusCode": 3, "status": "Sem risco aparente", "subStatusCode": 0, "subStatus": "N/A", "receivedDate": "2023-10-27T10:00:00Z", "endDate": "2023-10-27T10:05:00Z", "isDigital": true, "ocr": [ { "fieldName": "name", "value": "John Doe" } ] } ``` ### Enum Details #### Type - 0: NotSet - 1: RG (Carteira de Identidade) - 2: CNH (Carteira Nacional de Habilitação) - 3: RNE/RNM (Registro Nacional de Estrangeiro) - 4: CIN (Carteira de Identidade Nacional) - 5: DNI (Documento Nacional de Identidade) - 99: Invalid #### ProcessStatusCode - 1: Em processamento - 2: Concluído - 3: Erro #### StatusCode and Status - 0: Em processamento - 1: Não é possível analisar - 2: Suspeita de fraude - 3: Sem risco aparente - 5: Regra de negócio não atendida #### SubstatusCode and Substatus (Details for substatus codes and their descriptions are available in the full documentation.) ``` -------------------------------- ### Webhook Callback Request Example Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/notificacao-de-alteracao-de-transacao-webhook This is an example of the JSON payload sent by the Clearsale Webhook when a transaction alteration occurs. The integrador should implement a URL to receive these notifications. ```APIDOC ## Webhook Callback Request ### Description This is an example of the JSON payload sent by the Clearsale Webhook when a transaction alteration occurs. The integrador should implement a URL to receive these notifications. ### Method POST ### Endpoint `{URL_CADASTRADA}` ### Headers - `Authorization`: `Bearer {TOKEN_CADASTRADO}` - `Content-Type`: `application/json; charset=utf-8` ### Request Body - **Code** (string) - Required - The code of your transaction. - **TypeId** (integer) - Required - The type of validation. - **IdentifierId** (string) - Required - Your identifier ID. - **Description** (string) - Required - Description of the alteration. - **Date** (string) - Required - The date and time of the alteration (ISO 8601 format). - **PackIdentifier** (string) - Optional - The name of the Pack. - **Result** (string) - Optional - The result of the alteration. ### Request Example ```json { "Code": "{CODIGO_DA_SUA_TRANSAÇÃO}", "TypeId": 2, "IdentifierId" : "{SEU_IDENTIFIER_ID}", "Description": "{DESCRIÇÃO_DA_ALTERAÇÃO}", "Date": "2020-12-28T12:45:00.000", "PackIdentifier": "{Nome do Pack}", "Result":"{DEVOLUÇÃO_DE_RESULTADOS}" } ``` ### Response #### Success Response (200) - The webhook will send a success status code upon receiving the notification. The actual response body is not specified in the documentation. #### Response Example (Not specified in the documentation) ``` -------------------------------- ### Get AIDocs Analysis Result (Production) Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/resultado-aidocsbio Use this GET endpoint to retrieve the analysis results in the production environment. Ensure you have the transaction ID from the initial analysis request. ```HTTP GET https://datatrustapi.clearsale.com.br/v1/transaction/{id}/ai-docs ``` -------------------------------- ### SDK Initialization with Environment Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/doc-web Specify the target environment (HML for homologation, PRD for production) for SDK requests. ```APIDOC ## SDK Initialization with Environment ### Description Sets the target environment for all SDK requests. ### Parameters - **environment** (object) - Optional - An object specifying the environment: - **env** (string) - Required - The environment to use. Possible values: `HML` (homologation), `PRD` (production). ``` -------------------------------- ### SDK Initialization with Colors Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/doc-web Customize the SDK's appearance by providing color values for various UI elements. ```APIDOC ## SDK Initialization with Colors ### Description Customizes the visual appearance of the SDK by setting theme colors. ### Parameters - **colors** (object) - Optional - An object containing color definitions: - **primary** (string) - Main action button/outline color. - **secondary** (string) - Icon and feedback bar color. - **tertiary** (string) - Large informative icon background color. - **title** (string) - Title text color. - **paragraph** (string) - Paragraph text and close button color. - **background** (string) - Background color for all screens. ``` -------------------------------- ### Get SmartOCR Analysis Result Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/resultado-de-smartocr You can query the result of a processed analysis using the transactionID returned in the document analysis request. Any GET method query is free of charge. ```APIDOC ## GET /v1/transaction/{id}/ai-docs ### Description Retrieves the result of a SmartOCR analysis for a given transaction ID. ### Method GET ### Endpoint - **Homologation**: `https://datatrustapihml.clearsale.com.br/v1/transaction/{id}/ai-docs` - **Production**: `https://datatrustapi.clearsale.com.br/v1/transaction/{id}/ai-docs` ### Parameters #### Path Parameters - **id** (string) - Required - The transaction ID of the analysis to retrieve. ### Response #### Success Response (200) - **type** (Enum) - Type of document sent. - **transactionId** (String) - Identifier generated by the Data Trust Platform transaction. - **identifierId** (String) - Identifier sent by the client. - **processStatusCode** (Integer) - Code for the current step of the analysis processing. - **processStatus** (Enum) - Description of the current step of the analysis processing. - **statusCode** (Enum) - Code for the analysis status. - **status** (Enum) - Description of the status. - **subStatusCode** (Enum) - Code for the analysis sub-status (detailing). - **subStatus** (String) - Classification of the analysis (detailing). - **receivedDate** (DateTime) - Date the analysis was received. - **endDate** (DateTime) - Date the analysis processing ended. - **isDigital** (Boolean) - Indicates if the document is digital. - **ocr** (Array) - Data extracted from the document. Returns null if data could not be obtained. ``` -------------------------------- ### Get AIDocs Analysis Result (Homologation) Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/resultado-aidocsbio Use this GET endpoint to retrieve the analysis results in the homologation environment. Ensure you have the transaction ID from the initial analysis request. ```HTTP GET https://datatrustapihml.clearsale.com.br/v1/transaction/{id}/ai-docs ``` -------------------------------- ### AllowMeBridge Initialization and Setup Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/react-native This snippet shows how to set up the AllowMe SDK within a React Native bridge. It handles API key configuration for debug and release builds and exports the `initSetup` method for initializing the SDK. ```APIDOC ## initSetup ### Description Initializes the AllowMe SDK with the provided API key. This method should be called before using other AllowMe SDK functionalities. ### Method RCT_EXPORT_METHOD ### Parameters - **resolve** (RCTPromiseResolveBlock) - Callback for successful initialization. - **rejecter** (RCTPromiseRejectBlock) - Callback for initialization errors. ### Request Example ```javascript AllowMeBridge.initSetup().then(result => console.log(result)).catch(error => console.error(error)); ``` ### Response #### Success Response (200) - **message** (string) - Indicates successful setup, e.g., "setup success". #### Response Example ```json "setup success" ``` ``` -------------------------------- ### SDK Initialization with Environment Setting Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/doc-web Specify the target environment (HML for homologation or PRD for production) for SDK requests. Import ENVIRONMENTS from the SDK to set the desired environment. ```javascript import { ENVIRONMENTS } from '@clear.sale/docs-web-sdk'; // Instanciação do SDK const SDK = SDKClearSale({ environment: { env: ENVIRONMENTS.HML, }, ... }); ``` -------------------------------- ### Get AIDocs + Bio Analysis Result Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/resultado-aidocsbio Retrieve the result of an AI-driven document analysis using the transaction ID. This endpoint is available for both homologation and production environments and is free of charge when using the GET method. ```APIDOC ## GET /v1/transaction/{id}/ai-docs ### Description Retrieves the result of an AI-driven document analysis using the provided transaction ID. ### Method GET ### Endpoint - **Homologation**: `https://datatrustapihml.clearsale.com.br/v1/transaction/{id}/ai-docs` - **Production**: `https://datatrustapi.clearsale.com.br/v1/transaction/{id}/ai-docs` ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier for the transaction. ### Response #### Success Response (200) - **type** (Enum) - Type of document sent. - **transactionId** (String) - Identifier generated by the Data Trust Platform transaction. - **identifierId** (String) - Identifier sent by the client. - **processStatusCode** (Integer) - Code for the current analysis processing step. - **processStatus** (Enum) - Description of the current analysis processing step. - **statusCode** (Enum) - Code for the analysis status. - **status** (Enum) - Description of the status. - **subStatusCode** (Enum) - Code for the analysis sub-status (detailing). - **subStatus** (String) - Classification of the analysis (detailing). - **receivedDate** (DateTime) - Date the analysis was received. - **endDate** (DateTime) - Date the analysis processing ended. - **isDigital** (Boolean) - Indicates if the document is digital. - **ocr** (Array) - Data extracted from the document. Returns null if data cannot be obtained. ``` -------------------------------- ### Navigate to AllowMeSDK Production Directory Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/ios After cloning, use this command to enter the production SDK directory in your terminal. ```bash cd allowme_productionIOS ``` -------------------------------- ### Configuração de Cores para SDK Liveness (JavaScript) Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/sdk-liveness-customizacao-de-ui Inicializa o SDK Liveness com cores personalizadas no ambiente web usando JavaScript. Inclui a definição das cores e a abertura do SDK após a inicialização. ```JavaScript try { const colors = { primary:'#ff4800', secondary:'#ff0000', title:'#283785', paragraph: '#353840' } sdk = new CSLiveness.Instance({ transactionId, accessToken, colors }) } catch (e) {} sdk.on('onReady', () => { sdk.open() }) ``` -------------------------------- ### GET /v2/transaction/{id}/facematch Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/consultar-resultado-do-facematch-copy-1 Retrieves the results and current status of a Facematch transaction. ```APIDOC ## GET /v2/transaction/{id}/facematch ### Description Retrieves the results and current status of a Facematch transaction. ### Method GET ### Endpoint /v2/transaction/{id}/facematch ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the transaction to query. #### Request Body This endpoint does not require a request body. ### Response #### Success Response (200) - **scoreSimilarity** (double) - The similarity score between the faces (0 to 1). - **isMatch** (boolean) - Indicates if the photos are of the same person. - **document** (string) - The document number provided in the transaction. - **transactionId** (string) - The transaction ID generated by the DataTrust Platform. - **identifierId** (string) - The value sent in the transaction. - **transactionStatus** (string) - The status of the transaction (e.g., "Done", "Processing", "Error"). - **transactionStatusCode** (integer) - The status code of the transaction (0: Processing, 1: Completed, 2: Error). - **observation** (string[]) - Additional observations, such as "Multiple faces detected on request." #### Error Response - **404 Not Found**: Returned if the transaction is not found. - **500 Internal Server Error**: Returned if there is an internal server error. ### Response Example (200 Ok) ```json { "scoreSimilarity": 0.99, "isMatch": true, "document": "12345678909", "transactionId": "8f10a24cac2b4ce78819d78bc1deb87b", "identifierId": "testePDTApiHML", "transactionStatus": "Done", "transactionStatusCode": 1, "observation": "Multiple faces detected on request." } ``` ``` -------------------------------- ### SDK Initialization with Identification Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/doc-web When initializing the SDK, you must provide an identifier and the user's CPF for identification. ```APIDOC ## SDK Initialization ### Description Initializes the SDK with user identification details. ### Parameters - **identifierId** (string) - Required - A unique string (up to 100 characters) identifying the user's flow. - **cpf** (string) - Required - An 11-character string in CPF format identifying the user. ``` -------------------------------- ### GET /transaction/{id}/facematch Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/consulta-facematch Retrieves the results and current status of a Facematch service request. ```APIDOC ## GET /transaction/{id}/facematch ### Description This endpoint allows you to retrieve the results and the current status of a Facematch service that was previously requested. ### Method GET ### Endpoint `/v1/transaction/{id}/facematch` ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the transaction. #### Request Headers - **Authorization** (string) - Required - Bearer token for authentication. ### Request Example ```json GET https://datatrustapi.clearsale.com.br/v1/transaction/3fa85f64-5717-4562-b3fc-2c963f66afa6/facematch HTTP/1.1 Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Response #### Success Response (200 OK) - **document** (string) - The document number provided in the transaction. - **confiability** (integer) - The confidence level of the match, ranging from 0 to 6. - **isMatch** (boolean) - Indicates if the photos belong to the same person. - **transactionId** (string) - The unique identifier for the transaction. - **transactionStatus** (string) - The status of the transaction (e.g., Success, Processing, Error). - **message** (string) - A message providing details in case of any processing errors. #### Response Example (200 OK) ```json { "document": "12345678912", "confiability": 6, "isMatch": true, "transactionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "transactionStatus": "Success", "message": "" } ``` #### Error Responses - **204 No Content**: No results available for display. - **401 Unauthorized**: The provided token is expired or invalid. - **403 Forbidden**: Insufficient permissions to access the resource. - **404 Not Found**: The requested resource was not found. - **500 Internal Server Error**: An error occurred during the processing of the request. ``` -------------------------------- ### Import AllowMe SDK based on Build Type Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/flutter Import the appropriate AllowMe SDK (Debug/Homologation or Release/Production) based on the current build type. Ensure you have the correct API keys for each environment. ```swift #if DEBUG import AllowMeSDKHomolog let ALLOWE_API_KEY = "your-homolog-api-key-here" #else import AllowMeSDK let ALLOWE_API_KEY = "your-prod-api-key-here" #endif ``` -------------------------------- ### Pre-loading the ClearSale SDK Source: https://devs.plataformadatatrust.serasaexperian.com.br/docs/doc-web Instantiate the SDK and call the preLoad method to prepare it for use. The onLoaded callback is invoked upon successful pre-loading, providing authentication details. ```javascript // Instanciação do SDK const SDK = SDKClearSale({ ... }); // Em algum momento da aplicação em que se possa prever o uso do SDK, // chamar o método preLoad usando a instância criada anteriormente. SDK.preLoad({ onLoaded: auth => console.log(`Pré-carregamento concluído com sucesso. ${auth}`) }); ```