Initializing
Initializing Stripe.js
Last verified 2026-09-24
Is this helpful?
Stripe(publishableKey: string, options?: object) Use Stripe(publishableKey, options?) to create an instance of the Stripe object. The Stripe object is your entrypoint to the rest of the Stripe.js SDK. Your Stripe publishable API key is required when calling this function, as it identifies your website to Stripe. We've prefilled the example with a sample test API key. Don’t submit any personally identifiable information in requests made with this key. To create a Stripe object using your account, replace the sample API key with your actual API key or sign in. When you’re ready to accept live payments, replace the test key with your live key in production. Learn more about how API keys work in sandboxes and live mode. When you use the same publishable API key and options, create and share a single instance of the Stripe object. Creating multiple instances might lead to performance issues. - publishableKey Your publishable key. - options Initialization options. - stripeAccount For usage with Connect only. Specifying a connected account ID (e.g., acct_24BFMpJ1svR5A89k) allows you to perform actions on behalf of that account. - apiVersion Override your account's API version. This option is only available on Stripe.js v3. For versions after v3 such as acacia, the API version is pinned to the Stripe.js version. - locale A locale used to globally configure localization in Stripe. Setting the locale here will localize error strings for all Stripe.js methods. It will also configure the locale for Elements. Default is auto (Stripe detects the locale of the browser). - developerTools Stripe.js developer tooling options. - assistant Stripe Elements sandbox assistant options. - enabled Set to false to disable the sandbox assistant UI. Defaults to true when using Elements with the Checkout Sessions API or when using Elements with the Payment Intents API on version Clover or above. ### Example title Initializing Stripe.js Is this helpful?