> ## Documentation Index
> Fetch the complete documentation index at: https://whallet.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Node.js

> Integre a Whallet em aplicações Node.js e TypeScript em minutos.

> [card] [Whallet Node.js SDK](https://github.com/whallet-oficial/ecosystem/tree/main/packages/sdk)
>
> Repositório oficial — issues, changelog e contribuições.

## Pré-requisitos

* Node.js 18+
* Uma chave de API ([criar no dashboard](https://whallet.com/dashboard))

## Instalação

```bash npm theme={"theme":{"light":"github-light","dark":"vesper"}}
npm install @whallet/sdk
```

```bash yarn theme={"theme":{"light":"github-light","dark":"vesper"}}
yarn add @whallet/sdk
```

```bash pnpm theme={"theme":{"light":"github-light","dark":"vesper"}}
pnpm add @whallet/sdk
```

```bash bun theme={"theme":{"light":"github-light","dark":"vesper"}}
bun add @whallet/sdk
```

## Configuração

Armazene sua chave de API em uma variável de ambiente e nunca no código:

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
// .env
WHALLET_API_KEY=sua_chave_aqui
```

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
import { Whallet } from "@whallet/sdk";

const whallet = Whallet({ secret: process.env.WHALLET_API_KEY! });
```

## Primeira cobrança

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
const checkout = await whallet.checkouts.create({
  items: [{ id: "prod_abc123", quantity: 1 }],
  customerId: "cust_987",
});

console.log(checkout.data.url); // URL de pagamento para o cliente
```

**Resposta:**

```json theme={"theme":{"light":"github-light","dark":"vesper"}}
{
  "success": true,
  "error": null,
  "data": {
    "id": "bill_123456789",
    "url": "https://whallet.com/pay/bill_123456789",
    "amount": 15000,
    "status": "PENDING",
    "devMode": true,
    "createdAt": "2024-11-04T18:38:28.573Z"
  }
}
```

## Próximos passos

> [card] [Configurar webhooks](https://whallet.mintlify.site/pages/webhooks.md)
>
> Receba notificações em tempo real sobre pagamentos confirmados.

> [card] [Checkout Transparente](https://whallet.mintlify.site/pages/transparents/create.md)
>
> Aceite PIX e cartão diretamente na sua interface.

> [card] [Criar clientes](https://whallet.mintlify.site/pages/client/create.md)
>
> Gerencie clientes vinculados às cobranças.

> [card] [Referência completa](https://whallet.mintlify.site/pages/reference/introduction.md)
>
> Todos os endpoints, status codes e formato de resposta.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.