# Capturar Dados do Cartão com Segurança

## 1. Utilização do SDK

### Exemplo de implementação:

```javascript
const sdk = new Barte({
  accessToken: "eyJhbGciOiJIUzI1NiJ9...",
  environment?: "sandbox" | "production" | "dev" 
});

try {
  const result = await sdk.payment.card.token.create({
    cardHolderName: "JOSE DAS NEVES TEST",
    cardCVV: "220",
    cardExpiryDate: "12/2025",
    cardNumber: "5383638854440891",
    buyerUuid: "751f9b5b-7185-465e-a8e4-b958d3b36006"
  });

  console.log(result);
} catch (error) {
  console.error(error);
}
```

***

## Observações importantes

🔸 `buyerUuid` é obrigatório e deve representar o comprador.\
🔸 Os dados sensíveis não passam pelos seus servidores, são enviados apenas ao SDK para a tokenização.\
🔸 A resposta do método `sdk.payment.card.token.create()` retorna um `cardId`, que pode ser utilizado em transações futuras.\
🔸 Caso a opção `environment` do construtor do SDK não seja disponibilizada, por padrão será utilizado o ambiente `production` . Caso essa opção seja disponibilizada, por exemplo `sandbox`, ainda se faz necessária a criação do accessToken no respectivo ambiente que se deseja utilizar.


---

# Agent Instructions: 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:

```
GET https://docs.barte.com/sdks/sdk-web/capturar-dados-do-cartao-com-seguranca.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
