View Source Stripe.Checkout.Session (stripity_stripe v3.2.0)

A Checkout Session represents your customer's session as they pay for one-time purchases or subscriptions through Checkout or Payment Links. We recommend creating a new Session each time your customer attempts to pay.

Once payment is successful, the Checkout Session will contain a reference to the Customer, and either the successful PaymentIntent or an active Subscription.

You can create a Checkout Session on your server and redirect to its URL to begin Checkout.

Related guide: Checkout quickstart

Summary

Types

contains details about the ACSS Debit payment method options.

Shipping address.

When set, provides configuration for this item’s quantity to be adjusted by the customer during Checkout.

contains details about the Affirm payment method options.

Configure actions after a Checkout Session has expired.

contains details about the Afterpay Clearpay payment method options.

contains details about the Alipay payment method options.

contains details about the AU Becs Debit payment method options.

Settings for automatic tax lookup for this session and resulting payments, invoices, and subscriptions.

contains details about the Bacs Debit payment method options.

contains details about the Bancontact payment method options.

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

contains details about the Boleto payment method options.

contains details about the Card payment method options.

contains details about the Cashapp Pay payment method options.

Configure fields for the Checkout Session to gather active consent from customers.

Display additional text for your customers using custom text.

contains details about the Customer Balance payment method options.

Controls what fields on Customer can be updated by the Checkout Session. Can only be provided when customer is provided.

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

Configuration for type=dropdown fields.

Defines how the subscription should behave when the user's free trial ends.

contains details about the EPS payment method options.

Configuration for eu_bank_transfer funding type.

Additional fields for Financial Connections Session creation

Describes a fixed amount to charge for shipping. Must be present if type is fixed_amount.

contains details about the FPX payment method options.

contains details about the Giropay payment method options.

contains details about the Grabpay payment method options.

contains details about the Ideal payment method options.

Installment options for card payments

Generate a post-purchase Invoice for one-time payments.

Parameters passed when creating invoices for payment-mode Checkout Sessions.

contains details about the Klarna payment method options.

contains details about the Konbini payment method options.

The label for the field, displayed to the customer.

contains details about the Link payment method options.

Additional fields for Mandate creation

The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite.

The lower bound of the estimated range. If empty, represents no lower bound.

Configuration for type=numeric fields.

contains details about the OXXO payment method options.

contains details about the P24 payment method options.

A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in payment mode.

Payment-method-specific configuration.

Determines the display of payment method reuse agreement text in the UI. If set to hidden, it will hide legal text related to the reuse of a payment method.

contains details about the PayNow payment method options.

contains details about the PayPal payment method options.

Controls phone number collection settings for the session.

contains details about the Pix payment method options.

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

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

Configure a Checkout Session that can be used to recover an expired session.

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

contains details about the RevolutPay payment method options.

contains details about the Sepa Debit payment method options.

A subset of parameters to be passed to SetupIntent creation for Checkout Sessions in setup mode.

Shipping information for this payment.

When set, provides configuration for Checkout to collect a shipping address from a customer.

Parameters to be passed to Shipping Rate creation for this shipping option

contains details about the Sofort payment method options.

A subset of parameters to be passed to subscription creation for Checkout Sessions in subscription mode.

t()

The checkout.session type.

Controls tax ID collection settings for the session.

Configuration for type=text fields.

The parameters used to automatically create a Transfer when the payment succeeds. For more information, see the PaymentIntents use case for connected accounts.

Settings related to subscription trials.

contains details about the Us Bank Account payment method options.

contains details about the WeChat Pay payment method options.

Functions

Creates a Session object.

A Session can be expired when it is in one of these statuses: open

Returns a list of Checkout Sessions.

When retrieving a Checkout Session, 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.

Retrieves a Session object.

Types

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

contains details about the ACSS Debit payment method options.

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

Shipping address.

@type adjustable_quantity() :: %{
  optional(:enabled) => boolean(),
  optional(:maximum) => integer(),
  optional(:minimum) => integer()
}

When set, provides configuration for this item’s quantity to be adjusted by the customer during Checkout.

@type affirm() :: %{optional(:setup_future_usage) => :none}

contains details about the Affirm payment method options.

@type after_expiration() :: %{optional(:recovery) => recovery()}

Configure actions after a Checkout Session has expired.

@type after_submit() :: %{optional(:message) => binary()}
@type afterpay_clearpay() :: %{optional(:setup_future_usage) => :none}

contains details about the Afterpay Clearpay payment method options.

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

contains details about the Alipay payment method options.

@type au_becs_debit() :: %{optional(:setup_future_usage) => :none}

contains details about the AU Becs Debit payment method options.

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

Settings for automatic tax lookup for this session and resulting payments, invoices, and subscriptions.

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

contains details about the Bacs Debit payment method options.

@type bancontact() :: %{optional(:setup_future_usage) => :none}

contains details about the Bancontact payment method options.

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

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

@type boleto() :: %{
  optional(:expires_after_days) => integer(),
  optional(:setup_future_usage) => :none | :off_session | :on_session
}

contains details about the Boleto payment method options.

@type card() :: %{
  optional(:installments) => installments(),
  optional(:setup_future_usage) => :off_session | :on_session,
  optional(:statement_descriptor_suffix_kana) => binary(),
  optional(:statement_descriptor_suffix_kanji) => binary()
}

contains details about the Card payment method options.

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

contains details about the Cashapp Pay payment method options.

@type consent_collection() :: %{
  optional(:payment_method_reuse_agreement) => payment_method_reuse_agreement(),
  optional(:promotions) => :auto | :none,
  optional(:terms_of_service) => :none | :required
}

Configure fields for the Checkout Session to gather active consent from customers.

@type created() :: %{
  optional(:gt) => integer(),
  optional(:gte) => integer(),
  optional(:lt) => integer(),
  optional(:lte) => integer()
}
@type custom_fields() :: %{optional(:name) => binary(), optional(:value) => binary()}
@type custom_text() :: %{
  optional(:after_submit) => after_submit() | binary(),
  optional(:shipping_address) => shipping_address() | binary(),
  optional(:submit) => submit() | binary(),
  optional(:terms_of_service_acceptance) =>
    terms_of_service_acceptance() | binary()
}

Display additional text for your customers using custom text.

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

contains details about the Customer Balance payment method options.

@type customer_details() :: %{optional(:email) => binary()}
@type customer_update() :: %{
  optional(:address) => :auto | :never,
  optional(:name) => :auto | :never,
  optional(:shipping) => :auto | :never
}

Controls what fields on Customer can be updated by the Checkout Session. Can only be provided when customer is provided.

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

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

@type discounts() :: %{
  optional(:coupon) => binary(),
  optional(:promotion_code) => binary()
}
@type dropdown() :: %{optional(:options) => [options()]}

Configuration for type=dropdown fields.

@type end_behavior() :: %{
  optional(:missing_payment_method) => :cancel | :create_invoice | :pause
}

Defines how the subscription should behave when the user's free trial ends.

@type eps() :: %{optional(:setup_future_usage) => :none}

contains details about the EPS payment method options.

@type eu_bank_transfer() :: %{optional(:country) => binary()}

Configuration for eu_bank_transfer funding type.

Link to this type

financial_connections()

View Source
@type financial_connections() :: %{
  optional(:permissions) => [
    :balances | :ownership | :payment_method | :transactions
  ],
  optional(:prefetch) => [:balances | :transactions]
}

Additional fields for Financial Connections Session creation

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

Describes a fixed amount to charge for shipping. Must be present if type is fixed_amount.

@type fpx() :: %{optional(:setup_future_usage) => :none}

contains details about the FPX payment method options.

@type giropay() :: %{optional(:setup_future_usage) => :none}

contains details about the Giropay payment method options.

@type grabpay() :: %{optional(:setup_future_usage) => :none}

contains details about the Grabpay payment method options.

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

contains details about the Ideal payment method options.

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

Installment options for card payments

@type invoice_creation() :: %{
  optional(:enabled) => boolean(),
  optional(:invoice_data) => invoice_data()
}

Generate a post-purchase Invoice for one-time payments.

@type invoice_data() :: %{
  optional(:account_tax_ids) => [binary()] | binary(),
  optional(:custom_fields) => [custom_fields()] | binary(),
  optional(:description) => binary(),
  optional(:footer) => binary(),
  optional(:metadata) => %{optional(binary()) => binary()},
  optional(:rendering_options) => rendering_options() | binary()
}

Parameters passed when creating invoices for payment-mode Checkout Sessions.

@type klarna() :: %{optional(:setup_future_usage) => :none}

contains details about the Klarna payment method options.

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

contains details about the Konbini payment method options.

@type label() :: %{optional(:custom) => binary(), optional(:type) => :custom}

The label for the field, displayed to the customer.

@type line_items() :: %{
  optional(:adjustable_quantity) => adjustable_quantity(),
  optional(:dynamic_tax_rates) => [binary()],
  optional(:price) => binary(),
  optional(:price_data) => price_data(),
  optional(:quantity) => integer(),
  optional(:tax_rates) => [binary()]
}
@type link() :: %{optional(:setup_future_usage) => :none | :off_session}

contains details about the Link payment method options.

@type mandate_options() :: %{
  optional(:custom_mandate_url) => binary() | binary(),
  optional(:default_for) => [:invoice | :subscription],
  optional(:interval_description) => binary(),
  optional(:payment_schedule) => :combined | :interval | :sporadic,
  optional(:transaction_type) => :business | :personal
}

Additional fields for Mandate creation

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

The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite.

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

The lower bound of the estimated range. If empty, represents no lower bound.

@type numeric() :: %{
  optional(:maximum_length) => integer(),
  optional(:minimum_length) => integer()
}

Configuration for type=numeric fields.

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

contains details about the OXXO payment method options.

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

contains details about the P24 payment method options.

@type payment_intent_data() :: %{
  optional(:application_fee_amount) => integer(),
  optional(:capture_method) => :automatic | :automatic_async | :manual,
  optional(:description) => binary(),
  optional(:metadata) => %{optional(binary()) => binary()},
  optional(:on_behalf_of) => binary(),
  optional(:receipt_email) => binary(),
  optional(:setup_future_usage) => :off_session | :on_session,
  optional(:shipping) => shipping(),
  optional(:statement_descriptor) => binary(),
  optional(:statement_descriptor_suffix) => binary(),
  optional(:transfer_data) => transfer_data(),
  optional(:transfer_group) => binary()
}

A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in payment mode.

Link to this type

payment_method_options()

View Source
@type payment_method_options() :: %{
  optional(:acss_debit) => acss_debit(),
  optional(:affirm) => affirm(),
  optional(:afterpay_clearpay) => afterpay_clearpay(),
  optional(:alipay) => alipay(),
  optional(:au_becs_debit) => au_becs_debit(),
  optional(:bacs_debit) => bacs_debit(),
  optional(:bancontact) => bancontact(),
  optional(:boleto) => boleto(),
  optional(:card) => card(),
  optional(:cashapp) => cashapp(),
  optional(:customer_balance) => customer_balance(),
  optional(:eps) => eps(),
  optional(:fpx) => fpx(),
  optional(:giropay) => giropay(),
  optional(:grabpay) => grabpay(),
  optional(:ideal) => ideal(),
  optional(:klarna) => klarna(),
  optional(:konbini) => konbini(),
  optional(:link) => link(),
  optional(:oxxo) => oxxo(),
  optional(:p24) => p24(),
  optional(:paynow) => paynow(),
  optional(:paypal) => paypal(),
  optional(:pix) => pix(),
  optional(:revolut_pay) => revolut_pay(),
  optional(:sepa_debit) => sepa_debit(),
  optional(:sofort) => sofort(),
  optional(:us_bank_account) => us_bank_account(),
  optional(:wechat_pay) => wechat_pay()
}

Payment-method-specific configuration.

Link to this type

payment_method_reuse_agreement()

View Source
@type payment_method_reuse_agreement() :: %{optional(:position) => :auto | :hidden}

Determines the display of payment method reuse agreement text in the UI. If set to hidden, it will hide legal text related to the reuse of a payment method.

@type paynow() :: %{optional(:setup_future_usage) => :none}

contains details about the PayNow payment method options.

@type paypal() :: %{
  optional(:capture_method) => :manual,
  optional(:preferred_locale) =>
    :"cs-CZ"
    | :"da-DK"
    | :"de-AT"
    | :"de-DE"
    | :"de-LU"
    | :"el-GR"
    | :"en-GB"
    | :"en-US"
    | :"es-ES"
    | :"fi-FI"
    | :"fr-BE"
    | :"fr-FR"
    | :"fr-LU"
    | :"hu-HU"
    | :"it-IT"
    | :"nl-BE"
    | :"nl-NL"
    | :"pl-PL"
    | :"pt-PT"
    | :"sk-SK"
    | :"sv-SE",
  optional(:reference) => binary(),
  optional(:risk_correlation_id) => binary(),
  optional(:setup_future_usage) => :none | :off_session
}

contains details about the PayPal payment method options.

Link to this type

phone_number_collection()

View Source
@type phone_number_collection() :: %{optional(:enabled) => boolean()}

Controls phone number collection settings for the session.

We recommend that you review your privacy policy and check with your legal contacts before using this feature. Learn more about collecting phone numbers with Checkout.

@type pix() :: %{optional(:expires_after_seconds) => integer()}

contains details about the Pix payment method options.

@type price_data() :: %{
  optional(:currency) => binary(),
  optional(:product) => binary(),
  optional(:product_data) => product_data(),
  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 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 recovery() :: %{
  optional(:allow_promotion_codes) => boolean(),
  optional(:enabled) => boolean()
}

Configure a Checkout Session that can be used to recover an expired session.

@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 rendering_options() :: %{
  optional(:amount_tax_display) => :exclude_tax | :include_inclusive_tax
}
@type revolut_pay() :: %{optional(:setup_future_usage) => :none | :off_session}

contains details about the RevolutPay payment method options.

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

contains details about the Sepa Debit payment method options.

@type setup_intent_data() :: %{
  optional(:description) => binary(),
  optional(:metadata) => %{optional(binary()) => binary()},
  optional(:on_behalf_of) => binary()
}

A subset of parameters to be passed to SetupIntent creation for Checkout Sessions in setup mode.

@type shipping() :: %{
  optional(:address) => address(),
  optional(:carrier) => binary(),
  optional(:name) => binary(),
  optional(:phone) => binary(),
  optional(:tracking_number) => binary()
}

Shipping information for this payment.

@type shipping_address() :: %{optional(:message) => binary()}
Link to this type

shipping_address_collection()

View Source
@type shipping_address_collection() :: %{
  optional(:allowed_countries) => [
    :AC
    | :AD
    | :AE
    | :AF
    | :AG
    | :AI
    | :AL
    | :AM
    | :AO
    | :AQ
    | :AR
    | :AT
    | :AU
    | :AW
    | :AX
    | :AZ
    | :BA
    | :BB
    | :BD
    | :BE
    | :BF
    | :BG
    | :BH
    | :BI
    | :BJ
    | :BL
    | :BM
    | :BN
    | :BO
    | :BQ
    | :BR
    | :BS
    | :BT
    | :BV
    | :BW
    | :BY
    | :BZ
    | :CA
    | :CD
    | :CF
    | :CG
    | :CH
    | :CI
    | :CK
    | :CL
    | :CM
    | :CN
    | :CO
    | :CR
    | :CV
    | :CW
    | :CY
    | :CZ
    | :DE
    | :DJ
    | :DK
    | :DM
    | :DO
    | :DZ
    | :EC
    | :EE
    | :EG
    | :EH
    | :ER
    | :ES
    | :ET
    | :FI
    | :FJ
    | :FK
    | :FO
    | :FR
    | :GA
    | :GB
    | :GD
    | :GE
    | :GF
    | :GG
    | :GH
    | :GI
    | :GL
    | :GM
    | :GN
    | :GP
    | :GQ
    | :GR
    | :GS
    | :GT
    | :GU
    | :GW
    | :GY
    | :HK
    | :HN
    | :HR
    | :HT
    | :HU
    | :ID
    | :IE
    | :IL
    | :IM
    | :IN
    | :IO
    | :IQ
    | :IS
    | :IT
    | :JE
    | :JM
    | :JO
    | :JP
    | :KE
    | :KG
    | :KH
    | :KI
    | :KM
    | :KN
    | :KR
    | :KW
    | :KY
    | :KZ
    | :LA
    | :LB
    | :LC
    | :LI
    | :LK
    | :LR
    | :LS
    | :LT
    | :LU
    | :LV
    | :LY
    | :MA
    | :MC
    | :MD
    | :ME
    | :MF
    | :MG
    | :MK
    | :ML
    | :MM
    | :MN
    | :MO
    | :MQ
    | :MR
    | :MS
    | :MT
    | :MU
    | :MV
    | :MW
    | :MX
    | :MY
    | :MZ
    | :NA
    | :NC
    | :NE
    | :NG
    | :NI
    | :NL
    | :NO
    | :NP
    | :NR
    | :NU
    | :NZ
    | :OM
    | :PA
    | :PE
    | :PF
    | :PG
    | :PH
    | :PK
    | :PL
    | :PM
    | :PN
    | :PR
    | :PS
    | :PT
    | :PY
    | :QA
    | :RE
    | :RO
    | :RS
    | :RU
    | :RW
    | :SA
    | :SB
    | :SC
    | :SE
    | :SG
    | :SH
    | :SI
    | :SJ
    | :SK
    | :SL
    | :SM
    | :SN
    | :SO
    | :SR
    | :SS
    | :ST
    | :SV
    | :SX
    | :SZ
    | :TA
    | :TC
    | :TD
    | :TF
    | :TG
    | :TH
    | :TJ
    | :TK
    | :TL
    | :TM
    | :TN
    | :TO
    | :TR
    | :TT
    | :TV
    | :TW
    | :TZ
    | :UA
    | :UG
    | :US
    | :UY
    | :UZ
    | :VA
    | :VC
    | :VE
    | :VG
    | :VN
    | :VU
    | :WF
    | :WS
    | :XK
    | :YE
    | :YT
    | :ZA
    | :ZM
    | :ZW
    | :ZZ
  ]
}

When set, provides configuration for Checkout to collect a shipping address from a customer.

@type shipping_options() :: %{
  optional(:shipping_rate) => binary(),
  optional(:shipping_rate_data) => shipping_rate_data()
}
@type shipping_rate_data() :: %{
  optional(:delivery_estimate) => delivery_estimate(),
  optional(:display_name) => binary(),
  optional(:fixed_amount) => fixed_amount(),
  optional(:metadata) => %{optional(binary()) => binary()},
  optional(:tax_behavior) => :exclusive | :inclusive | :unspecified,
  optional(:tax_code) => binary(),
  optional(:type) => :fixed_amount
}

Parameters to be passed to Shipping Rate creation for this shipping option

@type sofort() :: %{optional(:setup_future_usage) => :none}

contains details about the Sofort payment method options.

@type submit() :: %{optional(:message) => binary()}
@type subscription_data() :: %{
  optional(:application_fee_percent) => number(),
  optional(:billing_cycle_anchor) => integer(),
  optional(:default_tax_rates) => [binary()],
  optional(:description) => binary(),
  optional(:metadata) => %{optional(binary()) => binary()},
  optional(:on_behalf_of) => binary(),
  optional(:proration_behavior) => :create_prorations | :none,
  optional(:transfer_data) => transfer_data(),
  optional(:trial_end) => integer(),
  optional(:trial_period_days) => integer(),
  optional(:trial_settings) => trial_settings()
}

A subset of parameters to be passed to subscription creation for Checkout Sessions in subscription mode.

@type t() :: %Stripe.Checkout.Session{
  after_expiration: term() | nil,
  allow_promotion_codes: boolean() | nil,
  amount_subtotal: integer() | nil,
  amount_total: integer() | nil,
  automatic_tax: term(),
  billing_address_collection: binary() | nil,
  cancel_url: binary() | nil,
  client_reference_id: binary() | nil,
  client_secret: binary() | nil,
  consent: term() | nil,
  consent_collection: term() | nil,
  created: integer(),
  currency: binary() | nil,
  currency_conversion: term() | nil,
  custom_fields: term(),
  custom_text: term(),
  customer: (binary() | Stripe.Customer.t() | Stripe.DeletedCustomer.t()) | nil,
  customer_creation: binary() | nil,
  customer_details: term() | nil,
  customer_email: binary() | nil,
  expires_at: integer(),
  id: binary(),
  invoice: (binary() | Stripe.Invoice.t()) | nil,
  invoice_creation: term() | nil,
  line_items: term(),
  livemode: boolean(),
  locale: binary() | nil,
  metadata: term() | nil,
  mode: binary(),
  object: binary(),
  payment_intent: (binary() | Stripe.PaymentIntent.t()) | nil,
  payment_link: (binary() | Stripe.PaymentLink.t()) | nil,
  payment_method_collection: binary() | nil,
  payment_method_configuration_details: term() | nil,
  payment_method_options: term() | nil,
  payment_method_types: term(),
  payment_status: binary(),
  phone_number_collection: term(),
  recovered_from: binary() | nil,
  redirect_on_completion: binary(),
  return_url: binary(),
  setup_intent: (binary() | Stripe.SetupIntent.t()) | nil,
  shipping_address_collection: term() | nil,
  shipping_cost: term() | nil,
  shipping_details: term() | nil,
  shipping_options: term(),
  status: binary() | nil,
  submit_type: binary() | nil,
  subscription: (binary() | Stripe.Subscription.t()) | nil,
  success_url: binary() | nil,
  tax_id_collection: term(),
  total_details: term() | nil,
  ui_mode: binary() | nil,
  url: binary() | nil
}

The checkout.session type.

  • after_expiration When set, provides configuration for actions to take if this Checkout Session expires.
  • allow_promotion_codes Enables user redeemable promotion codes.
  • amount_subtotal Total of all items before discounts or taxes are applied.
  • amount_total Total of all items after discounts and taxes are applied.
  • automatic_tax
  • billing_address_collection Describes whether Checkout should collect the customer's billing address.
  • cancel_url If set, Checkout displays a back button and customers will be directed to this URL if they decide to cancel payment and return to your website.
  • client_reference_id A unique string to reference the Checkout Session. This can be a customer ID, a cart ID, or similar, and can be used to reconcile the Session with your internal systems.
  • client_secret Client secret to be used when initializing Stripe.js embedded checkout.
  • consent Results of consent_collection for this session.
  • consent_collection When set, provides configuration for the Checkout Session to gather active consent from customers.
  • 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.
  • currency_conversion Currency conversion details for automatic currency conversion sessions
  • custom_fields Collect additional information from your customer using custom fields. Up to 2 fields are supported.
  • custom_text
  • customer The ID of the customer for this Session. For Checkout Sessions in subscription mode or Checkout Sessions with customer_creation set as always in payment mode, Checkout will create a new customer object based on information provided during the payment flow unless an existing customer was provided when the Session was created.
  • customer_creation Configure whether a Checkout Session creates a Customer when the Checkout Session completes.
  • customer_details The customer details including the customer's tax exempt status and the customer's tax IDs. Only the customer's email is present on Sessions in setup mode.
  • customer_email If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once the payment flow is complete, use the customer attribute.
  • expires_at The timestamp at which the Checkout Session will expire.
  • id Unique identifier for the object.
  • invoice ID of the invoice created by the Checkout Session, if it exists.
  • invoice_creation Details on the state of invoice creation for the Checkout Session.
  • line_items The line items purchased by the customer.
  • livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode.
  • locale The IETF language tag of the locale Checkout is displayed in. If blank or auto, the browser's locale is used.
  • 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.
  • mode The mode of the Checkout Session.
  • object String representing the object's type. Objects of the same type share the same value.
  • payment_intent The ID of the PaymentIntent for Checkout Sessions in payment mode.
  • payment_link The ID of the Payment Link that created this Session.
  • payment_method_collection Configure whether a Checkout Session should collect a payment method.
  • payment_method_configuration_details Information about the payment method configuration used for this Checkout session if using dynamic payment methods.
  • payment_method_options Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession.
  • payment_method_types A list of the types of payment methods (e.g. card) this Checkout Session is allowed to accept.
  • payment_status The payment status of the Checkout Session, one of paid, unpaid, or no_payment_required. You can use this value to decide when to fulfill your customer's order.
  • phone_number_collection
  • recovered_from The ID of the original expired Checkout Session that triggered the recovery flow.
  • redirect_on_completion Applies to Checkout Sessions with ui_mode: embedded. By default, Stripe will always redirect to your return_url after a successful confirmation. If you set redirect_on_completion: 'if_required', then we will only redirect if your user chooses a redirect-based payment method.
  • return_url Applies to Checkout Sessions with ui_mode: embedded. The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site.
  • setup_intent The ID of the SetupIntent for Checkout Sessions in setup mode.
  • shipping_address_collection When set, provides configuration for Checkout to collect a shipping address from a customer.
  • shipping_cost The details of the customer cost of shipping, including the customer chosen ShippingRate.
  • shipping_details Shipping information for this Checkout Session.
  • shipping_options The shipping rate options applied to this Session.
  • status The status of the Checkout Session, one of open, complete, or expired.
  • submit_type Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the submit button. submit_type can only be specified on Checkout Sessions in payment mode, but not Checkout Sessions in subscription or setup mode. Possible values are auto, pay, book, donate. If blank or auto, pay is used.
  • subscription The ID of the subscription for Checkout Sessions in subscription mode.
  • success_url The URL the customer will be directed to after the payment or subscription creation is successful.
  • tax_id_collection
  • total_details Tax and discount details for the computed total amount.
  • ui_mode The UI mode of the Session. Can be hosted (default) or embedded.
  • url The URL to the Checkout Session. Redirect customers to this URL to take them to Checkout. If you’re using Custom Domains, the URL will use your subdomain. Otherwise, it’ll use checkout.stripe.com. This value is only present when the session is active.
@type tax_id_collection() :: %{optional(:enabled) => boolean()}

Controls tax ID collection settings for the session.

Link to this type

terms_of_service_acceptance()

View Source
@type terms_of_service_acceptance() :: %{optional(:message) => binary()}
@type text() :: %{
  optional(:maximum_length) => integer(),
  optional(:minimum_length) => integer()
}

Configuration for type=text fields.

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

The parameters used to automatically create a Transfer when the payment succeeds. For more information, see the PaymentIntents use case for connected accounts.

@type trial_settings() :: %{optional(:end_behavior) => end_behavior()}

Settings related to subscription trials.

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

contains details about the Us Bank Account payment method options.

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

contains details about the WeChat Pay payment method options.

Functions

Link to this function

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

View Source
@spec create(
  params :: %{
    optional(:ui_mode) => :embedded | :hosted,
    optional(:payment_method_options) => payment_method_options(),
    optional(:line_items) => [line_items()],
    optional(:custom_fields) => [custom_fields()],
    optional(:customer_creation) => :always | :if_required,
    optional(:expand) => [binary()],
    optional(:metadata) => %{optional(binary()) => binary()},
    optional(:subscription_data) => subscription_data(),
    optional(:payment_method_types) => [
      :acss_debit
      | :affirm
      | :afterpay_clearpay
      | :alipay
      | :au_becs_debit
      | :bacs_debit
      | :bancontact
      | :blik
      | :boleto
      | :card
      | :cashapp
      | :customer_balance
      | :eps
      | :fpx
      | :giropay
      | :grabpay
      | :ideal
      | :klarna
      | :konbini
      | :link
      | :oxxo
      | :p24
      | :paynow
      | :paypal
      | :pix
      | :promptpay
      | :revolut_pay
      | :sepa_debit
      | :sofort
      | :us_bank_account
      | :wechat_pay
      | :zip
    ],
    optional(:locale) =>
      :auto
      | :bg
      | :cs
      | :da
      | :de
      | :el
      | :en
      | :"en-GB"
      | :es
      | :"es-419"
      | :et
      | :fi
      | :fil
      | :fr
      | :"fr-CA"
      | :hr
      | :hu
      | :id
      | :it
      | :ja
      | :ko
      | :lt
      | :lv
      | :ms
      | :mt
      | :nb
      | :nl
      | :pl
      | :pt
      | :"pt-BR"
      | :ro
      | :ru
      | :sk
      | :sl
      | :sv
      | :th
      | :tr
      | :vi
      | :zh
      | :"zh-HK"
      | :"zh-TW",
    optional(:return_url) => binary(),
    optional(:shipping_address_collection) => shipping_address_collection(),
    optional(:consent_collection) => consent_collection(),
    optional(:customer_email) => binary(),
    optional(:phone_number_collection) => phone_number_collection(),
    optional(:invoice_creation) => invoice_creation(),
    optional(:customer) => binary(),
    optional(:submit_type) => :auto | :book | :donate | :pay,
    optional(:customer_update) => customer_update(),
    optional(:custom_text) => custom_text(),
    optional(:mode) => :payment | :setup | :subscription,
    optional(:success_url) => binary(),
    optional(:expires_at) => integer(),
    optional(:automatic_tax) => automatic_tax(),
    optional(:client_reference_id) => binary(),
    optional(:after_expiration) => after_expiration(),
    optional(:tax_id_collection) => tax_id_collection(),
    optional(:currency) => binary(),
    optional(:discounts) => [discounts()],
    optional(:redirect_on_completion) => :always | :if_required | :never,
    optional(:payment_method_configuration) => binary(),
    optional(:payment_method_collection) => :always | :if_required,
    optional(:allow_promotion_codes) => boolean(),
    optional(:billing_address_collection) => :auto | :required,
    optional(:setup_intent_data) => setup_intent_data(),
    optional(:cancel_url) => binary(),
    optional(:payment_intent_data) => payment_intent_data(),
    optional(:shipping_options) => [shipping_options()]
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Creates a Session object.

Details

  • Method: post
  • Path: /v1/checkout/sessions
Link to this function

expire(session, params \\ %{}, opts \\ [])

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

A Session can be expired when it is in one of these statuses: open

After it expires, a customer can’t complete a Session and customers loading the Session see a message saying the Session is expired.

Details

  • Method: post
  • Path: /v1/checkout/sessions/{session}/expire
Link to this function

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

View Source
@spec list(
  params :: %{
    optional(:created) => created() | integer(),
    optional(:customer) => binary(),
    optional(:customer_details) => customer_details(),
    optional(:ending_before) => binary(),
    optional(:expand) => [binary()],
    optional(:limit) => integer(),
    optional(:payment_intent) => binary(),
    optional(:payment_link) => binary(),
    optional(:starting_after) => binary(),
    optional(:status) => :complete | :expired | :open,
    optional(:subscription) => binary()
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Returns a list of Checkout Sessions.

Details

  • Method: get
  • Path: /v1/checkout/sessions
Link to this function

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

View Source
@spec list_line_items(
  session :: 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 Checkout Session, 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/checkout/sessions/{session}/line_items
Link to this function

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

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

Retrieves a Session object.

Details

  • Method: get
  • Path: /v1/checkout/sessions/{session}