New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@stripe/react-connect-js

Package Overview
Dependencies
Maintainers
0
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stripe/react-connect-js

React components for Connect.js and Connect embedded components

  • 3.3.21
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43K
decreased by-11.39%
Maintainers
0
Weekly downloads
 
Created
Source

@stripe/react-connect-js

React Connect.js

React components for Connect.js and Connect embedded components

This project is a thin React wrapper around Connect embedded components. It allows you to add embedded components to any React app, and manages the state and lifecycle of embedded components for you.

Note: Some Connect embedded components are currently still in preview. These can be viewed on our doc site, where you can also request preview access.

Components

The list of supported components and their required parameters can be found here

Minimal example

First, install React Connect.js and Connect.js.

npm install @stripe/react-connect-js @stripe/connect-js

You have to wrap your components with ConnectComponentsProvider in order to provide the ConnectInstance context to create or update components

Example

See more examples in the /examples folder

import React from 'react';
import ReactDOM from 'react-dom';
import {loadConnectAndInitialize} from '@stripe/connect-js';
import {
  ConnectPayments,
  ConnectPayouts,
  ConnectPaymentDetails,
  ConnectComponentsProvider,
} from '@stripe/react-connect-js';

const fetchClientSecret = async () => {
  // Fetch the AccountSession client secret by making an API call to your service
};
const connectInstance = loadConnectAndInitialize({
  publishableKey: '{{pk test123}}',
  fetchClientSecret: fetchClientSecret,
  appearance: {
    variables: {
      colorPrimary: '#228403', //optional appearance param,
    },
  },
});

const App = () => (
  <ConnectComponentsProvider connectInstance={connectInstance}>
    <ConnectPayments />
    <ConnectPayouts />
    <ConnectPaymentDetails
      onClose={() => {
        console.log('closed');
      }}
      payment="pi_test123"
    />
  </ConnectComponentsProvider>
);

ReactDOM.render(<App />, document.body);

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

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

Contributing

If you would like to contribute to React Connect.js, please make sure to read our contributor guidelines.

Keywords

FAQs

Package last updated on 21 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc