npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sdk-node-apis-efi

v2.0.1

Published

Module for integration with Efi Bank API

Readme

SDK Node para APIs Efí

SDK oficial para integração com as APIs de Cobranças, Pix, Open Finance, Pagamento de Contas, Abertura de Contas e Extratos da Efí.

Requisitos

  • Node.js 22 ou superior.
  • Credenciais da aplicação Efí.
  • Certificado para as APIs que usam mTLS.

Instalação

npm install sdk-node-apis-efi

Uso com TypeScript ou ESM

import EfiPay, {
  type PixCreateImmediateChargeBody,
  type SdkOptions,
} from 'sdk-node-apis-efi';

const options: SdkOptions = {
  sandbox: true,
  client_id: 'seu-client-id',
  client_secret: 'seu-client-secret',
  certificate: '/caminho/para/certificado.p12',
};

const efipay = new EfiPay(options);

const body: PixCreateImmediateChargeBody = {
  calendario: { expiracao: 3600 },
  valor: { original: '10.00' },
  chave: 'sua-chave-pix',
};

const cobranca = await efipay.pixCreateImmediateCharge(body);

A classe também pode ser importada pelo nome:

import { EfiPay } from 'sdk-node-apis-efi';

Uso com CommonJS

const EfiPay = require('sdk-node-apis-efi');

async function main() {
  const efipay = new EfiPay({
    sandbox: true,
    client_id: 'seu-client-id',
    client_secret: 'seu-client-secret',
    certificate: '/caminho/para/certificado.p12',
  });

  const cobranca = await efipay.pixCreateImmediateCharge({
    calendario: { expiracao: 3600 },
    valor: { original: '10.00' },
    chave: 'sua-chave-pix',
  });

  console.log(cobranca);
}

main().catch(console.error);

const { EfiPay } = require('sdk-node-apis-efi') também é suportado.

Assinaturas dos métodos

As chamadas seguem uma convenção única:

| Endpoint | Assinatura | | --- | --- | | Sem params | metodo(body, headers?) | | Sem body | metodo(params, headers?) | | Com params e body | metodo(params, body, headers?) | | Sem params e body | metodo(headers?) |

Chamadas da v1 que enviam {} como primeiro argumento continuam disponíveis nesta versão:

await efipay.pixCreateImmediateCharge({}, body); // legado
await efipay.pixCreateImmediateCharge(body);     // recomendado

Os overloads legados estão marcados com @deprecated nas declarações TypeScript e serão removidos em uma futura versão major. O SDK não emite avisos em runtime.

Opções

| Opção | Descrição | | --- | --- | | sandbox | Seleciona homologação (true) ou produção (false). | | client_id | Client ID da aplicação. | | client_secret | Client secret da aplicação. | | certificate | Caminho do P12/PEM ou certificado em base64. | | pemKey | Caminho ou conteúdo base64 da chave do certificado PEM. | | cert_base64 | Indica que certificado e chave foram fornecidos em base64. | | partner_token | Token de parceiro, quando aplicável. | | validateMtls | Use false somente ao configurar webhooks sem validação mTLS. | | cache | Controla o cache de tokens OAuth; padrão true. | | idempotencyKey | Chave global de idempotência para Open Finance. |

Tipos e schemas

Todos os tipos e schemas Zod públicos são exportados pela raiz do pacote:

import {
  PixCreateImmediateChargeBodySchema,
  type PixCreateImmediateChargeBody,
} from 'sdk-node-apis-efi';

Os schemas usam Zod 4. O SDK não valida requests automaticamente em runtime; aplicações podem usar os schemas exportados quando desejarem validação local.

Cada método possui um tipo de resposta específico, também importável pela raiz, como CreateChargeResponse e DetailCarnetResponse.

Erros

Falhas retornadas pelas APIs são rejeitadas preservando o payload de erro da Efí. Erros locais de configuração, certificado ou resolução de rota são instâncias de Error.

Exemplos

O repositório contém exemplos equivalentes em TypeScript (examples/ts) e CommonJS (examples/cjs). Eles não fazem parte do tarball publicado no NPM.

Migração e mudanças

Consulte MIGRATION.md para migrar da v1 e CHANGELOG.md para o histórico da versão.

Desenvolvimento

npm test
npm run test:package

npm test executa build, typecheck, auditoria da API pública, testes de transporte, examples e smoke tests CJS/ESM. npm run test:package instala o tarball em um projeto temporário e valida CJS, ESM e TypeScript.