PaperTiger.Resources.TaxRate (PaperTiger v1.0.2)

Copy Markdown View Source

Handles TaxRate resource endpoints.

Endpoints

  • POST /v1/tax_rates - Create tax rate
  • GET /v1/tax_rates/:id - Retrieve tax rate
  • POST /v1/tax_rates/:id - Update tax rate
  • GET /v1/tax_rates - List tax rates

Note: Tax rates cannot be deleted (audit purposes).

TaxRate Object

%{
  id: "txr_...",
  object: "tax_rate",
  created: 1234567890,
  active: true,
  display_name: "VAT",
  inclusive: false,
  jurisdiction: "EU",
  percentage: 20.0,
  metadata: %{},
  # ... other fields
}

Summary

Functions

Creates a new tax rate.

Lists all tax rates with pagination.

Retrieves a tax rate by ID.

Updates a tax rate.

Functions

create(conn)

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

Creates a new tax rate.

Required Parameters

  • display_name - Tax rate display name (e.g., "VAT")
  • percentage - Tax percentage as decimal (e.g., 20.0 for 20%)
  • inclusive - Whether tax is included in price (boolean)

Optional Parameters

  • active - Whether tax rate is active (default: true)
  • jurisdiction - Geographic jurisdiction (e.g., "EU", "US-CA")
  • metadata - Key-value metadata

list(conn)

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

Lists all tax rates with pagination.

Parameters

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

retrieve(conn, id)

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

Retrieves a tax rate by ID.

update(conn, id)

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

Updates a tax rate.

Note: Tax rates can only have limited fields updated.

Updatable Fields

  • active
  • metadata