3.3.5 • Published 20 days ago

@stripe/connect-js v3.3.5

Weekly downloads
-
License
MIT
Repository
github
Last release
20 days ago

Connect.js ES Module

The Connect.js library and its supporting API allows you to add connected account dashboard functionality to your website. This NPM package contains initialization logic for Connect embedded components along with related types.

Calling loadConnect always loads the latest version of Connect.js, regardless of which version of @stripe/connect-js you use. Updates for this package only impact tooling around the loadConnect helper itself and the TypeScript type definitions provided for Connect.js. Updates do not affect runtime availability of features of Connect.js.

Note: Connect embedded components is currently still in beta. Please contact us to request beta access.

Installation

Use npm to install the Connect.js module:

npm install @stripe/connect-js

Documentation

Usage

loadConnect

This function returns a Promise that resolves with a newly created StripeConnect object once Connect.js has loaded. If necessary, it will load Connect.js for you by inserting the Connect.js script tag.

The stripeConnect.initialize function returns a ConnectInstance once you initialize it with a publishable key and a client secret returned from the Account Session API call.

import { loadConnect } from "@stripe/connect-js";

const stripeConnect = await loadConnect();
const connectInstance = stripeConnect.initialize({
  publishableKey: "{{pk test123}}",
  clientSecret: "{{client secret}}"
});

We’ve placed a random API key in this example. Replace it with your actual publishable API keys to test this code through your Connect account.

If you have deployed a Content Security Policy, make sure to include Connect.js in your directives.

Import as a side effect

Import @stripe/connect-js as a side effect in code that will be included throughout your site (e.g. your root module). This will make sure the Connect.js script tag is inserted immediately upon page load.

import "@stripe/connect-js";

Manually include the script tag

Manually add the Connect.js script tag to the <head> of each page on your site. If an existing script tag is already present, this module will not insert a new one. When you call loadConnect, it will use the existing script tag.

<!-- Somewhere in your site's <head> -->
<script src="https://connect-js.stripe.com/v0.1/connect.js" async></script>

Importing loadConnect without side effects

If you would like to use loadConnect in your application, but defer loading the Connect.js script until loadConnect is first called, use the alternative @stripe/connect-js/pure import path:

import { loadConnect } from "@stripe/connect-js/pure";

// Connect.js will not be loaded until `loadConnect` is called
const stripeConnect = await loadConnect();
3.3.6-beta-1

20 days ago

3.3.5-beta-1

22 days ago

3.3.5

22 days ago

3.3.4

27 days ago

3.3.4-beta-1

1 month ago

3.3.3-beta-1

1 month ago

3.3.3

1 month ago

3.3.2-beta-1

1 month ago

3.3.1

2 months ago

3.3.1-beta-1

2 months ago

3.3.0

4 months ago

3.3.0-beta-1

4 months ago

3.2.2-beta-1

5 months ago

3.1.1-beta.1

5 months ago

3.2.0

5 months ago

3.2.1-beta.1

5 months ago

1.1.0

8 months ago

2.0.1-beta.8

7 months ago

3.0.0-beta.1

6 months ago

1.0.9

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

3.1.0-beta.1

6 months ago

2.0.3

8 months ago

2.0.2

8 months ago

2.0.5

7 months ago

2.0.4

8 months ago

2.0.1-beta.2

8 months ago

2.0.1-beta.3

8 months ago

2.0.0-beta.1

8 months ago

2.0.1-beta.1

8 months ago

2.0.1-beta.6

7 months ago

2.0.1-beta.7

7 months ago

2.0.1-beta.4

8 months ago

2.0.1

8 months ago

2.0.1-beta.5

7 months ago

2.0.0

8 months ago

3.1.0

6 months ago

3.0.1

6 months ago

3.2.0-beta.1

6 months ago

3.0.0

6 months ago

1.0.10

8 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

1 year ago

1.0.0

1 year ago