Shared Customers

    With Connect, you can save your customers' payment information for reuse across any of connected accounts.

    For some business models, it’s useful to reuse your customers’ payment information across connected accounts. For example, a customer who makes a purchase from one of your connected sellers shouldn’t need to re-enter their credit card or bank account details to purchase from another seller.

    With Connect, this is possible by following three steps:

    1. Storing customers, with a payment method, on the platform account
    2. Making tokens when its time to charge the customer on behalf of a connected account
    3. Creating charges using the new tokens

    Step 1: Storing customers

    When not using shared customers, you save the Stripe Customer objects on each individual connected Stripe account. To share customers, you instead save them on the platform Stripe account.

    This is a simple API call but be sure to use your own secret and publishable keys instead of the connected user’s.

    curl https://api.stripe.com/v1/customers \
       -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
       -d email="paying.user@example.com" \
       -d source=tok_DA7EIjvtTcdB2y6lmxOSh3GH
    
    # 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"
    
    # Token is created using Stripe.js or Checkout!
    # Get the payment token submitted by the form:
    token = params[:stripeToken]
    
    # Create a Customer:
    customer = Stripe::Customer.create(
      :email => "paying.user@example.com",
      :source => token,
    )
    # YOUR CODE: Save the customer ID and other info in a database for later.
    
    # 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"
    
    # Token is created using Stripe.js or Checkout!
    # Get the payment token submitted by the form:
    token = request.POST['stripeToken']
    
    # Create a Customer:
    customer = stripe.Customer.create(
      email="paying.user@example.com",
      source=token,
    )
    # YOUR CODE: Save the customer ID and other info in a database for later.
    
    // 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");
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    $token = $_POST['stripeToken'];
    
    // Create a Customer:
    $customer = \Stripe\Customer::create(array(
      "email" => "paying.user@example.com",
      "source" => $token,
    ));
    // YOUR CODE: Save the customer ID and other info in a database for later.
    
    // 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";
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    String token = request.getParameter("stripeToken");
    
    // Create a Customer:
    Map<String, Object> customerParams = new HashMap<String, Object>();
    customerParams.put("email", "paying.user@example.com");
    customerParams.put("source", token);
    Customer customer = Customer.create(customerParams);
    // YOUR CODE: Save the customer ID and other info in a database for later.
    
    // 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");
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    var token = request.body.stripeToken; // Using Express
    
    // Create a Customer:
    stripe.customers.create({
      email: "paying.user@example.com",
      source: token,
    }).then(function(customer) {
      // YOUR CODE: Save the customer ID and other info in a database for later.
    });
    
    // 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"
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    token := r.FormValue("stripeToken")
    
    // Create a Customer:
    customerParams := &stripe.CustomerParams{
      Email: "paying.user@example.com",
    }
    customerParams.SetSource(token)
    customer, err := customer.New(customerParams)
    // YOUR CODE: Save the customer ID and other info in a database for later.
    

    Step 2: Making tokens

    When you’re ready to create a charge on a connected account using a customer saved on your platform account, create a new token for that purpose. You’ll need:

    • The Stripe account ID—something like acct_ze10XvLq4OvdjYab—of the connected account for whom you’re making the charge
    • The customer ID—something like cus_Dq8YnnQOaDneNp—of the customer (in your platform account) being charged
    • The card or bank account ID for that customer, if you want to charge a specific card or bank account rather than the default
    curl https://api.stripe.com/v1/tokens \
       -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
       -d customer=cus_IHC9bM4rxji2gQ \
       -H "Stripe-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"
    
    token = Stripe::Token.create({
      :customer => "cus_Sqy8Kcqa4NRelZ",
    }, {:stripe_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"
    
    token = stripe.Token.create(
      customer="cus_JlBX0GancGq54P",
      stripe_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");
    
    $token = \Stripe\Token::create(array(
      "customer" => "cus_BEvRycdvwDj0hJ",
    ), array("stripe_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("customer", "cus_q2iGFE2dm2jtN2");
    
    RequestOptions requestOptions = RequestOptions.builder().setStripeAccount("{CONNECTED_STRIPE_ACCOUNT_ID}").build();
    
    Token token = Token.create(params, requestOptions);
    
    // 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.tokens.create({
      customer: "cus_w8m2LjN9eVFgse",
    }, {
      stripe_account: "{CONNECTED_STRIPE_ACCOUNT_ID}",
    }).then(function(token) {
      // 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.TokenParams{
      Customer: "cus_3VXJCT34lri3pr",
      StripeAccount: "{CONNECTED_STRIPE_ACCOUNT_ID}",
    }
    token, err := token.New(params)
    

    Step 3: Creating charges

    Like a regular token created by Stripe.js or Checkout, the above API call returns a token that acts as a credit card number. You can use the token to create a one-time charge as shown below or even save the customer to the connected account. If you save the customer to the connected account, you can also create a subscription for them (to a plan defined on the connected account).

    curl https://api.stripe.com/v1/charges \
       -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
       -d amount=1000 \
       -d currency=usd \
       -d source=tok_3ymDpdMZMVZfnifAMCOokeck \
       -H "Stripe-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 => token.id,
    }, :stripe_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=token.id,
      stripe_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" => $token->id,
    ), array("stripe_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", token.id);
    
    RequestOptions requestOptions = RequestOptions.builder().setStripeAccount({CONNECTED_STRIPE_ACCOUNT_ID}).build();
    Charge charge = Charge.create(params, requestOptions);
    
    // 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: token.id,
    }, {
      stripe_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",
      StripeAccount: "{CONNECTED_STRIPE_ACCOUNT_ID}",
    }
    params.SetSource(token.id)
    
    charge, err := charge.New(params)
    

    Further reading

    Discover what other Connect functionality is available!