Inttegro.Prices (inttegro v0.2.0)

Copy Markdown View Source

Manages reusable catalog prices.

Prices express currency and integer minor-unit amounts and can be attached to products. Use a new price when commercial terms materially change so existing orders retain their original price history.

Summary

Functions

Reactivates an inactive price so it can be used again in new flows. Key points: - The price must belong to the authenticated application - Archived prices cannot be activated - Already-active prices return an error

Archive a price and mark it inactive. An archived price cannot be activated or deactivated, and attempting to archive it again returns a lifecycle error.

Creates a new price in your catalog. Prices define the cost of products and can optionally be associated with a product. Multiple prices can exist for the same product to support different currencies, markets, or customer segments. Key points: - Price amounts are immutable after creation (create new price to change amount) - Product association (product_id) is optional at creation but immutable once set - Label and about fields can be updated later - Amount must be a positive integer representing the smallest currency unit (cents, pence, etc.)

Marks a price as inactive so it can no longer be used for new default-price assignments or other active catalog flows. Key points: - The price must belong to the authenticated application - Archived prices cannot be deactivated - Already-inactive prices return an error

Retrieves a price's details by ID. Returns the complete price record including amount, currency, associated product, label, description, and timestamps.

Retrieve a paginated list of prices for the authenticated application. Results are sorted by created_at in descending order, so page 1 contains the most recently created prices and subsequent pages step back in time. If product_id is supplied, the page is scoped to prices that belong to that product. The product must belong to your authenticated application.

Updates an existing price's metadata. Only label and about fields can be modified. Amount and product association are not accepted by this operation; create a new price when either must differ.

Functions

activate(client, request, options \\ [])

Reactivates an inactive price so it can be used again in new flows. Key points: - The price must belong to the authenticated application - Archived prices cannot be activated - Already-active prices return an error

Parameters

Returns

Returns {:ok, Inttegro.Prices.Catalog.t()} when Inttegro accepts and decodes the operation. Returns {:error, exception} for API, transport, or decoding failures. A successful API response can still describe an asynchronous resource that has not reached its terminal state.

Example

request = Inttegro.Prices.ActionRequest.new!(request_attributes)

case Inttegro.Prices.activate(client, request) do
  {:ok, result} -> result
  {:error, error} -> {:error, error}
end

archive(client, request, options \\ [])

Archive a price and mark it inactive. An archived price cannot be activated or deactivated, and attempting to archive it again returns a lifecycle error.

Parameters

Returns

Returns {:ok, Inttegro.Prices.Catalog.t()} when Inttegro accepts and decodes the operation. Returns {:error, exception} for API, transport, or decoding failures. A successful API response can still describe an asynchronous resource that has not reached its terminal state.

Example

request = Inttegro.Prices.ActionRequest.new!(request_attributes)

case Inttegro.Prices.archive(client, request) do
  {:ok, result} -> result
  {:error, error} -> {:error, error}
end

create(client, request, options \\ [])

Creates a new price in your catalog. Prices define the cost of products and can optionally be associated with a product. Multiple prices can exist for the same product to support different currencies, markets, or customer segments. Key points: - Price amounts are immutable after creation (create new price to change amount) - Product association (product_id) is optional at creation but immutable once set - Label and about fields can be updated later - Amount must be a positive integer representing the smallest currency unit (cents, pence, etc.)

Parameters

Returns

Returns {:ok, Inttegro.Prices.Catalog.t()} when Inttegro accepts and decodes the operation. Returns {:error, exception} for API, transport, or decoding failures. A successful API response can still describe an asynchronous resource that has not reached its terminal state.

Example

request = Inttegro.Prices.CatalogParams.new!(request_attributes)

case Inttegro.Prices.create(client, request) do
  {:ok, result} -> result
  {:error, error} -> {:error, error}
end

deactivate(client, request, options \\ [])

Marks a price as inactive so it can no longer be used for new default-price assignments or other active catalog flows. Key points: - The price must belong to the authenticated application - Archived prices cannot be deactivated - Already-inactive prices return an error

Parameters

Returns

Returns {:ok, Inttegro.Prices.Catalog.t()} when Inttegro accepts and decodes the operation. Returns {:error, exception} for API, transport, or decoding failures. A successful API response can still describe an asynchronous resource that has not reached its terminal state.

Example

request = Inttegro.Prices.ActionRequest.new!(request_attributes)

case Inttegro.Prices.deactivate(client, request) do
  {:ok, result} -> result
  {:error, error} -> {:error, error}
end

lookup(client, request, options \\ [])

Retrieves a price's details by ID. Returns the complete price record including amount, currency, associated product, label, description, and timestamps.

Parameters

Returns

Returns {:ok, Inttegro.Prices.Catalog.t()} when Inttegro accepts and decodes the operation. Returns {:error, exception} for API, transport, or decoding failures. A successful API response can still describe an asynchronous resource that has not reached its terminal state.

Example

request = Inttegro.Prices.LookupRequest.new!(request_attributes)

case Inttegro.Prices.lookup(client, request) do
  {:ok, result} -> result
  {:error, error} -> {:error, error}
end

page(client, request, options \\ [])

Retrieve a paginated list of prices for the authenticated application. Results are sorted by created_at in descending order, so page 1 contains the most recently created prices and subsequent pages step back in time. If product_id is supplied, the page is scoped to prices that belong to that product. The product must belong to your authenticated application.

Parameters

Returns

Returns {:ok, Inttegro.Prices.Page.t()} when Inttegro accepts and decodes the operation. Returns {:error, exception} for API, transport, or decoding failures. A successful API response can still describe an asynchronous resource that has not reached its terminal state.

Example

request = Inttegro.Prices.PageRequest.new!(request_attributes)

case Inttegro.Prices.page(client, request) do
  {:ok, result} -> result
  {:error, error} -> {:error, error}
end

update(client, request, options \\ [])

Updates an existing price's metadata. Only label and about fields can be modified. Amount and product association are not accepted by this operation; create a new price when either must differ.

Parameters

Returns

Returns {:ok, Inttegro.Prices.Catalog.t()} when Inttegro accepts and decodes the operation. Returns {:error, exception} for API, transport, or decoding failures. A successful API response can still describe an asynchronous resource that has not reached its terminal state.

Example

request = Inttegro.Prices.UpdateRequest.new!(request_attributes)

case Inttegro.Prices.update(client, request) do
  {:ok, result} -> result
  {:error, error} -> {:error, error}
end