The `taxjar` package provides the official Node.js client for integrating with the TaxJar Sales Tax API v2. It allows developers to perform sales tax calculations, manage order and refund transactions, list tax categories, retrieve tax rates for specific locations, manage customer records, and validate VAT numbers and addresses. The library is actively maintained; the latest stable major version is v5.0.0, which requires Node.js v18 or newer and leverages native `fetch`. Prior to this, v4.1.0 was the stable release. TaxJar typically follows a regular release cadence, addressing API changes and adding new functionalities. Its primary advantage is providing a direct, officially supported interface to the comprehensive TaxJar API, abstracting away HTTP request handling and API-specific nuances, making it easier for applications to comply with sales tax regulations.
npm install taxjarVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate the TaxJar client using an API key and then asynchronously fetch the list of all available tax categories.
Upgrade your Node.js environment to version 18 or newer. Alternatively, use TaxJar v4.x.x if you must support older Node.js versions.
Upgrade Node.js to v18 or later. If you are stuck on an older Node version, consider using TaxJar v4.x.x, which explicitly uses `node-fetch`.
Always store API keys securely, typically as environment variables on the server-side, and never embed them directly into client-side code bundles. Proxy API requests through your own backend if client-side access is required.
Ensure `"esModuleInterop": true` is set in your `tsconfig.json` under `compilerOptions` to correctly handle default imports from CommonJS modules.
Use `import Taxjar from 'taxjar';` for ES modules. If you must use CommonJS, ensure your environment is configured for it (e.g., `"type": "commonjs"` or `.cjs` file extension).
For ES modules, use `import Taxjar from 'taxjar';`. For CommonJS, use `const Taxjar = require('taxjar');`. If using TypeScript, ensure `"esModuleInterop": true` is set in `tsconfig.json`.Upgrade your Node.js environment to v18 or newer. If upgrading is not an option, you would need to revert to TaxJar v4.x.x.