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

# Node.js

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

<Card title="AbacatePay Node.js SDK" icon="github" href="https://github.com/AbacatePay/abacatepay-nodejs-sdk">
  Repositório oficial — issues, changelog e contribuições.
</Card>

## Pré-requisitos

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

## Instalação

<CodeGroup>
  ```bash npm theme={null}
  npm install @abacatepay/sdk
  ```

  ```bash yarn theme={null}
  yarn add @abacatepay/sdk
  ```

  ```bash pnpm theme={null}
  pnpm add @abacatepay/sdk
  ```

  ```bash bun theme={null}
  bun add @abacatepay/sdk
  ```
</CodeGroup>

## Configuração

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

```ts theme={null}
// .env
ABACATEPAY_API_KEY=sua_chave_aqui
```

```ts theme={null}
import { AbacatePay } from "@abacatepay/sdk";

const abacate = AbacatePay({ secret: process.env.ABACATEPAY_API_KEY! });
```

## Primeira cobrança

```ts theme={null}
const checkout = await abacate.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={null}
{
  "success": true,
  "error": null,
  "data": {
    "id": "bill_123456789",
    "url": "https://app.abacatepay.com/pay/bill_123456789",
    "amount": 15000,
    "status": "PENDING",
    "devMode": true,
    "createdAt": "2024-11-04T18:38:28.573Z"
  }
}
```

## Próximos passos

<CardGroup cols={2}>
  <Card title="Configurar webhooks" icon="bell" href="/pages/webhooks">
    Receba notificações em tempo real sobre pagamentos confirmados.
  </Card>

  <Card title="Checkout Transparente" icon="credit-card" href="/pages/transparents/create">
    Aceite PIX e cartão diretamente na sua interface.
  </Card>

  <Card title="Criar clientes" icon="users" href="/pages/client/create">
    Gerencie clientes vinculados às cobranças.
  </Card>

  <Card title="Referência completa" icon="book-open" href="/pages/reference/introduction">
    Todos os endpoints, status codes e formato de resposta.
  </Card>
</CardGroup>
