View Source Stripe.AccountSession (stripity_stripe v3.2.0)

An AccountSession allows a Connect platform to grant access to a connected account in Connect embedded components.

We recommend that you create an AccountSession each time you need to display an embedded component to your user. Do not save AccountSessions to your database as they expire relatively quickly, and cannot be used more than once.

Related guide: Connect embedded components

Summary

Types

Configuration for the account onboarding embedded component.

Each key of the dictionary represents an embedded component, and each embedded component maps to its configuration (e.g. whether it has been enabled or not).

The list of features enabled in the embedded component.

Configuration for the payment details embedded component.

Configuration for the payments embedded component.

Configuration for the payouts embedded component.

t()

The account_session type.

Functions

Creates a AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access.

Types

@type account_onboarding() :: %{
  optional(:enabled) => boolean(),
  optional(:features) => map()
}

Configuration for the account onboarding embedded component.

@type components() :: %{
  optional(:account_onboarding) => account_onboarding(),
  optional(:payment_details) => payment_details(),
  optional(:payments) => payments(),
  optional(:payouts) => payouts()
}

Each key of the dictionary represents an embedded component, and each embedded component maps to its configuration (e.g. whether it has been enabled or not).

@type features() :: %{
  optional(:capture_payments) => boolean(),
  optional(:dispute_management) => boolean(),
  optional(:refund_management) => boolean()
}

The list of features enabled in the embedded component.

@type payment_details() :: %{
  optional(:enabled) => boolean(),
  optional(:features) => features()
}

Configuration for the payment details embedded component.

@type payments() :: %{
  optional(:enabled) => boolean(),
  optional(:features) => features()
}

Configuration for the payments embedded component.

@type payouts() :: %{
  optional(:enabled) => boolean(),
  optional(:features) => features()
}

Configuration for the payouts embedded component.

@type t() :: %Stripe.AccountSession{
  account: binary(),
  client_secret: binary(),
  components: term(),
  expires_at: integer(),
  livemode: boolean(),
  object: binary()
}

The account_session type.

  • account The ID of the account the AccountSession was created for
  • client_secret The client secret of this AccountSession. Used on the client to set up secure access to the given account.

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

Refer to our docs to setup Connect embedded components and learn about how client_secret should be handled.

  • components
  • expires_at The timestamp at which this AccountSession 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(:account) => binary(),
    optional(:components) => components(),
    optional(:expand) => [binary()]
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Creates a AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access.

Details

  • Method: post
  • Path: /v1/account_sessions