View Source Stripe.CustomerSession (stripity_stripe v3.2.0)

A customer session allows you to grant client access to Stripe's frontend SDKs (like StripeJs) control over a customer.

Summary

Types

Configuration for buy button.

Configuration for each component. 1 component must be enabled.

Configuration for the pricing table.

t()

The customer_session type.

Functions

Creates a customer session object that includes a single-use client secret that you can use on your front-end to grant client-side API access for certain customer resources.

Types

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

Configuration for buy button.

@type components() :: %{
  optional(:buy_button) => buy_button(),
  optional(:pricing_table) => pricing_table()
}

Configuration for each component. 1 component must be enabled.

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

Configuration for the pricing table.

@type t() :: %Stripe.CustomerSession{
  client_secret: binary(),
  components: term(),
  created: integer(),
  customer: binary() | Stripe.Customer.t(),
  expires_at: integer(),
  livemode: boolean(),
  object: binary()
}

The customer_session type.

  • client_secret The client secret of this customer session. Used on the client to set up secure access to the given customer.

The client secret can be used to provide access to customer from your frontend. It should not be stored, logged, or exposed to anyone other than the relevant customer. Make sure that you have TLS enabled on any page that includes the client secret.

  • components
  • created Time at which the object was created. Measured in seconds since the Unix epoch.
  • customer The customer the customer session was created for.
  • expires_at The timestamp at which this customer session will expire.
  • livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode.
  • object String representing the object's type. Objects of the same type share the same value.

Functions

Link to this function

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

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

Creates a customer session object that includes a single-use client secret that you can use on your front-end to grant client-side API access for certain customer resources.

Details

  • Method: post
  • Path: /v1/customer_sessions