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

# Comprovante PIX (PDF)

> Obtenha o comprovante em PDF de uma transferência Pix.

<Info>
  Essa rota utiliza os certificados e o Bearer Token de **Cash Out**.
</Info>

## Certificados

Esta rota usa autenticação mútua (mTLS). Envie o certificado de **Cash Out**, a chave e a senha na requisição:

<ParamField path="--cert" type="file" required>
  Certificado de Cash Out do cliente (`client.crt`).
</ParamField>

<ParamField path="--key" type="file" required>
  Chave privada do cliente (`client.key`).
</ParamField>

<ParamField path="--pass" type="string" required>
  Senha para descriptografar a chave `.key`, enviada por e-mail junto com os certificados.
</ParamField>

## Headers

<ParamField header="Authorization" type="string" required>
  Bearer Token de Cash Out. Formato: `Bearer {access_token}`.
</ParamField>

## Path

<ParamField path="e2eid" type="string" required>
  E2E da transferência da qual você quer o comprovante.
</ParamField>

## Resposta

<ResponseField name="data.pdf" type="string">
  Documento do comprovante em uma string base64.
</ResponseField>

<Warning>
  O campo `data.pdf` contém o documento compactado em uma string base64. Para acessar o valor real, descompacte o base64.
</Warning>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://pagamentos.basspago.com.br/api/v2/pix/payments/receipt/E87654321202607211440a1b2c3d4e5f" \
    --cert ./client.crt \
    --key ./client.key \
    --pass "SUA_SENHA_DO_CERTIFICADO" \
    -H "Authorization: Bearer {access_token}"
  ```

  ```php PHP theme={null}
  <?php

  $e2eid = 'E87654321202607211440a1b2c3d4e5f';
  $ch = curl_init("https://pagamentos.basspago.com.br/api/v2/pix/payments/receipt/{$e2eid}");

  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_SSLCERT => './client.crt',
      CURLOPT_SSLKEY => './client.key',
      CURLOPT_KEYPASSWD => 'SUA_SENHA_DO_CERTIFICADO',
      CURLOPT_HTTPHEADER => ['Authorization: Bearer {access_token}'],
  ]);

  $response = curl_exec($ch);
  curl_close($ch);

  echo $response;
  ```

  ```javascript Node.js theme={null}
  import fs from "node:fs";
  import https from "node:https";
  import axios from "axios";

  const agent = new https.Agent({
    cert: fs.readFileSync("./client.crt"),
    key: fs.readFileSync("./client.key"),
    passphrase: "SUA_SENHA_DO_CERTIFICADO",
  });

  const e2eid = "E87654321202607211440a1b2c3d4e5f";

  const { data } = await axios.get(
    `https://pagamentos.basspago.com.br/api/v2/pix/payments/receipt/${e2eid}`,
    {
      httpsAgent: agent,
      headers: { Authorization: "Bearer {access_token}" },
    }
  );

  console.log(data);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - OK theme={null}
  {
    "data": {
      "pdf": "JVBERi0xLjcKJfCflqQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMyAwIFIKPj4KZW5kb2JqCg=="
    }
  }
  ```
</ResponseExample>
