Getting started overview

Integrating with Stripe Connect involves several key steps, beginning with account setup and API key acquisition. You'll then configure the appropriate Stripe Connect account type for your platform's users, and finally, make a foundational API call using your chosen SDK or direct HTTP requests. This process establishes the basic infrastructure for managing payments through your platform.

Stripe Connect offers three primary account types, each designed for different levels of platform control and user experience:

  • Standard: For platforms that want minimal involvement in user onboarding and compliance. Users maintain a direct relationship with Stripe.
  • Express: Offers a balance between platform control and Stripe's handling of compliance. Platforms can customize the onboarding flow, and users access a Stripe-hosted dashboard.
  • Custom: Provides maximum control to the platform over user onboarding, branding, and user interface. The platform is responsible for all compliance and user experience.

Choosing the correct account type is a foundational decision that impacts your integration complexity and ongoing responsibilities. Detailed guidance on selecting the best fit for your platform can be found in the Stripe platform types documentation.

Create an account and get keys

To begin using Stripe Connect, you must first create a Stripe account. This account serves as your platform's primary interface with Stripe and provides access to your API keys and dashboard.

  1. Sign up for a Stripe account: Navigate to the Stripe registration page and follow the prompts to create a new account. You will need to provide basic business information.
  2. Activate your account: After signing up, you will typically need to complete an activation process, which may include verifying your email and providing additional business details to enable live mode transactions. More information on Stripe account activation is available.
  3. Locate your API keys: Once your account is set up, you can find your API keys in your Stripe Dashboard under Developers > API keys. There are two main types of keys:
    • Publishable key (pk_live_... or pk_test_...): Used client-side in your frontend code (e.g., JavaScript) to tokenize sensitive information like credit card numbers. This key is safe to expose.
    • Secret key (sk_live_... or sk_test_...): Used server-side in your backend code to authenticate API requests. This key must be kept confidential and never exposed in client-side code.
  4. Enable Connect: Ensure that Connect capabilities are enabled for your account. This is typically a default setting, but you can confirm within your Stripe dashboard.

Stripe's API keys follow a standard pattern for secure API access, similar to other platforms like Cloudflare API tokens, where a public key handles non-sensitive operations and a secret key manages authenticated server-side interactions.

Your first request

Making your first API request involves creating a connected account. This example uses Node.js, but similar patterns apply to other Stripe-supported SDKs.

Installation

First, install the Stripe Node.js library:

npm install --save stripe

Environment Setup

Set your Stripe secret key as an environment variable or directly within your server-side code (for development purposes).

export STRIPE_SECRET_KEY='sk_test_YOUR_SECRET_KEY'

Create a Connected Account (Express Example)

This example demonstrates how to create an Express connected account. Express accounts require a type of express and minimal information to start the onboarding process.

const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);

async function createExpressAccount() {
  try {
    const account = await stripe.accounts.create({
      type: 'express',
      country: 'US',
      email: '[email protected]',
      capabilities: {
        card_payments: { requested: true },
        transfers: { requested: true },
      },
      business_type: 'individual',
    });
    console.log('Express Account created:', account.id);
    
    // Generate an account link for onboarding
    const accountLink = await stripe.accountLinks.create({
      account: account.id,
      refresh_url: 'https://example.com/reauth',
      return_url: 'https://example.com/return',
      type: 'account_onboarding',
      collect: 'eventually_due',
    });
    console.log('Onboarding Link:', accountLink.url);

  } catch (error) {
    console.error('Error creating Express account:', error);
  }
}

createExpressAccount();

This code snippet:

  1. Initializes the Stripe library with your secret key.
  2. Calls stripe.accounts.create to provision a new Express account.
  3. Specifies required capabilities (card_payments and transfers) which dictate the functionalities available to the connected account.
  4. Generates an accountLink URL, which your user must visit to complete their onboarding and identity verification with Stripe. This URL should be redirected to your user's browser.

For more details on creating different account types and managing capabilities, refer to the Stripe API reference for accounts.

Quick Reference: Getting Started Steps

Step What to Do Where
1. Sign Up Create a Stripe account Stripe Registration
2. Get Keys Retrieve Publishable and Secret API keys Stripe Dashboard > Developers > API keys
3. Install SDK Install your preferred Stripe SDK (e.g., npm install --save stripe) Your project's terminal/console
4. Configure SDK Initialize SDK with your Secret API key Your backend code
5. Make Request Call stripe.accounts.create to onboard a connected account Your backend code
6. Handle Onboarding Redirect users to the generated accountLink.url to complete onboarding Your backend code and frontend user flow

Common next steps

After successfully creating your first connected account, several essential steps follow to build a complete Connect integration:

  1. Handle onboarding redirects and webhooks: After a user completes their onboarding via the accountLink, Stripe redirects them to your return_url. You'll also need to set up Stripe webhooks to receive asynchronous updates about the connected account's status (e.g., verification complete, capabilities enabled).
  2. Test payment flows: Implement a payment flow for your platform. This typically involves collecting payment details from your customer, creating a PaymentIntent, and confirming it on the client-side. For Connect, you'll specify the transfer_data[destination] to route funds to the connected account.
  3. Manage payouts: Understand how to initiate payouts from your platform account to your connected accounts, or how connected accounts manage their own payouts depending on the Connect type chosen. Review the Stripe Connect payouts documentation for more information.
  4. Implement error handling and retries: Robust integrations include comprehensive error handling for API calls, network issues, and payment processing failures.
  5. Go live: Once thoroughly tested in development and staging environments, switch your API keys to the live versions and deploy your application. Ensure all compliance requirements for your chosen Connect type are met.

Troubleshooting the first call

Encountering issues during your initial Stripe Connect integration is common. Here are some frequent problems and their solutions:

  • AuthenticationError (401): This usually indicates an incorrect or missing secret API key. Double-check that you are using your sk_test_... key, it is correctly placed in your server-side code, and it hasn't been exposed or compromised. Ensure there are no leading/trailing spaces.
  • InvalidRequestError (400): This error suggests a problem with the parameters sent in your API request. Common causes include:
    • Missing required parameters (e.g., type, country, or capabilities for account creation).
    • Incorrect data types or invalid values for parameters.
    • Using a live API key in test mode, or vice-versa.
    Refer to the Stripe API error codes documentation for specific details on the error message.
  • PermissionError (403): This can occur if your Stripe account does not have the necessary permissions or if the API key used lacks the required capabilities. Verify that Connect is fully enabled for your account and that your secret key is authorized for the operations you are attempting.
  • Network issues: Ensure your server can reach Stripe's API endpoints. Check firewall rules or proxy configurations if your server is in a restricted network environment.
  • SDK version compatibility: Ensure you are using a recent and compatible version of the Stripe SDK. Outdated SDKs might not support the latest API features or could contain bugs.

Leverage the Stripe Dashboard's API request logs (under Developers > Logs) to inspect the exact requests and responses, which can provide detailed insights into any errors or unexpected behavior.