Get started with Connect embedded componentsBeta
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.
For an immersive version of this guide, see the Connect embedded components integration quickstart. You can also download a sample integration from there.
Initialize Connect.jsClient-sideServer-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 in the web client to access a connected account’s resources as if you were making the API calls for them.
Configuring Connect.jsClient-side
The initialize
method of stripeConnect
on the client takes several different options to configure Connect.js.
Option | Description | |
---|---|---|
publishableKey | The publishable key for your integration. | required |
clientSecret | The client secret returned by /v1/account_sessions . This tells StripeConnect which account to delegate access to. | required |
appearance | An object to customize the look of Connect embedded components. | optional |
uiConfig | An object to customize the behavior of Connect embedded components. | optional |
refreshClientSecret | An async function that returns a promise that resolves to a new client secret. This is necessary for Connect embedded components to continue working through long running sessions. | optional |
locale | A parameter to specify the locale that Connect embedded components use. The locale defaults to the browser language. If the language passed in isn’t directly supported, a reasonable alternative is used (for example fr-be might fall back to fr-fr ). | optional |
Customize the look of Connect embedded components
We offer a set of options to customize the look feel of Connect embedded components. These customizations affect buttons, icons, and other accents in our design system.
You can set these options when initializing StripeConnectInstance
by passing values to the appearance
object. These colors apply to all Connect embedded components in your application. The Connect.js options are the only supported mechanisms for changing styles in Connect embedded components. Overriding Connect embedded component styles with CSS selectors or other mechanisms isn’t supported.
const stripeConnectInstance = stripeConnect.initialize({ publishableKey:
, clientSecret: "{{CLIENT_SECRET}}", appearance: { colorPrimary: "#FF0000", }, uiConfig: { overlay: "dialog", }, // See all possible variables below });"pk_test_TYooMQauvdEDq54NiTphI7jx"
Refreshing the client secret
On long running sessions, the session from the initially provided client secret might expire. When it expires, subsequent calls to the API fail if the session isn’t refreshed. To refresh the session, add refreshClientSecret
to initialize
, which accepts an async function that calls your server and returns a new client secret.
// Example method to retrieve the client secret from your server const fetchClientSecret = async () => { const response = await fetch('/account_session'); const {client_secret: clientSecret} = await response.json(); return clientSecret; } const stripeConnectInstance = stripeConnect.initialize({ publishableKey: "{{PUBLISHABLE_KEY}}", clientSecret: "{{CLIENT_SECRET}}", refreshClientSecret: async () => { return await fetchClientSecret(); } });
Supported Connect embedded components
Add Connect embedded components to your page as HTML Elements or as React components. The following Connect embedded components are available:
Payments
Payment details
Payouts
CSP requirements
If your website implements a Content Security Policy, you need to update the policy by adding the following rules:
script-src
,https://connect-js.stripe.com
;https://js.stripe.com
frame-src
,https://connect-js.stripe.com
style-src
,unsafe-inline
HTTP headers
Setting certain HTTP response headers enables the full functionality of Connect embedded components:
Cross-Origin-Opener-Policy
,unsafe-none
. Note: this is the default value of the header, so not setting this header works.
Error handling
The AccountSession API can return specific 40x
errors. See the error code reference for a list of all error codes.
The following table describes how to handle errors that are specific to AccountSession
. See the error handling guide for more general guidance.
Error code | Reason |
---|---|
invalid_request_error | The beta header is missing and needs to be specified. |
parameter_missing | The account parameter hasn’t been passed in. |
resource_missing | No account has that specified ID, or no account exists with that ID that matches the livemode of the API key. |
Supported browsers
We support the same set of browsers that the Stripe Dashboard currently supports:
- The last 20 major versions of Chrome and Firefox
- The last two major versions of Safari and Edge
- The last two major versions of mobile Safari on iOS
Supported languages
We localized Connect embedded components for the following languages:
Language | Locale 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 (Turkey) | tr-TR |
Vietnamese (Vietnam) | vi-VN |
Get access to embedded componentsBeta
Interested in using Connect embedded components?
Thank you! We'll be in touch soon.