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

@cdwenz/afip-sdk

v1.0.6

Published

SDK Node.js para facturación electrónica AFIP WSFEv1

Readme

@cdwenz/afip-sdk

SDK ligero para Node.js que simplifica la integración con los servicios de facturación electrónica de AFIP (WSFEv1) en Argentina.

Este proyecto busca ofrecer una interfaz moderna y clara para trabajar con AFIP sin tener que lidiar directamente con SOAP, XML, autenticación WSAA y firma CMS.


Características

  • Implementación completa del flujo de autenticación WSAA
  • Firma automática del TRA (loginTicketRequest) usando certificado AFIP
  • Cache automático de token y sign
  • Integración directa con WSFEv1
  • Soporte para Facturas A, B y C
  • Manejo de múltiples ítems
  • Soporte para múltiples alícuotas de IVA
  • Cálculo automático de:
    • Neto
    • IVA
    • Total
  • Manejo de CAE y fecha de vencimiento
  • Validaciones básicas antes de enviar datos a AFIP
  • Control de concurrencia para evitar duplicación de comprobantes
  • Compatible con homologación y producción

Instalación

npm install @cdwenz/afip-sdk

Configuración

El SDK requiere:

  • CUIT del emisor
  • Certificado AFIP (.crt)
  • Clave privada (.key)
  • Entorno (homologación o producción)
import { AFIP } from "@cdwenz/afip-sdk"

const afip = new AFIP({
  cuit: 20123456789,
  certPath: "./cert.crt",
  keyPath: "./private.key",
  production: false
})

Crear una factura

const invoice = await afip.createInvoice({

  puntoVenta: 1,
  tipoComprobante: 6, // Factura B

  docTipo: 99,
  docNro: 0,

  items: [
    {
      description: "Producto de prueba",
      quantity: 1,
      unitPrice: 1000,
      iva: 21
    }
  ]

})

console.log(invoice)

Respuesta:

{
  "comprobante": 1023,
  "cae": "70417054367476",
  "caeVto": "20260411",
  "total": 1210
}

Qué significa cada campo

puntoVenta

Punto de venta AFIP.

1

tipoComprobante

AFIP usa códigos.

| tipo | código | | -------------- | ------ | | Factura A | 1 | | Factura B | 6 | | Factura C | 11 | | Nota Crédito A | 3 | | Nota Crédito B | 8 | | Nota Crédito C | 13 |

docTipo

Tipo de documento del cliente.

| tipo | código | | ---------------- | ------ | | Consumidor final | 99 | | DNI | 96 | | CUIT | 80 |

docNro

Número del documento.

Ejemplo consumidor final:

0

Métodos disponibles

login()

Obtiene un token y sign desde WSAA.

await afip.login()

getLastVoucher(puntoVenta, tipoComprobante)

Consulta el último comprobante autorizado.

const last = await afip.getLastVoucher(1, 6)

createInvoice(data)

Genera una factura electrónica utilizando FECAESolicitar.

Características:

  • Cálculo automático de totales
  • Múltiples ítems
  • Múltiples alícuotas de IVA

Entornos AFIP

El SDK soporta automáticamente ambos entornos.

Homologación

https://wsaahomo.afip.gov.ar
https://wswhomo.afip.gov.ar

Producción

https://wsaa.afip.gov.ar
https://servicios1.afip.gov.ar

Se controlan mediante:

production: true

⚠️ Requisitos

Para utilizar el SDK necesitas:

  • Certificado digital AFIP válido
  • Clave privada asociada al certificado
  • Punto de venta habilitado para WSFEv1

Casos de uso

Este SDK puede integrarse fácilmente en:

  • APIs backend
  • sistemas SaaS
  • e-commerce
  • POS
  • plataformas gastronómicas
  • sistemas administrativos

Licencia

MIT

Autor

Cristian Wenz

GitHub https://github.com/cdwenz