View Source Stripe.LineItem (stripity_stripe v3.1.1)

Link to this section Summary

Types

The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have Stripe Revenue Recognition enabled, the period will be used to recognize and defer revenue. See the Revenue Recognition documentation for details.

Data used to generate a new Price object inline.

Data used to generate a new product object inline. One of product or product_data is required.

t()

The line_item type.

Data to find or create a TaxRate object.

Functions

When retrieving an invoice, you’ll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.

Updates an invoice’s line item. Some fields, such as tax_amounts, only live on the invoice line item,so they can only be updated through this endpoint. Other fields, such as amount, live on both the invoice item and the invoice line item, so updates on this endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only possible before the invoice is finalized.

Link to this section Types

@type discounts() :: %{optional(:coupon) => binary(), optional(:discount) => binary()}
@type period() :: %{optional(:end) => integer(), optional(:start) => integer()}

The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have Stripe Revenue Recognition enabled, the period will be used to recognize and defer revenue. See the Revenue Recognition documentation for details.

@type price_data() :: %{
  optional(:currency) => binary(),
  optional(:product) => binary(),
  optional(:product_data) => product_data(),
  optional(:tax_behavior) => :exclusive | :inclusive | :unspecified,
  optional(:unit_amount) => integer(),
  optional(:unit_amount_decimal) => binary()
}

Data used to generate a new Price object inline.

@type product_data() :: %{
  optional(:description) => binary(),
  optional(:images) => [binary()],
  optional(:metadata) => %{optional(binary()) => binary()},
  optional(:name) => binary(),
  optional(:tax_code) => binary()
}

Data used to generate a new product object inline. One of product or product_data is required.

@type t() :: %Stripe.LineItem{
  amount: integer(),
  amount_excluding_tax: integer() | nil,
  currency: binary(),
  description: binary() | nil,
  discount_amounts: term() | nil,
  discountable: boolean(),
  discounts: term() | nil,
  id: binary(),
  invoice_item: binary() | Stripe.Invoiceitem.t(),
  livemode: boolean(),
  metadata: term(),
  object: binary(),
  period: term(),
  plan: Stripe.Plan.t() | nil,
  price: Stripe.Price.t() | nil,
  proration: boolean(),
  proration_details: term() | nil,
  quantity: integer() | nil,
  subscription: (binary() | Stripe.Subscription.t()) | nil,
  subscription_item: binary() | Stripe.SubscriptionItem.t(),
  tax_amounts: term(),
  tax_rates: term(),
  type: binary(),
  unit_amount_excluding_tax: binary() | nil
}

The line_item type.

  • amount The amount, in cents (or local equivalent).
  • amount_excluding_tax The integer amount in cents (or local equivalent) representing the amount for this line item, excluding all tax and discounts.
  • currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
  • description An arbitrary string attached to the object. Often useful for displaying to users.
  • discount_amounts The amount of discount calculated per discount for this line item.
  • discountable If true, discounts will apply to this line item. Always false for prorations.
  • discounts The discounts applied to the invoice line item. Line item discounts are applied before invoice discounts. Use expand[]=discounts to expand each discount.
  • id Unique identifier for the object.
  • invoice_item The ID of the invoice item associated with this line item if any.
  • livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode.
  • metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Note that for line items with type=subscription this will reflect the metadata of the subscription that caused the line item to be created.
  • object String representing the object's type. Objects of the same type share the same value.
  • period
  • plan The plan of the subscription, if the line item is a subscription or a proration.
  • price The price of the line item.
  • proration Whether this is a proration.
  • proration_details Additional details for proration line items
  • quantity The quantity of the subscription, if the line item is a subscription or a proration.
  • subscription The subscription that the invoice item pertains to, if any.
  • subscription_item The subscription item that generated this line item. Left empty if the line item is not an explicit result of a subscription.
  • tax_amounts The amount of tax calculated per tax rate for this line item
  • tax_rates The tax rates which apply to the line item.
  • type A string identifying the type of the source of this line item, either an invoiceitem or a subscription.
  • unit_amount_excluding_tax The amount in cents (or local equivalent) representing the unit amount for this line item, excluding all tax and discounts.
@type tax_amounts() :: %{
  optional(:amount) => integer(),
  optional(:tax_rate_data) => tax_rate_data(),
  optional(:taxable_amount) => integer()
}
@type tax_rate_data() :: %{
  optional(:country) => binary(),
  optional(:description) => binary(),
  optional(:display_name) => binary(),
  optional(:inclusive) => boolean(),
  optional(:jurisdiction) => binary(),
  optional(:percentage) => number(),
  optional(:state) => binary(),
  optional(:tax_type) =>
    :amusement_tax
    | :communications_tax
    | :gst
    | :hst
    | :igst
    | :jct
    | :lease_tax
    | :pst
    | :qst
    | :rst
    | :sales_tax
    | :service_tax
    | :vat
}

Data to find or create a TaxRate object.

Stripe automatically creates or reuses a TaxRate object for each tax amount. If the tax_rate_data exactly matches a previous value, Stripe will reuse the TaxRate object. TaxRate objects created automatically by Stripe are immediately archived, do not appear in the line item’s tax_rates, and cannot be directly added to invoices, payments, or line items.

Link to this section Functions

Link to this function

list(invoice, params \\ %{}, opts \\ [])

View Source
@spec list(
  invoice :: binary(),
  params :: %{
    optional(:ending_before) => binary(),
    optional(:expand) => [binary()],
    optional(:limit) => integer(),
    optional(:starting_after) => binary()
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

When retrieving an invoice, you’ll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.

Details

  • Method: get
  • Path: /v1/invoices/{invoice}/lines
Link to this function

update(invoice, line_item_id, params \\ %{}, opts \\ [])

View Source
@spec update(
  invoice :: binary(),
  line_item_id :: binary(),
  params :: %{
    optional(:amount) => integer(),
    optional(:description) => binary(),
    optional(:discountable) => boolean(),
    optional(:discounts) => [discounts()] | binary(),
    optional(:expand) => [binary()],
    optional(:metadata) => %{optional(binary()) => binary()} | binary(),
    optional(:period) => period(),
    optional(:price) => binary(),
    optional(:price_data) => price_data(),
    optional(:quantity) => integer(),
    optional(:tax_amounts) => [tax_amounts()] | binary(),
    optional(:tax_rates) => [binary()] | binary()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Updates an invoice’s line item. Some fields, such as tax_amounts, only live on the invoice line item,so they can only be updated through this endpoint. Other fields, such as amount, live on both the invoice item and the invoice line item, so updates on this endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only possible before the invoice is finalized.

#### Details * Method: `post` * Path: `/v1/invoices/{invoice}/lines/{line_item_id}`