Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Developer tools
Get started
Payments
Finance automation
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Overview
Get started with Connect
Integration fundamentals
Example integrations
Onboard accounts
Configure account Dashboards
    Get started with Connect embedded components
      Quickstart
    Customise Connect embedded components
    Supported Connect embedded components
    Stripe Dashboard customisation
    Platform controls for Stripe Dashboard accounts
    Express Dashboard
Accept payments
Pay out to accounts
Manage your Connect platform
Tax forms for your Connect platform
Work with connected account types
HomePlatforms and marketplacesConfigure account Dashboards

Get started with Connect embedded components

Learn how to embed dashboard functionality into your website.

Copy page

Use Connect embedded components to add connected account dashboard functionality to your website. These libraries and their supporting API allow you to grant your users access to Stripe products directly in your dashboard and mobile applications.

Private preview

The Android SDK is currently available with invite only and has the following limitations:

  • Only accounts where controller.requirement_collection is application, such as Custom connected accounts, are supported.
  • User authentication isn’t supported, so you must set features.disable_stripe_user_authentication to true in your server endpoint for any components when you create an account session.

Enter your email in the form below to request an invitation.

Set up StripeConnect
Client-side
Server-side

Stripe uses an AccountSession to express your intent to delegate API access to your connected account.

The AccountSessions API returns a client secret that allows an embedded component to access a connected account’s resources as if you were making the API calls for them.

Create an AccountSession Server

Your app must initiate a request to your server to obtain the account session. Currently, only Account onboarding is supported. You can create a new endpoint on your server that returns the client secret to the app:

main.rb
Ruby
require 'sinatra' require 'stripe' # This is a placeholder - it should be replaced with your secret API key. # Sign in to see your own test API key embedded in code samples. # Don’t submit any personally identifiable information in requests made with this key. Stripe.api_key =
'sk_test_BQokikJOvBiI2HlWgH4olfQ2'
post '/account_session' do content_type 'application/json' # Create an AccountSession begin account_session = Stripe::AccountSession.create({ account:
'{{CONNECTED_ACCOUNT_ID}}'
, components: { account_onboarding: { enabled: true, features: { # Authentication must be disabled for the mobile SDK disable_stripe_user_authentication: true, } } } }) { client_secret: account_session[:client_secret] }.to_json rescue => error puts "An error occurred when calling the Stripe API to create an account session: #{error.message}"; return [500, { error: error.message }.to_json] end end

Caution

User authentication isn’t supported, so you must set features.disable_stripe_user_authentication to true in your server endpoint for any components when you create an account session.

Create Account Session API

The Create Account Session API determines component and feature access for Connect embedded components. Stripe enforces these parameters for any components that correspond to the account session. If your app supports multiple user roles, make sure components and features that are enabled for that account session correspond to the current user’s role. For example, you can enable refund management only for administrators of your site, but not for other users. To make sure user role access are enforced, you must map your site’s user role to account session components.

Install the StripeConnect SDK Client

The Stripe Android SDK is open source and fully documented.

To install the SDK, add connect to the dependencies block of your app/build.gradle file:

build.gradle.kts
Kotlin
plugins { id("com.android.application") } android { ... } dependencies { // ... // Connect Android SDK implementation("com.stripe:connect:21.15.0") }

Note

For details on the latest SDK release and past versions, see the Releases page on GitHub. To receive notifications when a new release is published, watch releases for the repository.

Initialize EmbeddedComponentManager Client

Instantiate an EmbeddedComponentManager with your publishable key and a lambda that retrieves a client secret by calling the new endpoint you created on your server. To handle configuration changes, keep the EmbeddedComponentManager instance in an Activity or Fragment ViewModel.

MyActivityViewModel.kt
Kotlin
class MyActivityViewModel : ViewModel() { val embeddedComponentManager: EmbeddedComponentManager = EmbeddedComponentManager( // This is a placeholder - it should be replaced with your publishable API key. // Sign in to see your own test API key embedded in code samples. // Don't submit any personally identifiable information in requests made with this key. publishableKey =
"pk_test_TYooMQauvdEDq54NiTphI7jx"
, fetchClientSecret = ::fetchClientSecret, ) private suspend fun fetchClientSecret(): String? = try { // Fetch the AccountSession client secret Fuel.post("https://{{YOUR_SERVER_BASE_URL}}/account_session") .awaitString() .let { JSONObject(it).getString("client_secret") } } catch (error: CancellationException) { throw error } catch (error: Exception) { // Handle errors on the client side here println("Error fetching client secret: ${error.message}") null } }

To create a component, first call EmbeddedComponentManager.onActivityCreate() in your Activity’s onCreate method. Then, call the appropriate create method on the EmbeddedComponentManager that you instantiated above. This returns a controller that you can use to present the component in the app.

MyActivity.kt
Kotlin
class MyActivity : FragmentActivity() { private val viewModel: MyActivityViewModel by viewModels() private lateinit var accountOnboardingController: AccountOnboardingController override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) EmbeddedComponentManager.onActivityCreate(this) setContentView(R.layout.my_activity) accountOnboardingController = viewModel.embeddedComponentManager.createAccountOnboardingController(this) } private fun openAccountOnboarding() { accountOnboardingController.show() } }

Configure the Embedded Component Manager
Client-side

See the code reference .

Customize the look of Connect embedded components

The embedded components Figma UI toolkit contains every component, common patterns, and an example application. You can use it to visualize and design embedded UIs on your website.

We offer a set of options to customize the look and feel of Connect embedded components. These customizations affect buttons, icons, and other accents in our design system.

Necessary popups

Some behavior in embedded components, such as user authentication, must be presented in an authenticated WebView. You can’t customize the embedded component to eliminate such WebViews.

You can set these options using Appearance when initializing EmbeddedComponentManager.

MyActivityViewModel.kt
Kotlin
// Specify custom fonts val customFonts = listOf( CustomFontSource( // Font file located in `assets/` folder assetsFilePath = "fonts/myCustomFont.ttf", name = "myCustomFont", weight = 1000, ) ) // Customize appearance val appearance = Appearance.Builder() .typography( Typography.Builder() .fontFamily("myCustomFont") // Same name as the custom font above .fontSizeBase(16f) // Unscaled font size .build() ) .colors( Colors.Builder() .primary(Color.RED) .build() ) .build() val embeddedComponentManager = EmbeddedComponentManager( publishableKey =
"pk_test_TYooMQauvdEDq54NiTphI7jx"
, fetchClientSecret = ::fetchClientSecret, appearance = appearance, customFonts = customFonts, )

Use custom fonts

If you use custom fonts in your app (for example, from .otf or .tff files embedded in your app binary), you must specify the font files in a CustomFontSource passed to the customFonts argument when initializing EmbeddedComponentManager. This gives Connect embedded components access to the font files to properly render the fonts.

Fonts specified in appearance must use a CustomFontSource passed to the EmbeddedComponentManager on initialization to properly render.

See the reference documentation .

Configure appearance

When specifying font sizes, use the unscaled font size that displays for the device’s default size class. The embedded component automatically scales the font size based on the user’s Accessibility font settings.

See the full list of appearance options on Android.

Update Connect embedded components after initialization

Call the update method to change the appearance of the embedded components after initialization:

MyActivity.kt
Kotlin
val appearance = Appearance.Builder() .colors( Colors.Builder() .primary(ContextCompat.getColor(context, R.color.primary)) .build() ) .build() embeddedComponentManager.update(appearance = appearance)

Authentication

We offer a set of APIs to manage account sessions and user credentials in Connect embedded components.

Refresh the client secret

On long running sessions, the session from the initially provided client secret might expire. When it expires, we automatically use fetchClientSecret to retrieve a new client secret and refresh the session. You don’t need to pass in any additional parameters.

MyActivityViewModel.kt
Kotlin
val embeddedComponentManager: EmbeddedComponentManager = EmbeddedComponentManager( publishableKey =
"pk_test_TYooMQauvdEDq54NiTphI7jx"
, fetchClientSecret = ::fetchClientSecret, ) private suspend fun fetchClientSecret(): String? = try { Fuel.post("https://{{YOUR_SERVER_BASE_URL}}/account_session") .awaitString() .let { JSONObject(it).getString("client_secret") } } catch (error: CancellationException) { throw error } catch (error: Exception) { null }

Localization

Connect embedded components support the following locales:

LanguageLocale code
Bulgarian (Bulgaria)bg-BG
Chinese (Simplified)zh-Hans
Chinese (Traditional - Hong Kong)zh-Hant-HK
Chinese (Traditional - Taiwan)zh-Hant-TW
Croatian (Croatia)hr-HR
Czech (Czechia)cs-CZ
Danish (Denmark)da-DK
Dutch (Netherlands)nl-NL
English (Australia)en-AU
English (India)en-IN
English (Ireland)en-IE
English (New Zealand)en-NZ
English (Singapore)en-SG
English (United Kingdom)en-GB
English (United States)en-US
Estonian (Estonia)et-EE
Filipino (Philippines)fil-PH
Finnish (Finland)fi-FI
French (Canada)fr-CA
French (France)fr-FR
German (Germany)de-DE
Greek (Greece)el-GR
Hungarian (Hungary)hu-HU
Indonesian (Indonesia)id-ID
Italian (Italy)it-IT
Japanese (Japan)ja-JP
Korean (South Korea)ko-KR
Latvian (Latvia)lv-LV
Lithuanian (Lithuania)lt-LT
Malay (Malaysia)ms-MY
Maltese (Malta)mt-MT
Norwegian Bokmål (Norway)nb-NO
Polish (Poland)pl-PL
Portuguese (Brazil)pt-BR
Portuguese (Portugal)pt-PT
Romanian (Romania)ro-RO
Slovak (Slovakia)sk-SK
Slovenian (Slovenia)sl-SI
Spanish (Argentina)es-AR
Spanish (Brazil)es-BR
Spanish (Latin America)es-419
Spanish (Mexico)es-MX
Spanish (Spain)es-ES
Swedish (Sweden)sv-SE
Thai (Thailand)th-TH
Turkish (Türkiye)tr-TR
Vietnamese (Vietnam)vi-VN

User authentication in Connect embedded components

Connect embedded components typically don’t require user authentication. In some scenarios, Connect embedded components require the connected account to sign in with their Stripe account before accessing the component to provide the necessary functionality (for example, writing information to the account legal entity in the case of the account onboarding component). Other components might require authentication within the component after they initially render.

Authentication is required for connected accounts where Stripe is responsible for collecting updated information when requirements change. For connected accounts where you’re responsible for collecting updated information when requirements are due or change, such as Custom accounts, Stripe authentication is controlled by the disable_stripe_user_authentication Account Session feature. We recommend implementing 2FA or equivalent security measures as a best practice. For account configurations that support this feature, like Custom, you assume liability for connected accounts if they can’t pay back negative balances.

Components requiring authentication

Connected accounts will be shown an authenticated WebView within your application. The connected account must authenticate before they can continue their workflow within the WebView.

The Stripe-hosted authentication flow shows your brand’s name, color, and icon as set in your Connect settings and doesn’t use your custom appearance and fonts from the Embedded Component Manager until authentication completes.

Android limitation

Due to a limitation within the Android APIs, embedded components can’t use custom fonts within the authenticated WebView, even after authentication completes.

The following component requires connected accounts to authenticate in certain scenarios:

  • Account Onboarding

Handle load errors

If a component doesn’t load, you can react to the failure by implementing the component’s onLoadError listener method. Depending on the cause of failure, the onLoadError method might be called multiple times. Any logic triggered by a onLoadError must be idempotent.

MyActivity.kt
Kotlin
// All components emit load errors. This example uses AccountOnboarding. // All components support onLoadError. class MyActivity : FragmentActivity() { private lateinit var accountOnboardingController: AccountOnboardingController override fun onCreate(savedInstanceState: Bundle?) { accountOnboardingController = embeddedComponentManager.createAccountOnboardingController(this) accountOnboardingController.listener = MyAccountOnboardingListener() } private fun openAccountOnboarding() { accountOnboardingController.show() } private inner class MyAccountOnboardingListener : AccountOnboardingListener { override fun onLoadError(error: Throwable) { println("Error loading account onboarding: ${error.message}") } } }

Request access Private preview

Sign in to request access to the Connect embedded component mobile SDK in preview.

If you don’t have a Stripe account, you can register now.

Was this page helpful?
YesNo
Need help? Contact Support.
Join our early access programme.
Check out our changelog.
Questions? Contact Sales.
LLM? Read llms.txt.
Powered by Markdoc