# pix-qr-code-detail

> Inspeciona BR Codes Pix dinamicos, extrai URL de payload e decodifica JWT.

Latest version **1.2.0** (published 2026-07-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install pix-qr-code-detail
pnpm add pix-qr-code-detail
yarn add pix-qr-code-detail
bun add pix-qr-code-detail
```

## Health

**Score 55/100 (C)** — status: active.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2026-07-01 |
| First published | 2025-04-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 0 |
| Unpacked size | 38.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | João Lucas Alberto Muniz |
| Maintainers | joao-muniz-efi |
| Keywords | Pix, BRCode, Efí Bank, Detalhar Pix |

## Links

- npm: https://www.npmjs.com/package/pix-qr-code-detail
- Repository: https://github.com/efipay/pix-qr-code-detail
- Homepage: https://github.com/efipay/pix-qr-code-detail#readme
- Issues: https://github.com/efipay/pix-qr-code-detail/issues
- npm.io page: https://npm.io/package/pix-qr-code-detail

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2026-07-01
- 1.1.1 — 2026-06-30
- 1.1.0 — 2025-04-17
- 1.0.0 — 2025-04-17

## README

# pix-qr-code-detail

![Node.js](https://img.shields.io/badge/Node-%3E%3D18-brightgreen)

Pacote Node.js minimalista para inspecionar **BR Codes Pix de cobrancas dinamicas**:

1. Faz o parsing TLV do QR Code/BR Code;
2. Localiza a _Merchant Account Information_ Pix, tags `26` a `51`;
3. Extrai a URL do payload dinamico na subtag `25`;
4. Baixa o payload via HTTP/HTTPS;
5. Decodifica o JWT e devolve `{ header, payload, signature }`.

O pacote publica ESM e CommonJS, nao executa exemplos ao ser importado e nao possui dependencias de runtime.

## Instalacao

```bash
npm i pix-qr-code-detail
```

## Uso

```js
import { parseTLV, extractPixUrl, getDecodedPixJwt } from 'pix-qr-code-detail';

const brcode = '00020101021226830014BR.GOV.BCB.PIX2561qrcodespix.sejaefi.com.br/v2/ff719c748dc244a294adee9174ace3795204000053039865802BR5905EFISA6008SAOPAULO62070503***6304BAC4';

console.dir(parseTLV(brcode), { depth: null });
console.log('URL:', extractPixUrl(brcode));

const { payload } = await getDecodedPixJwt(brcode);
console.log('Payload JWT:', payload);
```

CommonJS tambem e suportado:

```js
const { getDecodedPixJwt } = require('pix-qr-code-detail');
```

## API

**`parseTLV(brcode)`**  
Converte a string do BR Code em um array de objetos TLV. Cada item traz `tag`, `length`, `value`, `tagName` e, quando aplicavel, `children`.

**`extractPixUrl(brcode)`**  
Retorna a URL do payload dinamico na subtag `25` dentro da _Merchant Account Information_. Em QR Codes estaticos, onde normalmente existe chave Pix na subtag `01` em vez de URL de payload, retorna `undefined`.

**`getDecodedPixJwt(brcode, options?)`**  
Usa `extractPixUrl`, acrescenta `DPP=YYYY-MM-DD` na URL do payload com a data local do dia, baixa o payload com `fetch` e decodifica o JWT. Aceita:

```ts
{
  timeoutMs?: number;
  fetch?: typeof fetch;
  headers?: Record<string, string>;
}
```

**`decodeJwt(token)`**  
Decodifica um JWT ja obtido e devolve `{ header, payload, signature }`.

> O pacote decodifica o JWT para leitura/detalhamento. Ele nao verifica criptograficamente a assinatura.

## Desenvolvimento

```bash
npm run build
npm pack --dry-run
```

O build gera:

- `dist/esm/index.js`
- `dist/esm/index.d.ts`
- `dist/cjs/index.js`

## Licenca

MIT

---
_Source: https://npm.io/package/pix-qr-code-detail · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
