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
}
Summary
Functions
Creates a new invoice item.
Deletes an invoice item.
Lists all invoice items with pagination.
Retrieves an invoice item by ID.
Updates an invoice item.
Functions
@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
@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.
@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
@spec retrieve(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
Retrieves an invoice item by ID.
@spec update(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
Updates an invoice item.
Updatable Fields
- amount
- description
- metadata
- quantity