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

# Node.js

> API SDK Quickstart - Node.js

Aprenda como fazer sua primeira transação usando o Malga Node.js SDK.

### Pré-requisitos

Para que você consiga aproveitar ao máximo esse guia, será necessário ter chaves de integração de sandbox. Basta [clicar aqui](https://dashboard.malga.io/sign-up) e criar uma conta em nosso Dashboard.

### 1. Instalando o SDK

Instale nosso SDK com o seu gerenciador de pacotes favorito.

<Tabs>
  <Tab title="npm">
    ```bash theme={null}
    npm install malga
    ```
  </Tab>

  <Tab title="yarn">
    ```bash theme={null}
    yarn add malga
    ```
  </Tab>

  <Tab title="pnpm">
    ```bash theme={null}
    pnpm add malga
    ```
  </Tab>
</Tabs>

### 2. Fazendo sua primeira cobrança

Crie uma cobrança de forma simplificada.

<Tabs>
  <Tab title="server">
    ```typescript theme={null}
    import { Malga } from "malga";

    const malga = new Malga({
      apiKey: "17a64c8f-a387-4682-bdd8-d280493715e0",
      clientId: "d1d2b51a-0446-432a-b055-034518c2660e",
      options: { sandbox: true },
    })(async function () {
      try {
        const data = await malga.charges.create({
          merchantId: "8cfef0d1-73af-4bdb-b6c4-09ad3fbfc7f1",
          amount: 100,
          paymentMethod: {
            type: "credit",
            installments: 1,
            card: {
              holderName: "João da Silva",
              number: "5453881028277600",
              cvv: "170",
              expirationDate: "10/2030",
            },
          },
        });

        console.log(data);
      } catch (error) {
        console.error(error);
      }
    })();
    ```
  </Tab>
</Tabs>

### 3. Teste você mesmo

<CardGroup>
  <Card href="https://github.com/plughacker/malga-node/tree/main/examples/nodejs" icon="arrow-up-right-from-square" title="Exemplo Node.js">
    Veja o código completo
  </Card>
</CardGroup>
