{"id":17508206,"url":"https://github.com/avadev/avatax-rest-v2-js-sdk","last_synced_at":"2025-04-12T19:45:45.363Z","repository":{"id":37514809,"uuid":"77554570","full_name":"avadev/AvaTax-REST-V2-JS-SDK","owner":"avadev","description":"Sales Tax API SDK for Javascript / Node and AvaTax REST","archived":false,"fork":false,"pushed_at":"2025-04-11T02:15:35.000Z","size":4358,"stargazers_count":28,"open_issues_count":25,"forks_count":37,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-11T03:25:12.067Z","etag":null,"topics":["javascript","nodejs","sales-tax","sales-tax-api","sdk","tax-rate","tax-rates"],"latest_commit_sha":null,"homepage":"https://developer.avalara.com/sdk/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/avadev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-28T18:56:10.000Z","updated_at":"2025-04-01T15:36:23.000Z","dependencies_parsed_at":"2024-04-23T18:40:21.727Z","dependency_job_id":"ff128602-ba92-4c2f-baa0-8c18a429dcaf","html_url":"https://github.com/avadev/AvaTax-REST-V2-JS-SDK","commit_stats":{"total_commits":375,"total_committers":25,"mean_commits":15.0,"dds":0.8106666666666666,"last_synced_commit":"c71db9ff0fbdb8540930d6a164baf00d50f2789b"},"previous_names":[],"tags_count":84,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avadev%2FAvaTax-REST-V2-JS-SDK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avadev%2FAvaTax-REST-V2-JS-SDK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avadev%2FAvaTax-REST-V2-JS-SDK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avadev%2FAvaTax-REST-V2-JS-SDK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avadev","download_url":"https://codeload.github.com/avadev/AvaTax-REST-V2-JS-SDK/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625490,"owners_count":21135513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","nodejs","sales-tax","sales-tax-api","sdk","tax-rate","tax-rates"],"created_at":"2024-10-20T04:13:02.084Z","updated_at":"2025-04-12T19:45:45.340Z","avatar_url":"https://github.com/avadev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AvaTax Rest V2 Node.js SDK\nAvaTax v2 SDK for languages using node.js\n\n[![Version](https://img.shields.io/npm/v/avatax.svg?style=plastic)](https://www.npmjs.org/package/avatax)\n[![Build Status](https://api.travis-ci.org/avadev/AvaTax-REST-V2-JRE-SDK.svg?branch=master\u0026style=plastic)](https://travis-ci.org/avadev/AvaTax-REST-V2-JS-SDK)\n[![Downloads](https://img.shields.io/npm/dm/avatax.svg)](https://www.npmjs.com/package/avatax)\n[![Try on RunKit](https://badge.runkitcdn.com/avatax.svg)](https://runkit.com/npm/avatax)\n\n## Installation\nInstall the package with: \n``` bash\n# using npm \nnpm install avatax\n\n# using yarn\nyarn add avatax\n```\n\n## Usage\n \n### Configuration\n``` js\n\n// es5 import\nvar Avatax = require('avatax');\n\n// es6/7 import\n// import Avatax from 'avatax';\n\n// resolve configuration, credentials and logOptions\nconst config = {\n  appName: 'your-app',\n  appVersion: '1.0',\n  environment: 'sandbox',\n  machineName: 'your-machine-name',\n  timeout: 5000, // optional, default 20 min\n  logOptions: {\n    logEnabled: true, // toggle logging on or off, by default its off.\n    logLevel: 3, // logLevel that will be used, Options are LogLevel.Error (0), LogLevel.Warn (1), LogLevel.Info (2), LogLevel.Debug (3)\n    logRequestAndResponseInfo: true, // Toggle logging of the request and response bodies on and off.\n    logger: myCustomLogger // (OPTIONAL) Custom logger can be passed in that implements the BaseLogger interface (e.g. debug, info, warn, error, and log functions) Otherwise console.log/error etc will be used by default.\n  },\n  customHttpAgent: new https.Agent({keepAlive: true}), // (OPTIONAL) Define a custom https agent, import https from node to use this constructor. See https://node.readthedocs.io/en/latest/api/https/#https_class_https_agent for more information.\n  enableStrictTypeConversion: true // Ensures that all responses returned by the API methods will be type-safe and match the Models explicitly, For Example, the enums will be returned as integer values instead of as Strings as previously were.\n};\n\nconst creds = {\n  username: '\u003cyour-username\u003e',\n  password: '\u003cyour-password\u003e'\n};\n\nvar client = new Avatax(config).withSecurity(creds);\n``` \n\n### Tax Calculation\n``` js\nconst taxDocument = {\n  type: 'SalesInvoice',\n  companyCode: 'abc123',\n  date: '2017-04-12',\n  customerCode: 'ABC',\n  purchaseOrderNo: '2017-04-12-001',\n  addresses: {\n    SingleLocation: {\n      line1: '123 Main Street',\n      city: 'Irvine',\n      region: 'CA',\n      country: 'US',\n      postalCode: '92615'\n    }\n  },\n  lines: [\n    {\n      number: '1',\n      quantity: 1,\n      amount: 100,\n      taxCode: 'PS081282',\n      itemCode: 'Y0001',\n      description: 'Yarn'\n    }\n  ],\n  commit: true,\n  currencyCode: 'USD',\n  description: 'Yarn'\n}\n\nreturn client.createTransaction({ model: taxDocument })\n  .then(result =\u003e {\n    // response tax document\n    console.log(result);\n  });\n```\n\n### Address Validation\n``` js\nconst address = {\n  city: 'irvine',\n  postalCode: '92615',\n  region: 'ca',\n  country: 'us'\n};\n\nreturn client.resolveAddress(address)\n  .then(result =\u003e {\n    // address validation result\n    console.log(result);\n  });\n\n```\n## Release Notes\n\nPlease see the [Github releases](https://github.com/avadev/AvaTax-REST-V2-JS-SDK/releases) for in-depth release notes.\n\n## Typescript support\nAs of version 22.11.0, Typescript support is included in the SDK. Models and Enums included in addition to typing for all of the API methods and parameters. The team welcomes any feedback on this feature.\n\nModels and Enums can be imported into Typescript projects as follows:\n```typescript\nimport { AddressResolutionModel } from 'avatax/lib/models';\nimport { AddressCategoryId } from 'avatax/lib/enums';\n```\n\n## SDK Development\n\n### Adding integration test credentials\nRunning integration tests will hit the deployed lower environment\n\nTest credentials are resolved in the following order:\n1. Environment variables\n\nThe following environment variables will get loaded as test credentials\n```bash\nSANDBOX_USERNAME=\"your-username\"\nSANDBOX_PASSWORD=\"your-password\"\n```\n2. Local credentials file\n\nYou can also add a local credentials file to the the path \"\u003cproject_root\u003e/local_creds.json\". This file will be gitignored\n```json\n{\n  \"username\": \"your-username\",\n  \"password\": \"your-password\"\n}\n```\n3. Static (mock) values\n\nThe mocked values are used for unit tests via 'nock'.\n\nThe test credentials helper can be found here\nhttps://github.com/avadev/AvaTax-REST-V2-JS-SDK/blob/master/test/helpers/load_creds.js\n\n### Publish tags upstream\n``` bash\n# assuming a tag of v17.5.2 and a remote of 'upstream'\ngit push upstream v17.5.2\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favadev%2Favatax-rest-v2-js-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favadev%2Favatax-rest-v2-js-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favadev%2Favatax-rest-v2-js-sdk/lists"}