{"id":14103,"library":"taxjar","title":"TaxJar Node.js Client","description":"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.","status":"active","version":"4.1.0","language":"javascript","source_language":"en","source_url":"git://github.com/taxjar/taxjar-node","tags":["javascript","taxjar","sales tax","sales tax calculations","sales tax rates","api","typescript"],"install":[{"cmd":"npm install taxjar","lang":"bash","label":"npm"},{"cmd":"yarn add taxjar","lang":"bash","label":"yarn"},{"cmd":"pnpm add taxjar","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for making HTTP requests to the TaxJar API in versions prior to v5.0.0.","package":"node-fetch","optional":false}],"imports":[{"note":"Taxjar is a default export for ESM. Ensure `esModuleInterop` is `true` in tsconfig.json for TypeScript projects.","wrong":"import { Taxjar } from 'taxjar';","symbol":"Taxjar","correct":"import Taxjar from 'taxjar';"},{"note":"This is the correct CommonJS `require` syntax for the default export.","wrong":"const { Taxjar } = require('taxjar');","symbol":"Taxjar (CommonJS)","correct":"const Taxjar = require('taxjar');"},{"note":"For type-only imports in TypeScript, use `import type`.","symbol":"Taxjar (Type)","correct":"import type TaxjarClient from 'taxjar';"}],"quickstart":{"code":"import Taxjar from 'taxjar';\n\nconst client = new Taxjar({\n  apiKey: process.env.TAXJAR_API_KEY ?? 'YOUR_TAXJAR_API_KEY',\n  apiUrl: 'https://api.taxjar.com' // Optional: use 'https://api.taxjar.com/v2' or 'https://api.sandbox.taxjar.com' for sandbox\n});\n\nasync function getTaxCategories() {\n  try {\n    const res = await client.categories();\n    console.log('Available Tax Categories:', res.categories);\n  } catch (error) {\n    console.error('Error fetching tax categories:', error.message);\n  }\n}\n\ngetTaxCategories();","lang":"typescript","description":"This quickstart demonstrates how to instantiate the TaxJar client using an API key and then asynchronously fetch the list of all available tax categories."},"warnings":[{"fix":"Upgrade your Node.js environment to version 18 or newer. Alternatively, use TaxJar v4.x.x if you must support older Node.js versions.","message":"The minimum Node.js version was increased from v10 to v18. Running on older Node.js versions with TaxJar v5+ will result in runtime errors.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"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`.","message":"The `node-fetch` dependency was removed in v5.0.0, and the client now relies on the native `fetch` API, which is available in Node.js v18 and later. This causes `ReferenceError: fetch is not defined` on older Node versions.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"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.","message":"Exposing your TaxJar API key in client-side JavaScript is insecure and could compromise your account. API keys should always be treated as sensitive credentials.","severity":"gotcha","affected_versions":"*"},{"fix":"Ensure `\"esModuleInterop\": true` is set in your `tsconfig.json` under `compilerOptions` to correctly handle default imports from CommonJS modules.","message":"When using TypeScript, if you encounter issues like `TypeError: Taxjar is not a constructor` with ESM imports, it's often due to TypeScript's module resolution settings.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'abstract':111 'activ':55 'ad':93 'address':51,89 'advantag':98 'allow':22 'api':19,90,110,118,142 'api-specif':117 'applic':125 'away':112 'cadenc':88 'calcul':28,138 'categori':36 'chang':91 'client':3,11 'compli':127 'comprehens':108 'custom':44 'develop':23 'direct':102 'easier':123 'fetch':73 'follow':84 'function':95 'handl':115 'http':113 'integr':13 'interfac':105 'javascript':132 'latest':58 'leverag':71 'librari':53 'list':34 'locat':42 'maintain':56 'major':60 'make':121 'manag':29,43 'nativ':72 'new':94 'newer':69 'node.js':2,10,66 'nuanc':120 'number':49 'offici':9,103 'order':30 'packag':6 'perform':25 'primari':97 'prior':74 'provid':7,100 'rate':39,141 'record':45 'refund':32 'regul':131 'regular':86 'releas':81,87 'request':114 'requir':65 'retriev':37 'sale':17,26,129,134,136,139 'specif':41,119 'stabl':59,80 'support':104 'tax':18,27,35,38,130,135,137,140 'taxjar':1,5,16,82,109,133 'transact':33 'typescript':143 'typic':83 'v18':67 'v2':20 'v4.1.0':77 'v5.0.0':63 'valid':47 'vat':48 'version':61","created_at":"2026-04-20T01:57:56.480350+00:00","updated_at":"2026-04-20T01:57:56.480350+00:00","problems":[{"fix":"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).","cause":"Attempting to use CommonJS `require` syntax in an ES module environment (e.g., a file with '.mjs' extension or `\"type\": \"module\"` in `package.json`).","error":"TypeError: require is not a function"},{"fix":"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`.","cause":"Incorrectly importing the Taxjar client, often by trying to destructure a default export (e.g., `import { Taxjar } from 'taxjar';`) or misconfiguring TypeScript's `esModuleInterop`.","error":"TypeError: Taxjar is not a constructor"},{"fix":"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.","cause":"Running TaxJar v5.0.0 or later on a Node.js version older than v18, which lacks native `fetch` API support.","error":"ReferenceError: fetch is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.0.1","cli_name":"","cli_version":null,"type":"library","homepage":"https://www.taxjar.com","github":"https://github.com/taxjar/taxjar-node","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/taxjar","openapi_spec":null,"status_page":null,"smithery":null,"categories":["payments"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}