Connect Quickstart

    Learn how to process payments on behalf of connected accounts. If you need help after reading this, search our documentation or check out answers to common questions. You can even chat live with other developers in #stripe on freenode.

    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 using test data, and can be run using curl. Or 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 and it’s fine to use temporary values while testing a Connect integration.

    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 Stripe’s API in other ways). Your live integration requires a unique account for each seller or service provider, but to test Connect, you only need to create one.

    The following code creates a Custom account, although Connect supports two other account types as well.

    curl https://api.stripe.com/v1/accounts \
       -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
       -d country=US \
       -d type=custom
    
    # 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"
    
    acct = Stripe::Account.create({
        :country => "US",
        :type => "custom"
    })
    
    # 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"
    
    acct = stripe.Account.create(
      country="US",
      type="custom"
    )
    
    // 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");
    
    $acct = \Stripe\Account::create(array(
        "country" => "US",
        "type" => "custom"
    ));
    
    // 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("country", "US");
    params.put("type", "custom");
    
    Account acct = Account.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.accounts.create({
      country: "US",
      type: "custom"
    }).then(function(acct) {
      // 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.AccountParams{
      Country: "US",
      Type: "custom",
    }
    
    acct, err := account.New(params)
    

    Store the received account information on your side, particularly the id property, which you’ll need in Step 3. (You can also find it in the Dashboard; it’ll be something like acct_BnXz7Z1VatFmG4o1.)

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

    Finally, create a charge by providing the account’s ID in a create charge call. This example creates a destination charge although Connect supports two other charging methods.

    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! If this was a real charge for a Custom account, you’d need to:

    1. Attach a bank account or debit card to the connected account as a destination for the funds.
    2. Set the payout schedule on the connected account (it can be automatic as funds come in, automatic on a fixed schedule, or manual).
    3. Handle identity verification of your connected accounts.

    These additional steps apply to Custom accounts; there are fewer responsibilities and capabilities for the platform when it comes to working with Express and Standard accounts.

    We recommend you learn about account balances, see how to authenticate as a connected account, and also implement webhooks for your platform to be automatically notified of Stripe activity.

    Next steps

    Congrats! You’ve processed a payment on a connected account’s behalf using Connect. You can expand on what you’ve learned here by reading these other pages: