# `PaperTiger.Resources.InvoiceItem`
[🔗](https://github.com/EnaiaInc/paper_tiger/blob/v1.2.1/lib/paper_tiger/resources/invoice_item.ex#L1)

Handles InvoiceItem resource endpoints.

## Endpoints

- POST   /v1/invoiceitems      - Create invoice item
- GET    /v1/invoiceitems/:id  - Retrieve invoice item
- POST   /v1/invoiceitems/:id  - Update invoice item
- DELETE /v1/invoiceitems/:id  - Delete invoice item
- GET    /v1/invoiceitems      - List invoice items

## InvoiceItem Object

    %{
      id: "ii_...",
      object: "invoiceitem",
      created: 1234567890,
      customer: "cus_...",
      invoice: "in_..." | nil,
      amount: 2000,
      currency: "usd",
      description: "Premium Plan",
      quantity: 1,
      metadata: %{},
      # ... other fields
    }

# `create`

```elixir
@spec create(Plug.Conn.t()) :: Plug.Conn.t()
```

Creates a new invoice item.

## Required Parameters

- customer - Customer ID
- amount - Amount in cents (integer)
- currency - Three-letter ISO currency code (e.g., "usd")

## Optional Parameters

- invoice - Invoice ID (optional until invoice is finalized)
- description - Item description
- quantity - Quantity (default: 1)
- metadata - Key-value metadata

# `delete`

```elixir
@spec delete(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
```

Deletes an invoice item.

Note: Invoice items can only be deleted if not part of a finalized invoice.

Returns a deletion confirmation object.

# `list`

```elixir
@spec list(Plug.Conn.t()) :: Plug.Conn.t()
```

Lists all invoice items with pagination.

## Parameters

- limit - Number of items (default: 10, max: 100)
- starting_after - Cursor for pagination
- ending_before - Reverse cursor
- customer - Filter by customer
- invoice - Filter by invoice

# `retrieve`

```elixir
@spec retrieve(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
```

Retrieves an invoice item by ID.

# `update`

```elixir
@spec update(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
```

Updates an invoice item.

## Updatable Fields

- amount
- description
- metadata
- quantity

---

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