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 is to register your platform in the Dashboard. Click Get started to start the process for activating your account and registering your platform.

    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 need only 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 \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d code=ac_123456789 \ -d grant_type=authorization_code
    # 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_4eC39HqLyjWDarjtT1zdp7dc' response = Stripe::OAuth.token({ grant_type: 'authorization_code', code: 'ac_123456789', }) # Access the connected account id in the response connected_account_id = response.stripe_user_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_4eC39HqLyjWDarjtT1zdp7dc' response = stripe.OAuth.token( grant_type='authorization_code', code='ac_123456789', ) # Access the connected account id in the response connected_account_id = response.stripe_user_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_4eC39HqLyjWDarjtT1zdp7dc'); $response = \Stripe\OAuth::token([ 'grant_type' => 'authorization_code', 'code' => 'ac_123456789', ]); // Access the connected account id in the response $connected_account_id = $response->stripe_user_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_4eC39HqLyjWDarjtT1zdp7dc"; Map<String, Object> params = new HashMap<>(); params.put("grant_type", "authorization_code"); params.put("code", "ac_123456789"); TokenResponse response = OAuth.token(params, null); // Access the connected account ID in the response String accountId = response.getStripeUserId();
    // 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 const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); stripe.oauth.token({ grant_type: 'authorization_code', code: 'ac_123456789', }).then(function(response) { // asynchronously called var connected_account_id = response.stripe_user_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.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.OAuthTokenParams{ GrantType: stripe.String("authorization_code"), Code: stripe.String("ac_123456789"), } token, _ := oauth.New(params) // Access the connected account id in the response connected_account_id = token.StripeUserID
    // 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 StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new OAuthTokenCreateOptions { GrantType = "authorization_code", Code = "ac_123456789", }; var service = new OAuthTokenService(); var response = service.Create(options); // Access the connected account id in the response connected_account_id = response.StripeUserId

    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_2UnaLlqqDpZhnjNG.)

    Step 3: Process a payment for a connected account

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

    curl https://api.stripe.com/v1/charges \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d amount=1000 \ -d currency=usd \ -d source=tok_visa \ -d "transfer_data[destination]"="{{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_4eC39HqLyjWDarjtT1zdp7dc' charge = Stripe::Charge.create({ amount: 1000, currency: "usd", source: "tok_visa", transfer_data: { destination: "{{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_4eC39HqLyjWDarjtT1zdp7dc' charge = stripe.Charge.create( amount=1000, currency="usd", source="tok_visa", transfer_data={ "destination": "{{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_4eC39HqLyjWDarjtT1zdp7dc'); $charge = \Stripe\Charge::create([ "amount" => 1000, "currency" => "usd", "source" => "tok_visa", "transfer_data" => [ "destination" => "{{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_4eC39HqLyjWDarjtT1zdp7dc"; Map<String, Object> params = new HashMap<String, Object>(); params.put("amount", 1000); params.put("currency", "usd"); params.put("source", "tok_visa"); Map<String, Object> transferDataParams = new HashMap<String, Object>(); transferDataParams.put("destination", "{{CONNECTED_STRIPE_ACCOUNT_ID}}"); params.put("transfer_data", transferDataParams); 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 const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); stripe.charges.create({ amount: 1000, currency: "usd", source: "tok_visa", transfer_data: { destination: "{{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_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.ChargeParams{ Amount: stripe.Int64(1000), Currency: stripe.String(string(stripe.CurrencyUSD)), TransferData: &stripe.DestinationParams{ Destination: stripe.String("{{CONNECTED_STRIPE_ACCOUNT_ID}}"), }, } params.SetSource("tok_visa") charge, err := charge.New(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 StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var service = new ChargeService(); var createOptions = new ChargeCreateOptions { Amount = 1000, Currency = "usd", Source = "tok_visa", TransferData = new ChargeTransferDataOptions { Destination = "{{CONNECTED_STRIPE_ACCOUNT_ID}}", }, } service.Create(createOptions);

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

    For a more detailed walkthrough, see the documentation on how to accept a payment.

    This example shows how to specify the connected account as part of the larger payment flow required by the new Payments APIs. You provide the account’s ID in a create PaymentIntent call. The example creates a destination charge. Connect also supports direct charges and separate charges and transfers.

    curl https://api.stripe.com/v1/payment_intents \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d "payment_method_types[]"=card \ -d amount=1000 \ -d currency=usd \ -d "transfer_data[destination]"="{{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_4eC39HqLyjWDarjtT1zdp7dc' payment_intent = Stripe::PaymentIntent.create({ payment_method_types: ['card'], amount: 1000, currency: 'usd', transfer_data: { destination: '{{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_4eC39HqLyjWDarjtT1zdp7dc' payment_intent = stripe.PaymentIntent.create( payment_method_types: ['card'], amount=1000, currency='usd', transfer_data={ 'destination': '{{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_4eC39HqLyjWDarjtT1zdp7dc'); $payment_intent = \Stripe\PaymentIntent::create([ 'payment_method_types' => ['card'], 'amount' => 1000, 'currency' => 'usd', 'transfer_data' => [ 'destination' => '{{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_4eC39HqLyjWDarjtT1zdp7dc"; ArrayList paymentMethodTypes = new ArrayList(); paymentMethodTypes.add("card"); Map<String, Object> params = new HashMap<String, Object>(); params.put("payment_method_types", paymentMethodTypes); params.put("amount", 1000); params.put("currency", "usd"); Map<String, Object> transferDataParams = new HashMap<String, Object>(); transferDataParams.put("destination", "{{CONNECTED_STRIPE_ACCOUNT_ID}}"); params.put("transfer_data", transferDataParams); PaymentIntent paymentIntent = PaymentIntent.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 const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); stripe.paymentIntents.create({ payment_method_types: ['card'], amount: 1000, currency: 'usd', transfer_data: { destination: '{{CONNECTED_STRIPE_ACCOUNT_ID}}', }, }).then(function(paymentIntent) { // 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_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.PaymentIntentParams{ PaymentMethodTypes: stripe.StringSlice([]string{ "card", }), Amount: stripe.Int64(1000), Currency: stripe.String(string(stripe.CurrencyUSD)), TransferData: &stripe.PaymentIntentTransferDataParams{ Destination: stripe.String("{{CONNECTED_STRIPE_ACCOUNT_ID}}"), }, } pi, err := paymentintent.New(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 StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var service = new PaymentIntentService(); var createOptions = new PaymentIntentCreateOptions { PaymentMethodTypes = new List<string> { "card", }, Amount = 2000, Currency = "usd", TransferData = new PaymentIntentTransferDataOptions { Destination = "{{CONNECTED_STRIPE_ACCOUNT_ID}}", }, }; service.Create(createOptions);

    For the complete flow, see the documentation on how to Accept a payment.

    Completing your integration

    You have now processed a payment on behalf of a connected account. We recommend that 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:

    Was this page helpful?

    Thank you for helping improve Stripe's documentation. If you need help or have any questions, please consider contacting support.

    On this page