LatticeStripe.Price.Tier (LatticeStripe v1.7.6)

Copy Markdown View Source

Typed representation of a single tier in a tiered Price.

The final tier's up_to is the literal string "inf" in Stripe's API; this module converts it to the atom :inf for ergonomic pattern-matching.

Summary

Functions

Converts a decoded Stripe tier map to a %Price.Tier{} struct.

Types

t()

@type t() :: %LatticeStripe.Price.Tier{
  extra: map(),
  flat_amount: integer() | nil,
  flat_amount_decimal: String.t() | nil,
  unit_amount: integer() | nil,
  unit_amount_decimal: String.t() | nil,
  up_to: integer() | :inf | nil
}

Functions

from_map(map)

@spec from_map(map()) :: t()

Converts a decoded Stripe tier map to a %Price.Tier{} struct.

Coerces up_to: "inf" to :inf for ergonomic pattern-matching on the final tier.