# `LatticeStripe.TaxId`
[🔗](https://github.com/szTheory/lattice_stripe/blob/v2.2.2/lib/lattice_stripe/tax_id.ex#L1)

Operations on Stripe Tax ID objects.

Tax IDs store customer tax identification numbers (VAT, EIN, etc.) for tax
reporting and calculation. Stripe exposes two URL families for the same
resource shape — this module routes by arity so adopters call one module
for both paths.

## Dual-path URL table

| Operation | Top-level (`/v1/tax_ids`) | Customer-nested (`/v1/customers/:id/tax_ids`) |
|-----------|---------------------------|-----------------------------------------------|
| Create    | `create/3`                | `create/4` — `customer_id` is 2nd arg after `client` |
| Retrieve  | `retrieve/3`              | `retrieve/4` |
| List      | `list/3`                  | `list/4` |
| Delete    | `delete/3`                | `delete/4` |
| Stream    | `stream!/3`               | `stream!/4` |

Top-level paths apply when the tax ID is not scoped to a single customer URL
prefix. Customer-nested paths apply when managing tax IDs on a known
`cus_...` record. Nested `create/4` omits `"customer"` from the request body —
Stripe infers the customer from the URL path.

## Usage

    # Top-level create
    {:ok, tax_id} =
      LatticeStripe.TaxId.create(client, %{"type" => "eu_vat", "value" => "DE123456789"})

    # Customer-nested create
    {:ok, tax_id} =
      LatticeStripe.TaxId.create(client, "cus_123", %{"type" => "eu_vat", "value" => "DE123456789"})

## Not `LatticeStripe.Invoice.AutomaticTax`

Tax IDs on customers are separate from automatic tax on invoices. Use
`LatticeStripe.Invoice.AutomaticTax` when Stripe calculates tax on an invoice
from the customer's address and tax settings — not this module.

See [Standalone Tax API](guides/tax.md) for the canonical calculate → record → reverse workflow.

## Operations not supported by the Stripe API

- **update** — Tax IDs are immutable once created (Coupon precedent).
- **search** — No `/v1/tax_ids/search` endpoint exists.

See the [Stripe Tax ID API](https://docs.stripe.com/api/tax_ids).

# `t`

```elixir
@type t() :: %LatticeStripe.TaxId{
  country: String.t() | nil,
  created: integer() | nil,
  customer: struct() | String.t() | nil,
  customer_account: String.t() | nil,
  deleted: boolean(),
  extra: map(),
  id: String.t() | nil,
  livemode: boolean() | nil,
  object: String.t(),
  owner: LatticeStripe.TaxId.Owner.t() | nil,
  type: String.t() | nil,
  value: String.t() | nil,
  verification: LatticeStripe.TaxId.Verification.t() | nil
}
```

# `create`

# `create`

```elixir
@spec create(LatticeStripe.Client.t(), map(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}
```

# `create`

```elixir
@spec create(LatticeStripe.Client.t(), String.t(), map(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}
```

Creates a Tax ID.

- `create(client, params, opts)` — POST `/v1/tax_ids`
- `create(client, customer_id, params, opts)` — POST `/v1/customers/:customer_id/tax_ids`
  (omits `"customer"` from the request body)

# `create!`

# `create!`

# `create!`

# `delete`

# `delete`

```elixir
@spec delete(LatticeStripe.Client.t(), String.t(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}
```

# `delete`

```elixir
@spec delete(LatticeStripe.Client.t(), String.t(), String.t(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}
```

Deletes a Tax ID.

- `delete(client, id, opts)` — DELETE `/v1/tax_ids/:id`
- `delete(client, customer_id, id, opts)` — DELETE `/v1/customers/:customer_id/tax_ids/:id`

# `delete!`

# `delete!`

# `delete!`

# `list`

# `list`

```elixir
@spec list(LatticeStripe.Client.t(), map(), keyword()) ::
  {:ok, LatticeStripe.Response.t()} | {:error, LatticeStripe.Error.t()}
```

# `list`

```elixir
@spec list(LatticeStripe.Client.t(), String.t(), map(), keyword()) ::
  {:ok, LatticeStripe.Response.t()} | {:error, LatticeStripe.Error.t()}
```

Lists Tax IDs.

- `list(client, params, opts)` — GET `/v1/tax_ids`
- `list(client, customer_id, params, opts)` — GET `/v1/customers/:customer_id/tax_ids`

# `list!`

# `list!`

# `list!`

# `retrieve`

# `retrieve`

```elixir
@spec retrieve(LatticeStripe.Client.t(), String.t(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}
```

# `retrieve`

```elixir
@spec retrieve(LatticeStripe.Client.t(), String.t(), String.t(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}
```

Retrieves a Tax ID.

- `retrieve(client, id, opts)` — GET `/v1/tax_ids/:id`
- `retrieve(client, customer_id, id, opts)` — GET `/v1/customers/:customer_id/tax_ids/:id`

# `retrieve!`

# `retrieve!`

# `retrieve!`

# `stream!`

# `stream!`

```elixir
@spec stream!(LatticeStripe.Client.t(), map(), keyword()) :: Enumerable.t()
```

# `stream!`

```elixir
@spec stream!(LatticeStripe.Client.t(), String.t(), map(), keyword()) ::
  Enumerable.t()
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
