stripity_stripe v2.7.0 Stripe.Session View Source

Work with Stripe Checkout Session objects.

You can:

  • Create a new session
  • Retrieve a session

Stripe API reference: https://stripe.com/docs/api/checkout/sessions

Link to this section Summary

Link to this section Types

Link to this type

capture_method() View Source
capture_method() :: :automatic | :manual

Link to this type

create_params() View Source
create_params() :: %{
  :cancel_url => String.t(),
  :payment_method_types => [String.t()],
  :success_url => String.t(),
  optional(:client_reference_id) => String.t(),
  optional(:customer_email) => String.t(),
  optional(:line_items) => [line_item()],
  optional(:locale) => String.t(),
  optional(:payment_intent_data) => payment_intent_data(),
  optional(:subscription_data) => subscription_data()
}

Link to this type

item() View Source
item() :: %{:plan => String.t(), optional(:quantity) => integer()}

Link to this type

line_item() View Source
line_item() :: %{
  :amount => integer(),
  :currency => String.t(),
  :name => String.t(),
  :quantity => integer(),
  optional(:description) => String.t(),
  optional(:images) => [String.t()]
}

Link to this type

payment_intent_data() View Source
payment_intent_data() :: %{
  optional(:application_fee_amount) => integer(),
  optional(:capture_method) => capture_method(),
  optional(:description) => String.t(),
  optional(:metadata) => Stripe.Types.metadata(),
  optional(:on_behalf_of) => String.t(),
  optional(:receipt_email) => String.t(),
  optional(:shipping) => Stripe.Types.shipping(),
  optional(:statement_descriptor) => String.t(),
  optional(:transfer_data) => transfer_data()
}

Link to this type

subscription_data() View Source
subscription_data() :: %{
  items: [item()],
  metadata: Stripe.Types.metadata(),
  trial_end: integer(),
  trial_period_days: integer()
}

Link to this type

t() View Source
t() :: %Stripe.Session{
  billing_address_collection: String.t(),
  cancel_url: boolean(),
  client_reference_id: String.t(),
  customer: Stripe.id() | Stripe.Customer.t() | nil,
  customer_email: String.t(),
  display_items: [line_item()],
  id: Stripe.id(),
  livemode: boolean(),
  locale: boolean(),
  mode: String.t(),
  object: String.t(),
  payment_intent: Stripe.id() | Stripe.PaymentIntent.t() | nil,
  payment_method_types: [String.t()],
  submit_type: String.t(),
  subscription: Stripe.id() | Stripe.Subscription.t() | nil,
  success_url: String.t()
}

Link to this type

transfer_data() View Source
transfer_data() :: %{destination: String.t()}

Link to this section Functions

Link to this function

create(params, opts \\ []) View Source
create(create_params(), Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}

Link to this function

retrieve(id, opts \\ []) View Source
retrieve(Stripe.id() | t(), Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}

Retrieve a session.