Creating subscriptions with Connect

With Connect, you can create subscriptions for connected accounts, optionally taking fees in the process.

Through Connect, business models such as marketplaces and software platforms can use Stripe Billing to support recurring subscriptions. For example:

  • In addition to powering payments, software platforms can also create subscriptions for their end users.
  • Marketplaces may support subscription membership in addition to one time purchases.

You can create subscriptions for connected accounts, which supports several approaches for collecting payments. Subscriptions can be created directly on the connected account using direct charges, or on the platform with transfers to the connected account using destination charges. You can also take an application fee percentage on those subscription payments.

Restrictions

Using subscriptions with Connect has these restrictions:

  • Your platform can’t update or cancel a subscription that it did not create.
  • Your platform can’t add an application_fee to an invoice that it didn’t create, nor to an invoice that contains invoice items the platform didn’t create.

Creating a subscription using direct charges

To create a subscription that directly charges on a connected account, make a create subscription call while authenticated as the connected account. For this to work, both the customer and the price must be defined on the connected account.

For an end-to-end example of how to implement a subscription signup and payment flow in your application, see the fixed-price guide.

curl https://api.stripe.com/v1/subscriptions \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_4fdAW5ftNQow1a \ -d "items[0][price]"=price_H1y51TElsOZjG \ -d "expand[]"="latest_invoice.payment_intent" \ -H "Stripe-Account: {{CONNECTED_STRIPE_ACCOUNT_ID}}"
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' subscription = Stripe::Subscription.create({ customer: "cus_4fdAW5ftNQow1a", items: [ { price: "price_H1y51TElsOZjG" } ], expand: ["latest_invoice.payment_intent"], }, stripe_account: "{{CONNECTED_STRIPE_ACCOUNT_ID}}")
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' subscription = stripe.Subscription.create( customer="cus_4fdAW5ftNQow1a", items=[ { "price": "price_H1y51TElsOZjG", }, ], expand=["latest_invoice.payment_intent"], stripe_account="{{CONNECTED_STRIPE_ACCOUNT_ID}}", )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $subscription = \Stripe\Subscription::create([ "customer" => "cus_4fdAW5ftNQow1a", "items" => [ ["price" => "price_H1y51TElsOZjG"], ], "expand" => ["latest_invoice.payment_intent"], ], ["stripe_account" => "{{CONNECTED_STRIPE_ACCOUNT_ID}}"]);
// Set your secret key. Remember to switch 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> item = new HashMap<>(); item.put("price", "price_H1y51TElsOZjG"); Map<String, Object> items = new HashMap<>(); items.put("0", item); List<String> expandList = new ArrayList<>(); expandList.add("latest_invoice.payment_intent"); Map<String, Object> params = new HashMap<>(); params.put("customer", "cus_4fdAW5ftNQow1a"); params.put("items", items); params.put("expand", expandList); RequestOptions requestOptions = RequestOptions.builder().setStripeAccount({{CONNECTED_STRIPE_ACCOUNT_ID}}).build(); Subscription subscription = Subscription.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const subscription = await stripe.subscriptions.create({ customer: "cus_4fdAW5ftNQow1a", items: [ { price: "price_H1y51TElsOZjG", }, ], expand: ["latest_invoice.payment_intent"], }, { stripe_account: "{{CONNECTED_STRIPE_ACCOUNT_ID}}", });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.SubscriptionParams{ Customer: stripe.String("cus_4fdAW5ftNQow1a"), Items: []*stripe.SubscriptionItemsParams{ { price: stripe.String("price_H1y51TElsOZjG"), }, }, } params.AddExpand("latest_invoice.payment_intent") params.SetStripeAccount("{{CONNECTED_STRIPE_ACCOUNT_ID}}") subscription, _ := sub.New(params)
// Set your secret key. Remember to switch 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 SubscriptionCreateOptions { Customer = "cus_4fdAW5ftNQow1a", Items = new List<SubscriptionItemOptions> { new SubscriptionItemOptions { Price = "price_H1y51TElsOZjG", }, }, }; options.AddExpand("latest_invoice.payment_intent"); var requestOptions = new RequestOptions(); requestOptions.StripeAccount = "{{CONNECTED_ACCOUNT_ID}}"; var service = new SubscriptionService(); var subscription = service.Create(options, requestOptions);

As with creating a direct charge on a connected account, you can create a customer on a connected account using either the platform’s publishable key or the connected account’s publishable key. You can also create a token using shared customers. When using direct charges, the connected account is responsible for the cost of the Stripe fees, refunds, and chargebacks.

Creating a subscription using destination charges

To create a subscription that charges on the platform and creates automatic transfers to a connected account, make a create subscription call while providing the connected account ID as the transfer_data[destination] value.

curl https://api.stripe.com/v1/subscriptions \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_4fdAW5ftNQow1a \ -d "items[0][price]"=price_H1y51TElsOZjG \ -d "expand[]"="latest_invoice.payment_intent" \ -d "transfer_data[destination]"="{{CONNECTED_STRIPE_ACCOUNT_ID}}"
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' subscription = Stripe::Subscription.create({ customer: "cus_4fdAW5ftNQow1a", items: [ { price: "price_H1y51TElsOZjG" } ], expand: ["latest_invoice.payment_intent"], transfer_data: { destination: "{{CONNECTED_STRIPE_ACCOUNT_ID}}", } })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' subscription = stripe.Subscription.create( customer="cus_4fdAW5ftNQow1a", items=[ { "price": "price_H1y51TElsOZjG", }, ], expand=["latest_invoice.payment_intent"], transfer_data={ "destination": "{{CONNECTED_STRIPE_ACCOUNT_ID}}", }, )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $subscription = \Stripe\Subscription::create([ "customer" => "cus_4fdAW5ftNQow1a", "items" => [ ["price" => "price_H1y51TElsOZjG"], ], "expand" => ["latest_invoice.payment_intent"], "transfer_data" => [ "destination" => "{{CONNECTED_STRIPE_ACCOUNT_ID}}", ], ]);
// Set your secret key. Remember to switch 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> item = new HashMap<>(); item.put("price", "price_H1y51TElsOZjG"); Map<String, Object> items = new HashMap<>(); items.put("0", item); List<String> expandList = new ArrayList<>(); expandList.add("latest_invoice.payment_intent"); Map<String, Object> params = new HashMap<>(); params.put("customer", "cus_4fdAW5ftNQow1a"); params.put("items", items); params.put("expand", expandList); Map<String, Object> transferDataParams = new HashMap<>(); transferDataParams.put("destination", "{{CONNECTED_STRIPE_ACCOUNT_ID}}"); params.put("transfer_data", transferDataParams); Subscription subscription = Subscription.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const subscription = await stripe.subscriptions.create({ customer: "cus_4fdAW5ftNQow1a", items: [ { price: "price_H1y51TElsOZjG", }, ], expand: ["latest_invoice.payment_intent"], transfer_data: { destination: "{{CONNECTED_STRIPE_ACCOUNT_ID}}", }, });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.SubscriptionParams{ Customer: stripe.String("cus_4fdAW5ftNQow1a"), Items: []*stripe.SubscriptionItemsParams{ { price: stripe.String("price_H1y51TElsOZjG"), }, }, TransferData: &stripe.InvoiceTransferDataParams{ Destination: stripe.String("{{CONNECTED_STRIPE_ACCOUNT_ID}}"), }, } params.AddExpand("latest_invoice.payment_intent") subscription, _ := sub.New(params)
// Set your secret key. Remember to switch 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 SubscriptionCreateOptions { Customer = "cus_4fdAW5ftNQow1a", Items = new List<SubscriptionItemOptions> { new SubscriptionItemOptions { Price = "price_H1y51TElsOZjG", }, }, TransferData = new SubscriptionTransferDataOptions { Destination = "{{CONNECTED_STRIPE_ACCOUNT_ID}}", }, }; options.AddExpand("latest_invoice.payment_intent"); var service = new SubscriptionService(); var subscription = service.Create(options);

For this to work, both the customer and the price must be defined on the platform account, and the connected account token must be created using the platform’s publishable key. If charging a customer, the customer must exist within the platform account. When using automatic transfers, the platform is the business of record.

Collecting fees on subscriptions

When creating or updating a subscription, you can optionally specify an application_fee_percent. This must be a non-negative decimal between 0 and 100, with at most two decimal places.

Once each billing period, Stripe takes this percentage of the final invoice amount—including any bundled invoice items, discounts, or account balance adjustments—as a fee for the platform. This deduction is made before charging any Stripe fees.

This example shows application_fee_percent for subscriptions that use direct charges on connected accounts:

curl https://api.stripe.com/v1/subscriptions \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_4fdAW5ftNQow1a \ -d "items[0][price]"=price_H1y51TElsOZjG \ -d "expand[]"="latest_invoice.payment_intent" \ -d application_fee_percent=10 \ -H "Stripe-Account: {{CONNECTED_STRIPE_ACCOUNT_ID}}"
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' subscription = Stripe::Subscription.create({ customer: "cus_4fdAW5ftNQow1a", items: [ { price: "price_H1y51TElsOZjG" } ], expand: ["latest_invoice.payment_intent"], application_fee_percent: 10, }, stripe_account: "{{CONNECTED_STRIPE_ACCOUNT_ID}}")
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' subscription = stripe.Subscription.create( customer="cus_4fdAW5ftNQow1a", items=[ { "price": "price_H1y51TElsOZjG", }, ], expand=["latest_invoice.payment_intent"], application_fee_percent=10, stripe_account="{{CONNECTED_STRIPE_ACCOUNT_ID}}", )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $subscription = \Stripe\Subscription::create([ "customer" => "cus_4fdAW5ftNQow1a", "items" => [ ["price" => "price_H1y51TElsOZjG"], ], "expand" => ["latest_invoice.payment_intent"], "application_fee_percent" => 10, ], ["stripe_account" => "{{CONNECTED_STRIPE_ACCOUNT_ID}}"]);
// Set your secret key. Remember to switch 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> item = new HashMap<>(); item.put("price", "price_H1y51TElsOZjG"); Map<String, Object> items = new HashMap<>(); items.put("0", item); List<String> expandList = new ArrayList<>(); expandList.add("latest_invoice.payment_intent"); Map<String, Object> params = new HashMap<>(); params.put("customer", "cus_4fdAW5ftNQow1a"); params.put("items", items); params.put("expand", expandList); params.put("application_fee_percent", 10); RequestOptions requestOptions = RequestOptions.builder().setStripeAccount({{CONNECTED_STRIPE_ACCOUNT_ID}}).build(); Subscription subscription = Subscription.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const subscription = await stripe.subscriptions.create({ customer: "cus_4fdAW5ftNQow1a", items: [ { price: "price_H1y51TElsOZjG", }, ], expand: ["latest_invoice.payment_intent"], application_fee_percent: 10, }, { stripe_account: "{{CONNECTED_STRIPE_ACCOUNT_ID}}", });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.SubscriptionParams{ Customer: stripe.String("cus_4fdAW5ftNQow1a"), Items: []*stripe.SubscriptionItemsParams{ { price: stripe.String("price_H1y51TElsOZjG"), }, }, ApplicationFeePercent: stripe.Int64(10), } params.AddExpand("latest_invoice.payment_intent") params.SetStripeAccount("{{CONNECTED_STRIPE_ACCOUNT_ID}}") subscription, _ := sub.New(params)
// Set your secret key. Remember to switch 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 SubscriptionCreateOptions { Customer = "cus_4fdAW5ftNQow1a", Items = new List<SubscriptionItemOptions> { new SubscriptionItemOptions { Price = "price_H1y51TElsOZjG", }, }, ApplicationFeePercent = 10.0m, }; options.AddExpand("latest_invoice.payment_intent"); var requestOptions = new RequestOptions(); requestOptions.StripeAccount = "{{CONNECTED_ACCOUNT_ID}}"; var service = new SubscriptionService(); var subscription = service.Create(options, requestOptions);

This example shows application_fee_percent for subscriptions that use destination charges:

curl https://api.stripe.com/v1/subscriptions \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_4fdAW5ftNQow1a \ -d "items[0][price]"=price_H1y51TElsOZjG \ -d "expand[]"="latest_invoice.payment_intent" \ -d application_fee_percent=10 \ -d "transfer_data[destination]"="{{CONNECTED_STRIPE_ACCOUNT_ID}}"
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' subscription = Stripe::Subscription.create({ customer: "cus_4fdAW5ftNQow1a", items: [ { price: "price_H1y51TElsOZjG" } ], expand: ["latest_invoice.payment_intent"], application_fee_percent: 10, transfer_data: { destination: "{{CONNECTED_STRIPE_ACCOUNT_ID}}", } })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' subscription = stripe.Subscription.create( customer="cus_4fdAW5ftNQow1a", items=[ { "price": "price_H1y51TElsOZjG", }, ], expand=["latest_invoice.payment_intent"], application_fee_percent=10, transfer_data={ "destination": "{{CONNECTED_STRIPE_ACCOUNT_ID}}", }, )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $subscription = \Stripe\Subscription::create([ "customer" => "cus_4fdAW5ftNQow1a", "items" => [ ["price" => "price_H1y51TElsOZjG"], ], "expand" => ["latest_invoice.payment_intent"], "application_fee_percent" => 10, "transfer_data" => [ "destination" => "{{CONNECTED_STRIPE_ACCOUNT_ID}}", ], ]);
// Set your secret key. Remember to switch 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> item = new HashMap<>(); item.put("price", "price_H1y51TElsOZjG"); Map<String, Object> items = new HashMap<>(); items.put("0", item); List<String> expandList = new ArrayList<>(); expandList.add("latest_invoice.payment_intent"); Map<String, Object> params = new HashMap<>(); params.put("customer", "cus_4fdAW5ftNQow1a"); params.put("items", items); params.put("expand", expandList); params.put("application_fee_percent", 10); Map<String, Object> transferDataParams = new HashMap<>(); transferDataParams.put("destination", "{{CONNECTED_STRIPE_ACCOUNT_ID}}"); params.put("transfer_data", transferDataParams); Subscription subscription = Subscription.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const subscription = await stripe.subscriptions.create({ customer: "cus_4fdAW5ftNQow1a", items: [ { price: "price_H1y51TElsOZjG", }, ], expand: ["latest_invoice.payment_intent"], application_fee_percent: 10, transfer_data: { destination: "{{CONNECTED_STRIPE_ACCOUNT_ID}}", }, });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.SubscriptionParams{ Customer: stripe.String("cus_4fdAW5ftNQow1a"), Items: []*stripe.SubscriptionItemsParams{ { price: stripe.String("price_H1y51TElsOZjG"), }, }, ApplicationFeePercent: stripe.Int64(10), TransferData: &stripe.InvoiceTransferDataParams{ Destination: stripe.String("{{CONNECTED_STRIPE_ACCOUNT_ID}}"), }, } params.AddExpand("latest_invoice.payment_intent") subscription, _ := sub.New(params)
// Set your secret key. Remember to switch 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 SubscriptionCreateOptions { Customer = "cus_4fdAW5ftNQow1a", Items = new List<SubscriptionItemOptions> { new SubscriptionItemOptions { Price = "price_H1y51TElsOZjG", }, }, ApplicationFeePercent = 10.0m, TransferData = new SubscriptionTransferDataOptions { Destination = "{{CONNECTED_STRIPE_ACCOUNT_ID}}", }, }; options.AddExpand("latest_invoice.payment_intent"); var service = new SubscriptionService(); var subscription = service.Create(options);

Calculating application fee percent

To see how application_fee_percent is calculated, consider this scenario:

  • A subscription costs 30 USD per billing cycle.
  • There’s a 10 USD invoice item on the next invoice.
  • A 50% coupon applies.
  • The application_fee_percent is 10.

In this case, the total application fee is 2 USD: (30 USD + 10 USD) * 50% * 10%.

Percent fees and flat fees

Application fees on subscriptions must normally be a percentage, because the amount billed with subscriptions often varies. You cannot set a subscription’s recurring application fee as a flat amount.

However, you can charge a flat application_fee_amount on an invoice, as explained in the next section. Also, the application_fee_percent parameter does not apply to invoices created outside of a subscription billing period. For example, it does not apply to proration invoice items that are immediately invoiced. In these cases, you should directly set an application_fee_amount on the invoice for the amount you’d like to charge.

Working with invoices created by subscriptions

Each cycle, subscriptions create invoices and invoices create charges. For more information about subcsription cycles, see the subscription lifecycle. To charge a flat or dynamic fee that can’t be automatically calculated with application_fee_percent, add an application_fee_amount directly on each invoice created by the subscription.

This example shows an application_fee_amount for an invoice with a direct charge on the connected account:

curl https://api.stripe.com/v1/invoices/{INVOICE_ID} \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d application_fee_amount=100 \ -H "Stripe-Account: {{CONNECTED_STRIPE_ACCOUNT_ID}}"
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' invoice = Stripe::Invoice.update( {INVOICE_ID}, {application_fee_amount: 100}, stripe_account: '{{CONNECTED_STRIPE_ACCOUNT_ID}}', )
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' invoice = stripe.Invoice.modify( {INVOICE_ID}, application_fee_amount=100, stripe_account="{{CONNECTED_STRIPE_ACCOUNT_ID}}", )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $invoice = StripeInvoice::update( {INVOICE_ID}, ['application_fee_amount' => 100], ["stripe_account" => "{{CONNECTED_STRIPE_ACCOUNT_ID}}"], );
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; RequestOptions requestOptions = RequestOptions.builder().setStripeAccount({{CONNECTED_STRIPE_ACCOUNT_ID}}).build(); Invoice invoice = Invoice.retrieve({INVOICE_ID}, requestOptions); Map<String, Object> invoiceParams = new HashMap<>(); invoiceParams.put("application_fee_amount", 100); invoice.update(invoiceParams, requestOptions);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const invoice = await stripe.invoices.update( {INVOICE_ID}, {application_fee_amount: 100}, {stripe_account: "{{CONNECTED_STRIPE_ACCOUNT_ID}}" },
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.InvoiceParams{ ApplicationFeeAmount: stripe.Int64(100), } params.SetStripeAccount("{{CONNECTED_STRIPE_ACCOUNT_ID}}") in, _ := invoice.Update({INVOICE_ID}, params)
// Set your secret key. Remember to switch 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 InvoiceUpdateOptions { ApplicationFeeAmount = 100, }; var requestOptions = new RequestOptions(); requestOptions.StripeAccount = "{{CONNECTED_STRIPE_ACCOUNT_ID}}"; var service = new InvoiceService(); var invoice = service.Update("{INVOICE_ID}", options, requestOptions);

This example shows an application_fee_amount for an invoice with a destination charge:

curl https://api.stripe.com/v1/invoices/{INVOICE_ID} \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d application_fee_amount=100 \ -d "transfer_data[destination]"="{{CONNECTED_STRIPE_ACCOUNT_ID}}"
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' invoice = Stripe::Invoice.update( {INVOICE_ID}, { transfer_data: {destination: "{{CONNECTED_STRIPE_ACCOUNT_ID}}"}, application_fee_amount: 100, }, )
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' invoice = stripe.Invoice.modify( {INVOICE_ID}, transfer_data={"destination": "{{CONNECTED_STRIPE_ACCOUNT_ID}}"}, application_fee_amount=100, )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $invoice = StripeInvoice::update( {INVOICE_ID}, [ 'transfer_data' => ['destination' => '{{CONNECTED_STRIPE_ACCOUNT_ID}}'], 'application_fee_amount' => 100, ], );
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; Invoice invoice = Invoice.retrieve({INVOICE_ID}); Map<String, Object> invoiceParams = new HashMap<>(); Map<String, Object> transferDataParams = new HashMap<>(); transferDataParams.put("destination", "{{CONNECTED_STRIPE_ACCOUNT_ID}}"); invoiceParams.put("transfer_data", transferDataParams); invoiceParams.put("application_fee_amount", 100); invoice.update(invoiceParams)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const invoice = await stripe.invoices.update( {INVOICE_ID}, { application_fee_amount: 100, transfer_data: {destination: "{{CONNECTED_STRIPE_ACCOUNT_ID}}"}, },
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.InvoiceParams{ ApplicationFeeAmount: stripe.Int64(100), TransferData: &stripe.InvoiceTransferDataParams{ Destination: stripe.String("{{CONNECTED_STRIPE_ACCOUNT_ID}}"), }, } in, _ := invoice.Update({INVOICE_ID}, params)
// Set your secret key. Remember to switch 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 InvoiceUpdateOptions { ApplicationFeeAmount = 100, TransferData = new InvoiceTransferDataOptions { Destination = "{{CONNECTED_STRIPE_ACCOUNT_ID}}" } }; var service = new InvoiceService(); var invoice = service.Update("{INVOICE_ID}", options);

To automatically charge an application_fee_amount, create a webhook that listens for the invoice.created event. You can also do this manually by creating an invoice for pending invoice items, and setting an application fee on it.

The application_fee_amount set directly on an invoice overrides any application fee amount calculated with application_fee_percent, and is capped at the invoice’s final charge amount.

Using on_behalf_of

To make the connected account the business of record, you need to charge them using the on_behalf_of attribute which is in active development. If you are interested in this feature, please enter your information below.

You might have had an internet hiccup. Try again?

We'll be in touch soon. 

Further reading

Discover what other Connect functionality is available:

Was this page helpful?
Questions? Contact us.
Developer tutorials on YouTube.
You can unsubscribe at any time. Read our privacy policy.