# Tax

> Tax codes per organization and legal entity with a rate history, the tax of a document per code on its date (margin scheme and credit restriction included), invoice tax lines written when an invoice is issued, tax returns with box totals, and the EU sales list per customer VAT number.

- Category: Billing & commerce
- Module: `tax`
- Modes: `managed`, `custom`
- Docs: https://bettersupabase.com/docs/blocks/tax
- Page: https://bettersupabase.com/blocks/tax

## Install

```bash
npx better-supabase add tax
```

The command also installs `updated-at`, `memberships`, `permissions`.

## Configure

Add the block to `better-supabase.config.ts`:

```ts
import { defineConfig } from "better-supabase/config";

export default defineConfig({
  blocks: {
    // Required by tax; add installs them too.
    "updated-at": {},
    memberships: {},
    permissions: {},
    // Modes: "managed", "custom". The default is "managed".
    tax: { mode: "managed" },
  },
});
```

## Client

The block has no React entry yet. Its server-side TypeScript is in `better-supabase/blocks/tax`.

## Events

- `tax_code.created`
- `tax_code.updated`
- `tax_return.prepared`

## Related blocks

Requires: [memberships](https://bettersupabase.com/blocks/memberships.md), [permissions](https://bettersupabase.com/blocks/permissions.md)

Works with: [accounting](https://bettersupabase.com/blocks/accounting.md), [invoices](https://bettersupabase.com/blocks/invoices.md), [contacts](https://bettersupabase.com/blocks/contacts.md), [legal-entities](https://bettersupabase.com/blocks/legal-entities.md), [outbox](https://bettersupabase.com/blocks/outbox.md), [audit](https://bettersupabase.com/blocks/audit.md), [imports](https://bettersupabase.com/blocks/imports.md)
