> For the complete documentation index, see [llms.txt](https://docs.complycube.com/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.complycube.com/documentation/sdks/sdks-es/integraciones-web/hosted-solution-quick-guide/hosted-solution-quick-guide-1.md).

# Integración basada en comprobaciones

## Descripción general

Esta guía te guía paso a paso en la integración de la Solución Alojada con ComplyCube utilizando el enfoque basado en comprobaciones, dándote control directo sobre los pasos de verificación individuales.

{% hint style="info" %}
Para un ejemplo rápido de copiar y pegar, usa nuestro [asistente de integración](https://portal.complycube.com/developers).
{% endhint %}

{% hint style="warning" %}
Estás viendo la **basado en comprobaciones** guía del SDK: un enfoque que ofrece un control detallado, pero es más adecuado para **socios** o **casos de uso avanzados.**  Recomendamos usar **integración del flujo de trabajo** para la mayoría de las implementaciones.
{% endhint %}

## Guía de integración

<figure><img src="/files/90aba7be7e42dc2b06a117a491f633b895f2d5d4" alt=""><figcaption><p>Guía de integración del flujo (Solución alojada)</p></figcaption></figure>

La Solución alojada de ComplyCube requiere una **sesión de la Solución alojada** que debe ser iniciada por tu backend. Así es como funciona:

{% stepper %}
{% step %}

#### **Crear un cliente**

Toda sesión de la Solución alojada comienza con un **cliente** (es decir, cliente). Usa la API para [crear el cliente](/documentation/api-reference/core-resources/clients/create-a-client.md).

**Ejemplo de solicitud**

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST https://api.complycube.com/v1/clients \
     -H 'Authorization: <YOUR_API_KEY>' \
     -H 'Content-Type: application/json' \
     -d '{
          "type": "person",
          "email": "john.doe@example.com",
          "personDetails":{
               "firstName": "John",
               "lastName" :"Doe"
          }
        }'
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const { ComplyCube } = require("@complycube/api");

const complycube = new ComplyCube({ apiKey: "<YOUR_API_KEY>" });

const client = await complycube.client.create({
  type: "person",
  email: "john.doe@example.com",
  personDetails: {
    firstName: "John",
    lastName: "Doe"
  }
});
```

{% endtab %}

{% tab title="Python" %}

```python
from complycube import ComplyCubeClient
cc_api = ComplyCubeClient(api_key='<YOUR_API_KEY>')

new_client = {
    'type':'person',
    'email':'john.doe@example.com',
    'personDetails': {
        'firstName':'John',
        'lastName':'Doe'
    }
}

client = cc_api.clients.create(**new_client)
```

{% endtab %}

{% tab title="PHP" %}

```php
use ComplyCube\ComplyCubeClient;

$ccapi = new ComplyCubeClient('<YOUR_API_KEY>');

$result = $ccapi->clients()->create([
    'type' => 'person',
    'email' => 'john@doe.com',
    'personDetails' => [
        'firstName' => 'John',
        'lastName' => 'Doe'
    ]
]);
```

{% endtab %}

{% tab title=".NET" %}

```csharp
using ComplyCube.Net;
using ComplyCube.Net.Resources.Clients;

var clientApi = new ClientApi(new ComplyCubeClient("<YOUR_API_KEY>"));
var newClient = new ClientRequest {
  type = "person",
  email = "john@doe.com",
  personDetails = new PersonDetails {
    firstName = "John",
    lastName = "Doe"
  }
}

var client = await clientApi.CreateAsync(newClient);
```

{% endtab %}
{% endtabs %}

**Ejemplo de respuesta**

La respuesta contendrá un `id` (el ID del cliente). Es necesario para el siguiente paso.

```json
{
    "id": "5eb04fcd0f3e360008035eb1",
    "type": "person",
    "email": "john.doe@example.com",
    "personDetails": {
        "firstName": "John",
        "lastName": "Doe",
    },
    "createdAt": "2020-01-04T17:24:29.146Z",
    "updatedAt": "2020-01-04T17:24:29.146Z"
}
```

{% hint style="info" %}
Consulta [Referencia de la API de clientes](/documentation/api-reference/core-resources/clients.md) para obtener más información.
{% endhint %}
{% endstep %}

{% step %}

#### Generar una sesión de la Solución alojada

Una **sesión de la Solución alojada** crea una URL única de ComplyCube que puedes usar para redirigir a tus clientes para completar su verificación de identidad. Una vez completado, tus clientes serán redirigidos a la URL que hayas elegido.

**Ejemplo de solicitud**

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST https://api.complycube.com/v1/flow/sessions \
     -H 'Authorization: <YOUR_API_KEY>' \
     -H 'Content-Type: application/json' \
     -d '{
          "clientId":"CLIENT_ID",
          "checkTypes": ["extensive_screening_check", "identity_check", "document_check"],
          "successUrl": "https://www.yoursite.com/success",
          "cancelUrl": "https://www.yoursite.com/cancel"
        }'
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const { ComplyCube } = require("@complycube/api");

const complycube = new ComplyCube({ apiKey: "<YOUR_API_KEY>" });

const session = await complycube.flow.createSession("CLIENT_ID", {
    checkTypes: [
      "extensive_screening_check",
      "identity_check",
      "document_check"
    ],
    successUrl: "https://www.yoursite.com/success",
    cancelUrl: "https://www.yoursite.com/cancel",
    theme: "light"
});
```

{% endtab %}

{% tab title="Python" %}

```python
from complycube import ComplyCubeClient
cc_api = ComplyCubeClient(api_key='<YOUR_API_KEY>')

flow_session = {
    'clientId': client.id,
    'checkTypes':[
        'extensive_screening_check',
        'identity_check',
        'document_check'
    ],
    'successUrl':'https://www.yoursite.com/success',
    'cancelUrl':'https://www.yoursite.com/cancel',
    'theme': 'light'
}

session = cc_api.flow.create(**flow_session)
```

{% endtab %}

{% tab title="PHP" %}

```php
use ComplyCube\ComplyCubeClient;

$ccapi = new ComplyCubeClient('<YOUR_API_KEY>');
$session = $ccapi->flow()->createSession([
    'clientId' => $clientId,
    'checkTypes' => [
        'extensive_screening_check',
        'identity_check',
        'document_check'
    ],
    'successUrl' => 'https://www.yoursite.com/success',
    'cancelUrl' => 'https://www.yoursite.com/cancel',
    'theme' => 'light'
]);
```

{% endtab %}

{% tab title=".NET" %}

```csharp
using ComplyCube.Net;
using ComplyCube.Net.Resources.FlowSessions;

var fSession = new FlowSessionApi(new ComplyCubeClient("<YOUR_API_KEY>"));

var flowSession = new FlowSessionRequest {
  clientId = aClient.id,
  checkTypes = new string[] {
    "extensive_screening_check",
    "identity_check",
    "document_check"
  },
  successUrl = "http://complycube.com",
  cancelUrl = "http://complycube.com"
};

var result = fSession.CreateAsync(flowSession).Result;
```

{% endtab %}
{% endtabs %}

**Ejemplo de respuesta**

{% code overflow="wrap" %}

```json
{
    "redirectUrl": "https://flow.complycube.com/test_ODdkNjhiOTU0MzY4YmE5NjRmMDMyY2E5MWYwZjgxNjMzZTcyMWJmNzU2YjZmNDQ4NmFjMTU0ZGZhYTU5MmNhY2NiNjI3ZDE4YWJkYmU2M2M3ZWYzZTlmM2M3MzgxMmM3NzZhMjVlYmQyNDI0ODdkOWQ3M2JiMjkxZTYxNzdhYmExMGEzOGRhYmM2OTIwMjgyYmEzZGY3ZDY0NWZhMjcwN2RlMTFkOTcxZWNhOWI2Zjg0NjllZGNkODVjYzMzMDA5YjdlMWY5OGIwMmZjY2UzNGI2YTMxOGQxNGZmNGFhYjczNzU0YmYwMjFkMzU1M2FjMjQ4ZDQ2ZjJjZTY4YWY0MzIxNjVlMDRjOTIyYTExMTlmMWU3YTYwMDY1NGJmYWM0NTA2MDE5NTg5NTkxYzA4MzYyYTUyM2I0NDM4OGExNWIyMTIzYTBhNDc0NDA4NWM2ZTQwMmNjMGVjMTk2YW"
}
```

{% endcode %}

{% hint style="info" %}
Consulta [Referencia de la API de sesiones de flujo de trabajo](/documentation/api-reference/other-resources/tokens.md) para obtener más información.
{% endhint %}
{% endstep %}

{% step %}

#### Redirige al cliente a la URL

Redirige a tu cliente a la `redirectUrl` generada en el paso anterior. Una vez que el cliente complete el flujo en la solución alojada:

1. ComplyCube ejecutará automáticamente las comprobaciones que seleccionaste al crear la sesión (según lo especificado en `checkTypes`).
2. El cliente será redirigido a la `successUrl` que proporcionaste.

Puedes acceder a los resultados y a un desglose detallado de cada comprobación a través de la API o del portal web. Si has **configurado webhooks**, ComplyCube enviará una notificación al completarse cada comprobación.
{% endstep %}
{% endstepper %}

## Identidad de marca

Puedes personalizar los colores, los logotipos y otros elementos de marca a través de la [página de configuración de la marca](https://portal.complycube.com/settings/branding), si está disponible en tu plan.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.complycube.com/documentation/sdks/sdks-es/integraciones-web/hosted-solution-quick-guide/hosted-solution-quick-guide-1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
