Charge on behalf of a connected account

    As a marketplace business using Stripe Connect, you can use the Payment Intents API to create charges on behalf of connected accounts.

    Stripe supports several approaches for creating charges on behalf of a connected account.

    One approach is a direct charge, in which the connected account is responsible for the cost of the Stripe fees, refunds, and chargebacks. To perform a direct charge with a PaymentIntent, supply the ID of the connected account while creating the PaymentIntent:

    curl https://api.stripe.com/v1/payment_intents \
      -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
      -d amount=1099 \
      -d currency=usd \
      -d "payment_method_types[]"=card \
      -H "Stripe-Account: {{CONNECTED_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'
    
    Stripe::PaymentIntent.create({
        amount: 1099,
        currency: 'usd',
        payment_method_types: ['card'],
    }, {
        stripe_account: '{{CONNECTED_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'
    
    stripe.PaymentIntent.create(
      amount=1099,
      currency='usd',
      payment_method_types=['card'],
      stripe_account='{{CONNECTED_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');
    
    \Stripe\PaymentIntent::create([
        'amount' => 1099,
        'currency' => 'usd',
        'payment_method_types' => ['card'],
    ], [
        'stripe_account' => '{{CONNECTED_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> paymentintentParams = new HashMap<String, Object>();
    paymentintentParams.put("amount", 1099);
    paymentintentParams.put("currency", "usd");
    ArrayList payment_method_types = new ArrayList();
    payment_method_types.add("card");
    paymentintentParams.put("payment_method_types", payment_method_types);
    
    RequestOptions requestOptions = RequestOptions.builder().setStripeAccount("{{CONNECTED_ACCOUNT_ID}}").build();
    
    PaymentIntent.create(paymentintentParams, 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
    const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
    
    (async () => {
      const paymentIntent = await stripe.paymentIntents.create({
        amount: 1099,
        currency: 'usd',
        payment_method_types: ['card']
      }, {
        stripe_account: '{{CONNECTED_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.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
    
    params := &stripe.PaymentIntentParams{
      Amount: stripe.Int64(1099),
      Currency: stripe.String(string(stripe.CurrencyUSD)),
      PaymentMethodTypes: stripe.StringSlice([]string{
        "card",
      }),
    }
    params.SetStripeAccount("{{CONNECTED_ACCOUNT_ID}}")
    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 options = new PaymentIntentCreateOptions
    {
        Amount = 1099,
        Currency = "usd",
        PaymentMethodTypes = new List<string> { "card" }
    };
    var requestOptions = new RequestOptions
    {
        StripeAccount = "{{CONNECTED_ACCOUNT_ID}}"
    }
    service.Create(options, requestOptions);
    

    Additionally, the Payment Intents API supports creating a transfer to a connected account automatically and setting a connected account as the business of record for the payment.

    The transfer_data[destination] is the ID of the connected account that should receive the transfer.

    The on_behalf_of parameter is the ID of the connected account to use as the business of record for the payment. When it is set, Stripe automatically:

    • Settles charges in the country of the specified account, thereby minimizing declines and avoiding currency conversions
    • Uses the fee structure for the connected account’s country
    • If the account is in a different country than the platform, the connected account’s address and phone number shows up on the customer’s credit card statement (as opposed to the platform’s)

    The transfer_group parameter is propagated to all charges created by the PaymentIntent, and it behaves identically.

    Finally, you may withhold an application fee by providing the application_fee_amount parameter:

    curl https://api.stripe.com/v1/payment_intents \
      -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
      -d amount=1099 \
      -d currency=usd \
      -d "payment_method_types[]"=card \
      -d application_fee_amount=200 \
      -d on_behalf_of="{{CONNECTED_ACCOUNT_ID}}" \
      -d "transfer_data[destination]"="{{CONNECTED_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'
    
    intent = Stripe::PaymentIntent.create({
        amount: 1099,
        currency: 'usd',
        payment_method_types: ['card'],
        application_fee_amount: 200,
        on_behalf_of: '{{CONNECTED_ACCOUNT_ID}}',
        transfer_data: {destination: '{{CONNECTED_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'
    
    stripe.PaymentIntent.create(
      amount=1099,
      currency='usd',
      application_fee_amount=200,
      payment_method_types=['card'],
      on_behalf_of='{{CONNECTED_ACCOUNT_ID}}',
      transfer_data={'destination': '{{CONNECTED_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');
    
    \Stripe\PaymentIntent::create([
        'amount' => 1099,
        'currency' => 'usd',
        'application_fee_amount' => 200,
        'payment_method_types' => ['card'],
        'on_behalf_of' => '{{CONNECTED_ACCOUNT_ID}}',
        'transfer_data' => [
            'destination' => '{{CONNECTED_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> paymentintentParams = new HashMap<String, Object>();
    paymentintentParams.put("amount", 1099);
    paymentintentParams.put("currency", "usd");
    ArrayList payment_method_types = new ArrayList();
    payment_method_types.add("card");
    paymentintentParams.put("payment_method_types", payment_method_types);
    paymentintentParams.put("on_behalf_of", "{{CONNECTED_ACCOUNT_ID}}");
    paymentintentParams.put("application_fee_amount", 200);
    
    Map<String, Object> transferDataParams = new HashMap<String, Object>();
    transferDataParams.put("destination", "{{CONNECTED_ACCOUNT_ID}}");
    
    paymentintentParams.put("transfer_data", transferDataParams);
    
    PaymentIntent.create(paymentintentParams);
    
    // 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');
    
    (async () => {
      const paymentIntent = await stripe.paymentIntents.create({
        amount: 1099,
        currency: 'usd',
        payment_method_types: ['card'],
        application_fee_amount: 200,
        on_behalf_of: '{{CONNECTED_ACCOUNT_ID}}',
        transfer_data: {
          destination: '{{CONNECTED_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.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
    
    transferData = &stripe.PaymentIntentTransferDataParams{
      Destination: stripe.String("{{CONNECTED_ACCOUNT_ID}}"),
    }
    
    params := &stripe.PaymentIntentParams{
      Amount: stripe.Int64(1099),
      Currency: stripe.String(string(stripe.CurrencyUSD)),
      PaymentMethodTypes: stripe.StringSlice([]string{
        "card",
      }),
      OnBehalfOf: stripe.String("{{CONNECTED_ACCOUNT_ID}}"),
      ApplicationFeeAmount: stripe.Int64(200),
      TransferData: transferData,
    }
    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 options = new PaymentIntentCreateOptions
    {
        Amount = 1099,
        Currency = "usd",
        PaymentMethodTypes = new List<string> { "card" },
        ApplicationFeeAmount = 200,
        OnBehalfOf = "{{CONNECTED_ACCOUNT_ID}}",
        TransferData = new PaymentIntentTransferDataOptions
        {
            Destination = "{{CONNECTED_ACCOUNT_ID}}",
        },
    };
    service.Create(options);
    

    Learn more about accepting marketplace payments in the Connect docs.

    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