> For the complete documentation index, see [llms.txt](https://docs.barte.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.barte.com/sdks/sdk-web/instalar-sdk.md).

# Instalar SDK

## Visão Geral

O SDK Barte permite que sellers capturem dados de cartão de forma segura no checkout, sem que essas informações sensíveis passem pelos seus servidores.

A tokenização dos dados reduz significativamente o escopo de PCI Compliance e protege o comprador.

***

## 1. API Token

Antes de utilizar o SDK, é necessário obter o API Token do Seller. Para isso, acesse o painel do Seller da Barte (área logada) e siga as instruções abaixo:

Acesse o menu lateral e clique na opção "Integração" conforme a imagem a seguir:

<figure><img src="/files/x798ruvoiS1BurMh4z3Q" alt=""><figcaption><p>Figura 1 - Menu de integração painel do Seller</p></figcaption></figure>

Na seção "Chaves API" crie um novo token, conforme imagem abaixo (opção 1), ou copie uma chave já existente (opção 2). Caso a chave já criada não esteja visível, exiba-a e a opção de copiar será mostrada.

<figure><img src="/files/2Bf0x4gyOKOgR1UhYsyx" alt=""><figcaption><p>Figura 2 - Criação ou obtenção de uma chave de API</p></figcaption></figure>

## 2. Obter Access Token para o SDK

Utilize o api token obtido no passo anterior para obter o `accessToken`, que será utilizado na inicialização do SDK.

**Endpoint:**

```
GET https://api.barte.com/v2/sdk/access-token
```

**Headers:**

```http
"X-Token-Api": {{token_obtido_anteriormente}}
```

**Resposta:**

```json
{
  "accessToken": "eyJhbGciOiJIUzI1NiJ9..."
}
```

**Observação:**

O token gerado possui uma expiração de 15 minutos.

***

## 3. Instalação do SDK

Você pode instalar o SDK de duas maneiras:

### Via NPM

```bash
npm install barte-sdk-web
```

### Via Script HTML

<pre class="language-html"><code class="lang-html"><strong>&#x3C;script src="https://sdk-client.barte.com/sdk.min.js">&#x3C;/script>
</strong></code></pre>


---

# 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.barte.com/sdks/sdk-web/instalar-sdk.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.
