On this page
DocumentationGuides

Migrate from raw HTTP to SDK

Install taxkit and choose a complete calculator definition. Decode external data once, then pass the checked scenario to the local SDK.

TypeScript
import { Effect } from "effect";
import { AuPayTakeHomeCalculation } from "taxkit/au";
import { calculateReport, decodeInput } from "taxkit/effect";

// Decode the selected scenario once; surplus fields fail as well.
export const invalidInput = decodeInput(AuPayTakeHomeCalculation, {
  taxableIncome: { _tag: "Money", cents: 9_000_000, currency: "AUD" },
});
export const validInput = decodeInput(AuPayTakeHomeCalculation, {
  grossPay: { _tag: "Money", cents: 165_400, currency: "AUD" },
  period: "weekly",
  taxFreeThresholdClaimed: true,
}).pipe(
  Effect.flatMap((input) => calculateReport(AuPayTakeHomeCalculation, input))
);

SDK 5 is a hard cutover. Replace the old object facades with named calculate, calculateSafe and createClient imports. Move AU Schemas to taxkit/au/schemas, use native Result, and construct Money with explicit units. Module selectors, independent descriptor factories, numeric-dollar constructors and transport-shaped SDK helpers have been removed. There are no compatibility adapters.

The calculator HTTP API uses /api/v2; documentation content retains its separate API version.