Connect Quickstart

    Learn how to process payments on behalf of connected accounts.

    Stripe Connect enables you to use the full Stripe API on behalf of connected accounts. In just three steps you can perform the common task of processing payments on a seller’s or service provider’s behalf:

    1. Register your platform
    2. Create a connected account
    3. Process a payment

    The rest of this quickstart goes through these steps in detail, demonstrating how to onboard new Express accounts via OAuth. You can install one of our client libraries on your server to run the example code in your preferred language.

    Step 1: Register your platform

    The first step to using Connect is to register your platform in the Dashboard. You only need to do this once, though you can change the information at any time.

    Step 2: Create a connected account

    With your platform registered, the second step is to create a connected account on whose behalf you can process payments and use other Stripe APIs.

    Using Express accounts is the easiest way for your platform to onboard users with Connect. When you use Express accounts, Stripe collects banking information from your users and handles identity verification, reducing the work that would otherwise be the responsibility of your platform. A live Express integration requires a unique account for each seller or service provider who operates on your platform, but you only need one Express account to test Connect.

    Express uses an OAuth flow for onboarding connected accounts. The onboarding process consists of three steps:

    1. Your application sends the user to Stripe’s website to provide the necessary details, including banking and contact information.
    2. When the user finishes providing the necessary information, Stripe sends them back to your application’s redirect_uri address and provides an authorization code.
    3. Your application sends a POST request with the authorization code to Stripe’s OAuth token endpoint to complete the connection.

    You can follow the steps below to create your first connected account.

    The Express user onboarding flow

    It’s time to try the onboarding flow for yourself. Following the prompts, you can see what your users experience when creating their own Express accounts. Stripe will redirect you back to this page when you are done.

    To avoid confusion during testing, use a different email address for the connected account than you use for the platform’s Stripe account. If you’d rather not provide an actual phone number, use 000 000 0000 as the phone number and 000-000 as the SMS code when prompted. When asked to provide banking information, use one of Stripe’s test card numbers (e.g., 4000 0566 5566 5556) instead of a real debit card.

    Click the button below to begin the Express user onboarding flow.

    Connect with Stripe

    Finalize the account connection

    When Stripe redirects the user back to your application, it appends the user’s authorization code as a query parameter in the URL. To finalize the connection, send a POST request to Stripe with the authorization code and store the returned account information for later use.

    curl https://connect.stripe.com/oauth/token \
       -d client_secret=sk_test_BQokikJOvBiI2HlWgH4olfQ2 \
       -d code="{AUTHORIZATION_CODE}" \
       -d grant_type=authorization_code
    

    The response includes the user’s account ID, which you’ll need in Step 3. (You can also find it in the Dashboard; it’ll be something like acct_2qAJgOdtR7ZwUk8v.)

    Step 3: Process a payment on the connected account's behalf

    Create a charge by providing the account’s ID in a create charge call. This example creates a destination charge although Connect supports other fund flows.

    curl https://api.stripe.com/v1/charges \
       -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
       -d amount=1000 \
       -d currency=usd \
       -d source=tok_visa \
       -d destination[account]="{CONNECTED_STRIPE_ACCOUNT_ID}"
    
    # Set your secret key: remember to change this to your live secret key in production
    # See your keys here: https://dashboard.stripe.com/account/apikeys
    Stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"
    
    charge = Stripe::Charge.create({
      :amount => 1000,
      :currency => "usd",
      :source => "tok_visa",
      :destination => {
        :account => "{CONNECTED_STRIPE_ACCOUNT_ID}",
      }
    })
    
    # Set your secret key: remember to change this to your live secret key in production
    # See your keys here: https://dashboard.stripe.com/account/apikeys
    stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"
    
    charge = stripe.Charge.create(
      amount=1000,
      currency="usd",
      source="tok_visa",
      destination={
        "account": "{CONNECTED_STRIPE_ACCOUNT_ID}",
      }
    )
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    \Stripe\Stripe::setApiKey("sk_test_BQokikJOvBiI2HlWgH4olfQ2");
    
    $charge = \Stripe\Charge::create(array(
      "amount" => 1000,
      "currency" => "usd",
      "source" => "tok_visa",
      "destination" => array(
        "account" => "{CONNECTED_STRIPE_ACCOUNT_ID}",
      ),
    ));
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    Stripe.apiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2";
    
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("amount", 1000);
    params.put("currency", "usd");
    params.put("source", "tok_visa");
    Map<String, Object> destinationParams = new HashMap<String, Object>();
    destinationParams.put("account", "{CONNECTED_STRIPE_ACCOUNT_ID}");
    params.put("destination", destinationParams);
    Charge charge = Charge.create(params);
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    var stripe = require("stripe")("sk_test_BQokikJOvBiI2HlWgH4olfQ2");
    
    stripe.charges.create({
      amount: 1000,
      currency: "usd",
      source: "tok_visa",
      destination: {
        account: "{CONNECTED_STRIPE_ACCOUNT_ID}",
      },
    }).then(function(charge) {
      // asynchronously called
    });
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    stripe.Key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"
    
    params := &stripe.ChargeParams{
      Amount: 1000,
      Currency: "usd",
      Destination: &stripe.DestinationParams{
        Account: "{CONNECTED_STRIPE_ACCOUNT_ID}",
      },
    }
    params.SetSource("tok_visa")
    
    charge, err := charge.New(params)
    

    The example uses a test tokentok_visa—but you could tokenize a test card using Stripe Elements or Stripe Checkout instead.

    Completing your integration

    You have now processed a payment on behalf of a connected account. We recommend you learn about account balances, see how to authenticate as a connected account, configure a payout schedule, and also implement webhooks for your platform to be automatically notified of Stripe activity.

    Next steps

    You can expand on what you’ve learned here by reading these other pages: