Avalara AvaTax SDK
Install, authenticate, and calculate tax with Effect-native AvaTax REST v2 operations.
Public package Swagger 2 470 operationsThe AvaTax SDK pins Avalara’s official REST v2 Swagger document and adds only the authentication, error, retry, and client-header behavior that belongs at the provider boundary.
Install
npm install @kevinmichaelchen/distilled-avalara effectpnpm add @kevinmichaelchen/distilled-avalara effectbun add @kevinmichaelchen/distilled-avalara effectAuthentication
| Variable | Purpose |
|---|---|
AVALARA_BEARER_TOKEN |
Preferred bearer credential when available |
AVALARA_ACCOUNT_ID + AVALARA_LICENSE_KEY |
AvaTax account credential pair |
AVALARA_BASE_URL |
Optional endpoint; use https://sandbox-rest.avatax.com for sandbox |
Quickstart
Estimate the combined rate for an address:
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
import {
CredentialsFromEnv,
taxRatesByAddress,
} from "@kevinmichaelchen/distilled-avalara";
const AvaTaxLive = Layer.mergeAll(FetchHttpClient.layer, CredentialsFromEnv);
const program = taxRatesByAddress({
line1: "100 Market Street",
city: "Philadelphia",
region: "PA",
postalCode: "19106",
country: "US",
});
const rates = await Effect.runPromise(Effect.provide(program, AvaTaxLive));