View Source Stripe.Order (Striped v0.2.0)

An Order describes a purchase being made by a customer, including the products & quantities being purchased, the order status, the payment information, and the billing/shipping details.

Related guide: Orders overview

Link to this section Summary

Types

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

The shipping address for the order.

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

Settings for automatic tax calculation for this order.

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

If paying by customer_balance, this sub-hash contains details about the Customer Balance payment method options to pass to the order's PaymentIntent.

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

Parameters to create a new ad-hoc shipping rate for this order.

Configuration for the bank transfer funding type, if the funding_type is set to bank_transfer.

Parameters to create a new ad-hoc shipping rate for this order.

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

If paying by acss_debit, this sub-hash contains details about the ACSS Debit payment method options to pass to the order's PaymentIntent.

The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.

The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

Payment information associated with the order, including payment settings.

Settings describing how the order should configure generated PaymentIntents.

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

Payment information associated with the order, including payment settings.

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

t()

The order type.

Additional tax details about the purchaser to be used for this order.

Settings describing how the order should configure generated PaymentIntents.

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

Functions

Cancels the order as well as the payment intent if one is attached.

Creates a new open order object.

Returns a list of your orders. The orders are returned sorted by creation date, with the most recently created orders appearing first.

When retrieving an order, 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.

Reopens a submitted order.

Retrieves the details of an existing order. Supply the unique order ID from either an order creation request or the order list, and Stripe will return the corresponding order information.

Submitting an Order transitions the status to processing and creates a PaymentIntent object so the order can be paid. If the Order has an amount_total of 0, no PaymentIntent object will be created. Once the order is submitted, its contents cannot be changed, unless the reopen method is called.

Updates the specific order by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

Link to this section Types

@type acss_debit() :: %{
  :mandate_options => mandate_options(),
  optional(:setup_future_usage) => :none | :off_session | :on_session,
  optional(:verification_method) => :automatic | :instant | :microdeposits
}

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

@type address() :: %{
  optional(:city) => :string,
  optional(:country) => :string,
  optional(:line1) => :string,
  optional(:line2) => :string,
  optional(:postal_code) => :string,
  optional(:state) => :string
}

The shipping address for the order.

@type afterpay_clearpay() :: %{
  optional(:capture_method) => :automatic | :manual,
  optional(:reference) => :string,
  optional(:setup_future_usage) => :none
}

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

@type alipay() :: %{optional(:setup_future_usage) => :none | :off_session}

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

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

Settings for automatic tax calculation for this order.

@type bancontact() :: %{
  optional(:preferred_language) => :de | :en | :fr | :nl,
  optional(:setup_future_usage) => :none | :off_session
}

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

@type bank_transfer() :: %{
  :eu_bank_transfer => eu_bank_transfer(),
  optional(:requested_address_types) => [
    :iban | :sepa | :sort_code | :spei | :zengin
  ],
  optional(:type) =>
    :eu_bank_transfer
    | :gb_bank_transfer
    | :jp_bank_transfer
    | :mx_bank_transfer
}

If paying by customer_balance, this sub-hash contains details about the Customer Balance payment method options to pass to the order's PaymentIntent.

@type billing_details() :: %{
  :address => address(),
  optional(:email) => :string,
  optional(:name) => :string,
  optional(:phone) => :string
}
@type card() :: %{
  optional(:capture_method) => :automatic | :manual,
  optional(:setup_future_usage) => :none | :off_session | :on_session
}

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

@type customer_balance() :: %{
  :bank_transfer => bank_transfer(),
  optional(:funding_type) => :bank_transfer,
  optional(:setup_future_usage) => :none
}

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

@type delivery_estimate() :: %{maximum: maximum(), minimum: minimum()}

Parameters to create a new ad-hoc shipping rate for this order.

@type discounts() :: %{
  optional(:coupon) => :string,
  optional(:discount) => :string,
  optional(:promotion_code) => :string
}
@type eu_bank_transfer() :: %{optional(:country) => :string}

Configuration for the bank transfer funding type, if the funding_type is set to bank_transfer.

@type fixed_amount() :: %{
  optional(:amount) => :integer,
  optional(:currency) => :string,
  currency_options: :object
}

Parameters to create a new ad-hoc shipping rate for this order.

@type ideal() :: %{optional(:setup_future_usage) => :none | :off_session}

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

@type klarna() :: %{
  optional(:capture_method) => :manual,
  optional(:preferred_locale) =>
    :"da-DK"
    | :"de-AT"
    | :"de-CH"
    | :"de-DE"
    | :"en-AT"
    | :"en-AU"
    | :"en-BE"
    | :"en-CA"
    | :"en-CH"
    | :"en-DE"
    | :"en-DK"
    | :"en-ES"
    | :"en-FI"
    | :"en-FR"
    | :"en-GB"
    | :"en-IE"
    | :"en-IT"
    | :"en-NL"
    | :"en-NO"
    | :"en-NZ"
    | :"en-PL"
    | :"en-PT"
    | :"en-SE"
    | :"en-US"
    | :"es-ES"
    | :"es-US"
    | :"fi-FI"
    | :"fr-BE"
    | :"fr-CA"
    | :"fr-CH"
    | :"fr-FR"
    | :"it-CH"
    | :"it-IT"
    | :"nb-NO"
    | :"nl-BE"
    | :"nl-NL"
    | :"pl-PL"
    | :"pt-PT"
    | :"sv-FI"
    | :"sv-SE",
  optional(:setup_future_usage) => :none
}

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

@type line_items() :: %{
  optional(:description) => :string,
  optional(:discounts) => [:object] | :string,
  optional(:price) => :string,
  :price_data => price_data(),
  optional(:product) => :string,
  :product_data => product_data(),
  optional(:quantity) => :integer,
  optional(:tax_rates) => [:string] | :string
}
@type link() :: %{
  optional(:capture_method) => :manual,
  optional(:persistent_token) => :string,
  optional(:setup_future_usage) => :none | :off_session
}

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

@type mandate_options() :: %{
  optional(:custom_mandate_url) => :string | :string,
  optional(:interval_description) => :string,
  optional(:payment_schedule) => :combined | :interval | :sporadic,
  optional(:transaction_type) => :business | :personal
}

If paying by acss_debit, this sub-hash contains details about the ACSS Debit payment method options to pass to the order's PaymentIntent.

@type maximum() :: %{
  optional(:unit) => :business_day | :day | :hour | :month | :week,
  optional(:value) => :integer
}

The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.

@type minimum() :: %{
  optional(:unit) => :business_day | :day | :hour | :month | :week,
  optional(:value) => :integer
}

The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.

@type oxxo() :: %{
  optional(:expires_after_days) => :integer,
  optional(:setup_future_usage) => :none
}

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

@type p24() :: %{
  optional(:setup_future_usage) => :none,
  optional(:tos_shown_and_accepted) => :boolean
}

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

@type payment() :: %{settings: settings()}

Payment information associated with the order, including payment settings.

Link to this type

payment_method_options()

View Source
@type payment_method_options() :: %{
  acss_debit: acss_debit(),
  afterpay_clearpay: afterpay_clearpay(),
  alipay: alipay(),
  bancontact: bancontact(),
  card: card(),
  customer_balance: customer_balance(),
  ideal: ideal(),
  klarna: klarna(),
  link: link(),
  oxxo: oxxo(),
  p24: p24(),
  sepa_debit: sepa_debit(),
  sofort: sofort(),
  wechat_pay: wechat_pay()
}

Settings describing how the order should configure generated PaymentIntents.

@type price_data() :: %{
  optional(:currency) => :string,
  optional(:product) => :string,
  optional(:tax_behavior) => :exclusive | :inclusive | :unspecified,
  optional(:unit_amount) => :integer,
  optional(:unit_amount_decimal) => :string
}
@type product_data() :: %{
  optional(:description) => :string,
  optional(:id) => :string,
  optional(:images) => [:string] | :string,
  optional(:metadata) => :object | :string,
  optional(:name) => :string,
  optional(:package_dimensions) => :object | :string,
  optional(:shippable) => :boolean,
  optional(:tax_code) => :string,
  optional(:url) => :string | :string
}
@type sepa_debit() :: %{
  :mandate_options => :object,
  optional(:setup_future_usage) => :none | :off_session | :on_session
}

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

@type settings() :: %{
  optional(:application_fee_amount) => :integer,
  :payment_method_options => payment_method_options(),
  optional(:payment_method_types) => [
    :acss_debit
    | :afterpay_clearpay
    | :alipay
    | :au_becs_debit
    | :bacs_debit
    | :bancontact
    | :card
    | :customer_balance
    | :eps
    | :fpx
    | :giropay
    | :grabpay
    | :ideal
    | :klarna
    | :link
    | :oxxo
    | :p24
    | :sepa_debit
    | :sofort
    | :wechat_pay
  ],
  optional(:return_url) => :string,
  optional(:statement_descriptor) => :string,
  optional(:statement_descriptor_suffix) => :string,
  transfer_data: transfer_data()
}

Payment information associated with the order, including payment settings.

@type shipping_cost() :: %{
  optional(:shipping_rate) => :string,
  shipping_rate_data: shipping_rate_data()
}
@type shipping_details() :: %{
  :address => address(),
  :name => :string,
  optional(:phone) => :string
}
@type shipping_rate_data() :: %{
  :delivery_estimate => delivery_estimate(),
  optional(:display_name) => :string,
  :fixed_amount => fixed_amount(),
  :metadata => :object,
  optional(:tax_behavior) => :exclusive | :inclusive | :unspecified,
  optional(:tax_code) => :string,
  optional(:type) => :fixed_amount
}
@type sofort() :: %{
  optional(:preferred_language) => :de | :en | :es | :fr | :it | :nl | :pl,
  optional(:setup_future_usage) => :none | :off_session
}

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

@type t() :: %Stripe.Order{
  amount_subtotal: integer(),
  amount_total: integer(),
  application: (binary() | term()) | nil,
  automatic_tax: term(),
  billing_details: term() | nil,
  client_secret: binary() | nil,
  created: integer(),
  currency: binary(),
  customer: (binary() | Stripe.Customer.t() | Stripe.DeletedCustomer.t()) | nil,
  description: binary() | nil,
  discounts: term() | nil,
  id: binary(),
  ip_address: binary() | nil,
  line_items: term(),
  livemode: boolean(),
  metadata: term() | nil,
  object: binary(),
  payment: term(),
  shipping_cost: term() | nil,
  shipping_details: term() | nil,
  status: binary(),
  tax_details: term(),
  total_details: term()
}

The order type.

  • amount_subtotal Order cost before any discounts or taxes are applied. A positive integer representing the subtotal of the order in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency).
  • amount_total Total order cost after discounts and taxes are applied. A positive integer representing the cost of the order in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). To submit an order, the total must be either 0 or at least $0.50 USD or equivalent in charge currency.
  • application ID of the Connect application that created the Order, if any.
  • automatic_tax
  • billing_details Customer billing details associated with the order.
  • client_secret The client secret of this Order. Used for client-side retrieval using a publishable key.

The client secret can be used to complete a payment for an Order from your frontend. It should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.

Refer to our docs for creating and processing an order to learn about how client_secret should be handled.

  • 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 orders belongs to.
  • description An arbitrary string attached to the object. Often useful for displaying to users.
  • discounts The discounts applied to the order. Use expand[]=discounts to expand each discount.
  • id Unique identifier for the object.
  • ip_address A recent IP address of the purchaser used for tax reporting and tax location inference.
  • line_items A list of line items the customer is ordering. Each line item includes information about the product, the quantity, and the resulting cost. There is a maximum of 100 line items.
  • 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.
  • object String representing the object's type. Objects of the same type share the same value.
  • payment
  • shipping_cost The details of the customer cost of shipping, including the customer chosen ShippingRate.
  • shipping_details Customer shipping information associated with the order.
  • status The overall status of the order.
  • tax_details
  • total_details
@type tax_details() :: %{
  optional(:tax_exempt) => :exempt | :none | :reverse,
  optional(:tax_ids) => [:object]
}

Additional tax details about the purchaser to be used for this order.

@type transfer_data() :: %{
  optional(:amount) => :integer,
  optional(:destination) => :string
}

Settings describing how the order should configure generated PaymentIntents.

@type wechat_pay() :: %{
  optional(:app_id) => :string,
  optional(:client) => :android | :ios | :web,
  optional(:setup_future_usage) => :none
}

PaymentMethod-specific configuration to provide to the order's PaymentIntent.

Link to this section Functions

Link to this function

cancel(client, id, params \\ %{})

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

Cancels the order as well as the payment intent if one is attached.

Details

  • Method: post
  • Path: /v1/orders/{id}/cancel
Link to this function

create(client, params \\ %{})

View Source
@spec create(
  client :: term(),
  params :: %{
    optional(:automatic_tax) => automatic_tax(),
    optional(:billing_details) => billing_details() | :string,
    :currency => :string,
    optional(:customer) => :string,
    optional(:description) => :string,
    optional(:discounts) => [discounts()] | :string,
    optional(:expand) => [:string],
    optional(:ip_address) => :string,
    :line_items => [line_items()],
    :metadata => :object,
    optional(:payment) => payment(),
    optional(:shipping_cost) => shipping_cost() | :string,
    optional(:shipping_details) => shipping_details() | :string,
    optional(:tax_details) => tax_details()
  }
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Creates a new open order object.

Details

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

list(client, params \\ %{})

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

Returns a list of your orders. The orders are returned sorted by creation date, with the most recently created orders appearing first.

Details

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

list_line_items(client, id, params \\ %{})

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

When retrieving an order, 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/orders/{id}/line_items
Link to this function

reopen(client, id, params \\ %{})

View Source
@spec reopen(
  client :: term(),
  id :: binary(),
  params :: %{optional(:expand) => [:string]}
) ::
  {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Reopens a submitted order.

Details

  • Method: post
  • Path: /v1/orders/{id}/reopen
Link to this function

retrieve(client, id, params \\ %{})

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

Retrieves the details of an existing order. Supply the unique order ID from either an order creation request or the order list, and Stripe will return the corresponding order information.

Details

  • Method: get
  • Path: /v1/orders/{id}
Link to this function

submit(client, id, params \\ %{})

View Source
@spec submit(
  client :: term(),
  id :: binary(),
  params :: %{optional(:expand) => [:string], expected_total: :integer}
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Submitting an Order transitions the status to processing and creates a PaymentIntent object so the order can be paid. If the Order has an amount_total of 0, no PaymentIntent object will be created. Once the order is submitted, its contents cannot be changed, unless the reopen method is called.

Details

  • Method: post
  • Path: /v1/orders/{id}/submit
Link to this function

update(client, id, params \\ %{})

View Source
@spec update(
  client :: term(),
  id :: binary(),
  params :: %{
    optional(:automatic_tax) => automatic_tax(),
    optional(:billing_details) => billing_details() | :string,
    optional(:currency) => :string,
    optional(:customer) => :string,
    optional(:description) => :string,
    optional(:discounts) => [discounts()] | :string,
    optional(:expand) => [:string],
    optional(:ip_address) => :string,
    optional(:line_items) => [line_items()],
    optional(:metadata) => :object | :string,
    optional(:payment) => payment(),
    optional(:shipping_cost) => shipping_cost() | :string,
    optional(:shipping_details) => shipping_details() | :string,
    optional(:tax_details) => tax_details()
  }
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Updates the specific order by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

Details

  • Method: post
  • Path: /v1/orders/{id}