

# Calculate Australian take-home pay [#calculate-australian-take-home-pay]

Use this guide when you need a pay-period take-home amount from TypeScript.
The SDK path keeps the calculation in-process and avoids HTTP transport.

## Before you start [#before-you-start]

* Install the SDK with [Install the SDK](/start/install-the-sdk).
* Use a TypeScript runtime that can import the SDK.
* Represent money in cents with `aud`.

## Steps [#steps]

1. Import `aud`, `GrossPay` and the AU SDK helper.
2. Build the canonical gross pay fact.
3. Call `au.pay.takeHomePay`.
4. Check user input before the call and handle calculation failures with the
   safe helper.

## Example [#example]

```ts
import { Cents, aud } from "@taxkit/core/primitives";
import { GrossPay } from "@taxkit/rules-au-pay";
import { au } from "@taxkit/sdk/au";

const report = await au.pay.takeHomePay({
  grossPay: new GrossPay({
    amount: aud(Cents.make(165_400)),
    period: "weekly",
  }),
  taxFreeThresholdClaimed: true,
});

console.log({
  kind: report._tag,
  netPayCents: report.netPay.cents,
});
```

## Verify the result [#verify-the-result]

Expected output:

```json
{ "kind": "TakeHomePayReport", "netPayCents": 130100 }
```

This matches the current SDK test fixture for weekly gross pay of $1,654.00.

## Handle errors [#handle-errors]

Check untrusted input as shown in [Handle validation errors](/guides/handle-validation-errors).
Then use the safe helper when you want expected calculation failures as values:

```ts
const result = await au.pay.safe.takeHomePay({
  grossPay: new GrossPay({
    amount: aud(Cents.make(165_400)),
    period: "weekly",
  }),
  taxFreeThresholdClaimed: true,
});

if (result._tag === "TaxKitFailure") {
  console.error(result.error.message);
}
```

## Related pages [#related-pages]

* [Plain SDK](/sdk/plain-sdk)
* [Safe SDK](/sdk/safe-sdk)
* [Calculators](/concepts/calculators)
