View Source Stripe.Quote (stripity_stripe v3.2.0)

A Quote is a way to model prices that you'd like to provide to a customer. Once accepted, it will automatically create an invoice, subscription or subscription schedule.

Summary

Types

Settings for automatic tax lookup for this quote and resulting invoices and subscriptions.

Clone an existing quote. The new quote will be created in status=draft. When using this parameter, you cannot specify any other parameters except for expires_at.

All invoices will be billed using the specified settings.

Data used to generate a new Price object inline. One of price or price_data is required.

The recurring components of a price such as interval and interval_count.

When creating a subscription or subscription schedule, the specified configuration data will be used. There must be at least one line item with a recurring price for a subscription or subscription schedule to be created. A subscription schedule is created if subscription_data[effective_date] is present and in the future, otherwise a subscription is created.

t()

The quote type.

Functions

Accepts the specified quote.

A quote models prices and services for a customer. Default options for header, description, footer, and expires_at can be set in the dashboard via the quote template.

Returns a list of your quotes.

When retrieving a quote, there is an includable computed.upfront.line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items.

When retrieving a quote, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.

Download the PDF for a finalized quote

Retrieves the quote with the given ID.

A quote models prices and services for a customer.

Types

@type automatic_tax() :: %{optional(:enabled) => boolean()}

Settings for automatic tax lookup for this quote and resulting invoices and subscriptions.

@type discounts() :: %{optional(:coupon) => binary(), optional(:discount) => binary()}
@type from_quote() :: %{
  optional(:is_revision) => boolean(),
  optional(:quote) => binary()
}

Clone an existing quote. The new quote will be created in status=draft. When using this parameter, you cannot specify any other parameters except for expires_at.

@type invoice_settings() :: %{optional(:days_until_due) => integer()}

All invoices will be billed using the specified settings.

@type line_items() :: %{
  optional(:price) => binary(),
  optional(:price_data) => price_data(),
  optional(:quantity) => integer(),
  optional(:tax_rates) => [binary()] | binary()
}
@type price_data() :: %{
  optional(:currency) => binary(),
  optional(:product) => binary(),
  optional(:recurring) => recurring(),
  optional(:tax_behavior) => :exclusive | :inclusive | :unspecified,
  optional(:unit_amount) => integer(),
  optional(:unit_amount_decimal) => binary()
}

Data used to generate a new Price object inline. One of price or price_data is required.

@type recurring() :: %{
  optional(:interval) => :day | :month | :week | :year,
  optional(:interval_count) => integer()
}

The recurring components of a price such as interval and interval_count.

@type subscription_data() :: %{
  optional(:description) => binary(),
  optional(:effective_date) => :current_period_end | integer() | binary(),
  optional(:metadata) => %{optional(binary()) => binary()},
  optional(:trial_period_days) => integer() | binary()
}

When creating a subscription or subscription schedule, the specified configuration data will be used. There must be at least one line item with a recurring price for a subscription or subscription schedule to be created. A subscription schedule is created if subscription_data[effective_date] is present and in the future, otherwise a subscription is created.

@type t() :: %Stripe.Quote{
  amount_subtotal: integer(),
  amount_total: integer(),
  application: (binary() | term() | term()) | nil,
  application_fee_amount: integer() | nil,
  application_fee_percent: term() | nil,
  automatic_tax: term(),
  collection_method: binary(),
  computed: term(),
  created: integer(),
  currency: binary() | nil,
  customer: (binary() | Stripe.Customer.t() | Stripe.DeletedCustomer.t()) | nil,
  default_tax_rates: term(),
  description: binary() | nil,
  discounts: term(),
  expires_at: integer(),
  footer: binary() | nil,
  from_quote: term() | nil,
  header: binary() | nil,
  id: binary(),
  invoice: (binary() | Stripe.Invoice.t() | Stripe.DeletedInvoice.t()) | nil,
  invoice_settings: term(),
  line_items: term(),
  livemode: boolean(),
  metadata: term(),
  number: binary() | nil,
  object: binary(),
  on_behalf_of: (binary() | Stripe.Account.t()) | nil,
  status: binary(),
  status_transitions: term(),
  subscription: (binary() | Stripe.Subscription.t()) | nil,
  subscription_data: term(),
  subscription_schedule: (binary() | Stripe.SubscriptionSchedule.t()) | nil,
  test_clock: (binary() | Stripe.TestHelpers.TestClock.t()) | nil,
  total_details: term(),
  transfer_data: term() | nil
}

The quote type.

  • amount_subtotal Total before any discounts or taxes are applied.
  • amount_total Total after discounts and taxes are applied.
  • application ID of the Connect Application that created the quote.
  • application_fee_amount The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. Only applicable if there are no line items with recurring prices on the quote.
  • application_fee_percent A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. Only applicable if there are line items with recurring prices on the quote.
  • automatic_tax
  • collection_method Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or on finalization using the default payment method attached to the subscription or customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as active. Defaults to charge_automatically.
  • computed
  • created Time at which the object was created. Measured in seconds since the Unix epoch.
  • currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
  • customer The customer which this quote belongs to. A customer is required before finalizing the quote. Once specified, it cannot be changed.
  • default_tax_rates The tax rates applied to this quote.
  • description A description that will be displayed on the quote PDF.
  • discounts The discounts applied to this quote.
  • expires_at The date on which the quote will be canceled if in open or draft status. Measured in seconds since the Unix epoch.
  • footer A footer that will be displayed on the quote PDF.
  • from_quote Details of the quote that was cloned. See the cloning documentation for more details.
  • header A header that will be displayed on the quote PDF.
  • id Unique identifier for the object.
  • invoice The invoice that was created from this quote.
  • invoice_settings
  • line_items A list of items the customer is being quoted for.
  • 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.
  • number A unique number that identifies this particular quote. This number is assigned once the quote is finalized.
  • object String representing the object's type. Objects of the same type share the same value.
  • on_behalf_of The account on behalf of which to charge. See the Connect documentation for details.
  • status The status of the quote.
  • status_transitions
  • subscription The subscription that was created or updated from this quote.
  • subscription_data
  • subscription_schedule The subscription schedule that was created or updated from this quote.
  • test_clock ID of the test clock this quote belongs to.
  • total_details
  • transfer_data The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the invoices.
@type transfer_data() :: %{
  optional(:amount) => integer(),
  optional(:amount_percent) => number(),
  optional(:destination) => binary()
}

Functions

Link to this function

accept(quote, params \\ %{}, opts \\ [])

View Source
@spec accept(
  quote :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Accepts the specified quote.

Details

  • Method: post
  • Path: /v1/quotes/{quote}/accept
Link to this function

cancel(quote, params \\ %{}, opts \\ [])

View Source
@spec cancel(
  quote :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Cancels the quote.

Details

  • Method: post
  • Path: /v1/quotes/{quote}/cancel
Link to this function

create(params \\ %{}, opts \\ [])

View Source
@spec create(
  params :: %{
    optional(:application_fee_amount) => integer() | binary(),
    optional(:application_fee_percent) => number() | binary(),
    optional(:automatic_tax) => automatic_tax(),
    optional(:collection_method) => :charge_automatically | :send_invoice,
    optional(:customer) => binary(),
    optional(:default_tax_rates) => [binary()] | binary(),
    optional(:description) => binary() | binary(),
    optional(:discounts) => [discounts()] | binary(),
    optional(:expand) => [binary()],
    optional(:expires_at) => integer(),
    optional(:footer) => binary() | binary(),
    optional(:from_quote) => from_quote(),
    optional(:header) => binary() | binary(),
    optional(:invoice_settings) => invoice_settings(),
    optional(:line_items) => [line_items()],
    optional(:metadata) => %{optional(binary()) => binary()},
    optional(:on_behalf_of) => binary() | binary(),
    optional(:subscription_data) => subscription_data(),
    optional(:test_clock) => binary(),
    optional(:transfer_data) => transfer_data() | binary()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

A quote models prices and services for a customer. Default options for header, description, footer, and expires_at can be set in the dashboard via the quote template.

Details

  • Method: post
  • Path: /v1/quotes
Link to this function

finalize_quote(quote, params \\ %{}, opts \\ [])

View Source
@spec finalize_quote(
  quote :: binary(),
  params :: %{
    optional(:expand) => [binary()],
    optional(:expires_at) => integer()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Finalizes the quote.

Details

  • Method: post
  • Path: /v1/quotes/{quote}/finalize
Link to this function

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

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

Returns a list of your quotes.

Details

  • Method: get
  • Path: /v1/quotes
Link to this function

list_computed_upfront_line_items(quote, params \\ %{}, opts \\ [])

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

When retrieving a quote, there is an includable computed.upfront.line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items.

Details

  • Method: get
  • Path: /v1/quotes/{quote}/computed_upfront_line_items
Link to this function

list_line_items(quote, params \\ %{}, opts \\ [])

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

When retrieving a quote, there is an includable line_items property containing 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/quotes/{quote}/line_items
Link to this function

pdf(quote, params \\ %{}, opts \\ [])

View Source
@spec pdf(
  quote :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, []} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Download the PDF for a finalized quote

Details

  • Method: get
  • Path: /v1/quotes/{quote}/pdf
Link to this function

retrieve(quote, params \\ %{}, opts \\ [])

View Source
@spec retrieve(
  quote :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Retrieves the quote with the given ID.

Details

  • Method: get
  • Path: /v1/quotes/{quote}
Link to this function

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

View Source
@spec update(
  quote :: binary(),
  params :: %{
    optional(:application_fee_amount) => integer() | binary(),
    optional(:application_fee_percent) => number() | binary(),
    optional(:automatic_tax) => automatic_tax(),
    optional(:collection_method) => :charge_automatically | :send_invoice,
    optional(:customer) => binary(),
    optional(:default_tax_rates) => [binary()] | binary(),
    optional(:description) => binary() | binary(),
    optional(:discounts) => [discounts()] | binary(),
    optional(:expand) => [binary()],
    optional(:expires_at) => integer(),
    optional(:footer) => binary() | binary(),
    optional(:header) => binary() | binary(),
    optional(:invoice_settings) => invoice_settings(),
    optional(:line_items) => [line_items()],
    optional(:metadata) => %{optional(binary()) => binary()},
    optional(:on_behalf_of) => binary() | binary(),
    optional(:subscription_data) => subscription_data(),
    optional(:transfer_data) => transfer_data() | binary()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

A quote models prices and services for a customer.

Details

  • Method: post
  • Path: /v1/quotes/{quote}