Using Checkout with Connect
Learn how to create Connect direct and destination charges using Checkout.
Checkout supports creating Connect direct or destination charges involving connected Stripe accounts. Rather than creating charges yourself via the API, integrate Checkout with the server integration, and let Checkout create the charges for you.
Direct charges
To create direct charges on a connected account using Checkout, integrate using the server integration and specify the connected Stripe account’s ID. You may optionally specify an application fee to direct a portion of the payment to your platform.
The resulting Checkout page is branded using the business name, icon, logo, and color of the connected account.
Server-side code
curl https://api.stripe.com/v1/checkout/sessions \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d payment_method_types[]=card \
-d line_items[][name]="Cucumber from Roger's Farm" \
-d line_items[][amount]=200 \
-d line_items[][currency]=usd \
-d line_items[][quantity]=10 \
-d payment_intent_data[application_fee_amount]=200 \
-d success_url="https://example.com/success" \
-d cancel_url="https://example.com/cancel" \
-H "Stripe-Account: {{CONNECTED_STRIPE_ACCOUNT_ID}}"
session = Stripe::Checkout::Session.create({
payment_method_types: ['card'],
line_items: [{
name: "Cucumber from Roger's Farm",
amount: 200,
currency: 'usd',
quantity: 10,
}],
payment_intent_data: {
application_fee_amount: 200,
},
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
}, {
stripe_account: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
})
session = stripe.checkout.Session.create(
payment_method_types=['card'],
line_items=[{
name: "Cucumber from Roger's Farm",
amount: 200,
currency: 'usd',
quantity: 10,
}],
payment_intent_data={
application_fee_amount: 200,
},
success_url='https://example.com/success',
cancel_url='https://example.com/cancel',
stripe_account='{{CONNECTED_STRIPE_ACCOUNT_ID}}',
)
$session = \\Stripe\\Checkout\\Session::create([
'payment_method_types' => ['card'],
'line_items' => [[
'name' => "Cucumber from Roger's Farm",
'amount' => 200,
'currency' => 'usd',
'quantity' => 10,
]],
'payment_intent_data' => [
'application_fee_amount' => 200,
],
'success_url' => 'https://example.com/success',
'cancel_url' => 'https://example.com/cancel',
], [
'stripe_account' => '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
]);
Map<String, Object> params = new HashMap<String, Object>();
ArrayList<String> paymentMethodTypes = new ArrayList<>();
paymentMethodTypes.add("card");
params.put("payment_method_types", paymentMethodTypes);
ArrayList<HashMap<String, Object>> lineItems = new ArrayList<>();
HashMap<String, Object> lineItem = new HashMap<String, Object>();
lineItem.put("name", "Cucumber from Roger's Farm");
lineItem.put("amount", 200);
lineItem.put("currency", "usd");
lineItem.put("quantity", 10);
lineItems.add(lineItem);
params.put("line_items", lineItems);
HashMap<String, Object> paymentIntentData = new HashMap<String, Object>();
paymentIntentData.put("application_fee_amount", 200);
params.put("payment_intent_data", paymentIntentData);
params.put("success_url", "https://example.com/success");
params.put("cancel_url", "https://example.com/cancel");
RequestOptions requestOptions = RequestOptions.builder().setStripeAccount({{CONNECTED_STRIPE_ACCOUNT_ID}}).build();
Session session = Session.create(params, requestOptions);
(async () => {
const session = await stripe.checkout.sessions.create({
payment_method_types: ['card'],
line_items: [{
name: "Cucumber from Roger's Farm",
amount: 200,
currency: 'usd',
quantity: 10,
}],
payment_intent_data: {
application_fee_amount: 200,
},
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
}, {
stripe_account: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
});
})();
params := &stripe.CheckoutSessionParams{
PaymentMethodTypes: stripe.StringSlice([]string{
"card",
}),
LineItems: []*stripe.CheckoutSessionLineItemParams{
&stripe.CheckoutSessionLineItemParams{
Name: stripe.String("Cucumber from Roger's Farm"),
Amount: stripe.Int64(200),
Currency: stripe.String(string(stripe.CurrencyUSD)),
Quantity: stripe.Int64(10),
},
},
PaymentIntentData: &stripe.CheckoutSessionPaymentIntentDataParams{
ApplicationFeeAmount: stripe.Int64(200),
},
SuccessURL: stripe.String("https://example.com/success"),
CancelURL: stripe.String("https://example.com/cancel"),
}
params.SetStripeAccount("{{CONNECTED_STRIPE_ACCOUNT_ID}}")
session, err := session.New(params)
var options = new SessionCreateOptions {
PaymentMethodTypes = new List<string> {
"card",
},
LineItems = new List<SessionLineItemOptions> {
new SessionLineItemOptions {
Name = "Cucumber from Roger's Farm",
Amount = 200,
Currency = "usd",
Quantity = 10,
},
},
PaymentIntentData = new SessionPaymentIntentDataOptions {
ApplicationFeeAmount = 200,
},
SuccessUrl = "https://example.com/success",
CancelUrl = "https://example.com/cancel",
};
var requestOptions = new RequestOptions {
StripeConnectAccountId = "{{CONNECTED_STRIPE_ACCOUNT_ID}}",
}
var service = new SessionService();
Session session = service.Create(options, requestOptions);
Client-side code
// Initialize Stripe.js with the same connected account ID used when creating
// the Checkout Session.
var stripe = Stripe('pk_test_TYooMQauvdEDq54NiTphI7jx', {
stripeAccount: '{{CONNECTED_STRIPE_ACCOUNT_ID}}'
});
stripe.redirectToCheckout({
// Make the id field from the Checkout Session creation API response
// available to this file, so you can provide it as parameter here
// instead of the {{CHECKOUT_SESSION_ID}} placeholder.
sessionId: '{{CHECKOUT_SESSION_ID}}'
}).then(function (result) {
// If `redirectToCheckout` fails due to a browser or network
// error, display the localized error message to your customer
// using `result.error.message`.
});
// Initialize Stripe.js with the same connected account ID used when creating
// the Checkout Session.
const stripe = Stripe('pk_test_TYooMQauvdEDq54NiTphI7jx', {
stripeAccount: '{{CONNECTED_STRIPE_ACCOUNT_ID}}'
});
stripe.redirectToCheckout({
// Make the id field from the Checkout Session creation API response
// available to this file, so you can provide it as parameter here
// instead of the {{CHECKOUT_SESSION_ID}} placeholder.
sessionId: '{{CHECKOUT_SESSION_ID}}'
}).then((result) => {
// If `redirectToCheckout` fails due to a browser or network
// error, display the localized error message to your customer
// using `result.error.message`.
});
Destination charges
To create destination charges on a
connected account using Checkout, integrate using the server
integration and specify the connected Stripe
account’s ID as a transfer destination, or with
payment_intent_data.on_behalf_of
. You may optionally specify an application
fee to direct a portion of the
payment to your platform.
If a transfer destination is specified, Checkout is branded using the business
name, icon, logo, and color of the platform Stripe account. If
payment_intent_data.on_behalf_of
is specified instead, Checkout is branded
using the connected account’s configuration.
Server-side code
With destination
curl https://api.stripe.com/v1/checkout/sessions \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d payment_method_types[]=card \
-d line_items[][name]="Cucumber from Roger's Farm" \
-d line_items[][amount]=200 \
-d line_items[][currency]=usd \
-d line_items[][quantity]=10 \
-d payment_intent_data[application_fee_amount]=200 \
-d payment_intent_data[transfer_data][destination]="{{CONNECTED_STRIPE_ACCOUNT_ID}}" \
-d success_url="https://example.com/success" \
-d cancel_url="https://example.com/cancel"
session = Stripe::Checkout::Session.create({
payment_method_types: ['card'],
line_items: [{
name: "Cucumber from Roger's Farm",
amount: 200,
currency: 'usd',
quantity: 10,
}],
payment_intent_data: {
application_fee_amount: 200,
transfer_data: {
destination: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
},
},
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
})
session = stripe.checkout.Session.create(
payment_method_types=['card'],
line_items=[{
name: "Cucumber from Roger's Farm",
amount: 200,
currency: 'usd',
quantity: 10,
}],
payment_intent_data={
application_fee_amount: 200,
transfer_data: {
destination: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
},
},
success_url='https://example.com/success',
cancel_url='https://example.com/cancel',
)
$session = \\Stripe\\Checkout\\Session::create([
'payment_method_types' => ['card'],
'line_items' => [[
'name' => "Cucumber from Roger's Farm",
'amount' => 200,
'currency' => 'usd',
'quantity' => 10,
]],
'payment_intent_data' => [
'application_fee_amount' => 200,
'transfer_data' => [
'destination' => '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
],
],
'success_url' => 'https://example.com/success',
'cancel_url' => 'https://example.com/cancel',
]);
Map<String, Object> params = new HashMap<String, Object>();
ArrayList<String> paymentMethodTypes = new ArrayList<>();
paymentMethodTypes.add("card");
params.put("payment_method_types", paymentMethodTypes);
ArrayList<HashMap<String, Object>> lineItems = new ArrayList<>();
HashMap<String, Object> lineItem = new HashMap<String, Object>();
lineItem.put("name", "Cucumber from Roger's Farm");
lineItem.put("amount", 200);
lineItem.put("currency", "usd");
lineItem.put("quantity", 10);
lineItems.add(lineItem);
params.put("line_items", lineItems);
HashMap<String, Object> paymentIntentData = new HashMap<String, Object>();
paymentIntentData.put("application_fee_amount", 200);
HashMap<String, Object> transferData = new HashMap<String, Object>();
transferData.put("destination", "{{CONNECTED_STRIPE_ACCOUNT_ID}}");
paymentIntentData.put("transfer_data", transferData);
params.put("payment_intent_data", paymentIntentData);
params.put("success_url", "https://example.com/success");
params.put("cancel_url", "https://example.com/cancel");
Session session = Session.create(params, requestOptions);
(async () => {
const session = await stripe.checkout.sessions.create({
payment_method_types: ['card'],
line_items: [{
name: "Cucumber from Roger's Farm",
amount: 200,
currency: 'usd',
quantity: 10,
}],
payment_intent_data: {
application_fee_amount: 200,
transfer_data: {
destination: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
},
},
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
});
})();
params := &stripe.CheckoutSessionParams{
PaymentMethodTypes: stripe.StringSlice([]string{
"card",
}),
LineItems: []*stripe.CheckoutSessionLineItemParams{
&stripe.CheckoutSessionLineItemParams{
Name: stripe.String("Cucumber from Roger's Farm"),
Amount: stripe.Int64(200),
Currency: stripe.String(string(stripe.CurrencyUSD)),
Quantity: stripe.Int64(10),
},
},
PaymentIntentData: &stripe.CheckoutSessionPaymentIntentDataParams{
ApplicationFeeAmount: stripe.Int64(200),
TransferData: &stripe.CheckoutSessionPaymentIntentDataTransferDataParams{
Destination: stripe.String("{{CONNECTED_STRIPE_ACCOUNT_ID}}"),
},
},
SuccessURL: stripe.String("https://example.com/success"),
CancelURL: stripe.String("https://example.com/cancel"),
}
session, err := session.New(params)
var options = new SessionCreateOptions {
PaymentMethodTypes = new List<string> {
"card",
},
LineItems = new List<SessionLineItemOptions> {
new SessionLineItemOptions {
Name = "Cucumber from Roger's Farm",
Amount = 200,
Currency = "usd",
Quantity = 10,
},
},
PaymentIntentData = new SessionPaymentIntentDataOptions {
ApplicationFeeAmount = 200,
TransferData = new SessionPaymentIntentTransferDataOptions {
Destination = "{{CONNECTED_STRIPE_ACCOUNT_ID}}",
},
},
SuccessUrl = "https://example.com/success",
CancelUrl = "https://example.com/cancel",
};
var service = new SessionService();
Session session = service.Create(options);
With on_behalf_of
curl https://api.stripe.com/v1/checkout/sessions \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d payment_method_types[]=card \
-d line_items[][name]="Cucumber from Roger's Farm" \
-d line_items[][amount]=200 \
-d line_items[][currency]=usd \
-d line_items[][quantity]=10 \
-d payment_intent_data[application_fee_amount]=200 \
-d payment_intent_data[on_behalf_of]="{{CONNECTED_STRIPE_ACCOUNT_ID}}" \
-d payment_intent_data[transfer_data][destination]="{{CONNECTED_STRIPE_ACCOUNT_ID}}" \
-d success_url="https://example.com/success" \
-d cancel_url="https://example.com/cancel"
session = Stripe::Checkout::Session.create({
payment_method_types: ['card'],
line_items: [{
name: "Cucumber from Roger's Farm",
amount: 200,
currency: 'usd',
quantity: 10,
}],
payment_intent_data: {
application_fee_amount: 200,
on_behalf_of: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
transfer_data: {
destination: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
},
},
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
})
session = stripe.checkout.Session.create(
payment_method_types=['card'],
line_items=[{
name: "Cucumber from Roger's Farm",
amount: 200,
currency: 'usd',
quantity: 10,
}],
payment_intent_data={
application_fee_amount: 200,
on_behalf_of: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
transfer_data: {
destination: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
},
},
success_url='https://example.com/success',
cancel_url='https://example.com/cancel',
)
$session = \\Stripe\\Checkout\\Session::create([
'payment_method_types' => ['card'],
'line_items' => [[
'name' => "Cucumber from Roger's Farm",
'amount' => 200,
'currency' => 'usd',
'quantity' => 10,
]],
'payment_intent_data' => [
'application_fee_amount' => 200,
'on_behalf_of' => '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
'transfer_data' => [
'destination' => '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
],
],
'success_url' => 'https://example.com/success',
'cancel_url' => 'https://example.com/cancel',
]);
Map<String, Object> params = new HashMap<String, Object>();
ArrayList<String> paymentMethodTypes = new ArrayList<>();
paymentMethodTypes.add("card");
params.put("payment_method_types", paymentMethodTypes);
ArrayList<HashMap<String, Object>> lineItems = new ArrayList<>();
HashMap<String, Object> lineItem = new HashMap<String, Object>();
lineItem.put("name", "Cucumber from Roger's Farm");
lineItem.put("amount", 200);
lineItem.put("currency", "usd");
lineItem.put("quantity", 10);
lineItems.add(lineItem);
params.put("line_items", lineItems);
HashMap<String, Object> paymentIntentData = new HashMap<String, Object>();
paymentIntentData.put("application_fee_amount", 200);
paymentIntentData.put("on_behalf_of", "{{CONNECTED_STRIPE_ACCOUNT_ID}}");
HashMap<String, Object> transferData = new HashMap<String, Object>();
transferData.put("destination", "{{CONNECTED_STRIPE_ACCOUNT_ID}}");
paymentIntentData.put("transfer_data", transferData);
params.put("payment_intent_data", paymentIntentData);
params.put("success_url", "https://example.com/success");
params.put("cancel_url", "https://example.com/cancel");
Session session = Session.create(params, requestOptions);
(async () => {
const session = await stripe.checkout.sessions.create({
payment_method_types: ['card'],
line_items: [{
name: "Cucumber from Roger's Farm",
amount: 200,
currency: 'usd',
quantity: 10,
}],
payment_intent_data: {
application_fee_amount: 200,
on_behalf_of: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
transfer_data: {
destination: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
},
},
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
});
})();
params := &stripe.CheckoutSessionParams{
PaymentMethodTypes: stripe.StringSlice([]string{
"card",
}),
LineItems: []*stripe.CheckoutSessionLineItemParams{
&stripe.CheckoutSessionLineItemParams{
Name: stripe.String("Cucumber from Roger's Farm"),
Amount: stripe.Int64(200),
Currency: stripe.String(string(stripe.CurrencyUSD)),
Quantity: stripe.Int64(10),
},
},
PaymentIntentData: &stripe.CheckoutSessionPaymentIntentDataParams{
ApplicationFeeAmount: stripe.Int64(200),
OnBehalfOf: stripe.String("{{CONNECTED_STRIPE_ACCOUNT_ID}}"),
TransferData: &stripe.CheckoutSessionPaymentIntentDataTransferDataParams{
Destination: stripe.String("{{CONNECTED_STRIPE_ACCOUNT_ID}}"),
},
},
SuccessURL: stripe.String("https://example.com/success"),
CancelURL: stripe.String("https://example.com/cancel"),
}
session, err := session.New(params)
var options = new SessionCreateOptions {
PaymentMethodTypes = new List<string> {
"card",
},
LineItems = new List<SessionLineItemOptions> {
new SessionLineItemOptions {
Name = "Cucumber from Roger's Farm",
Amount = 200,
Currency = "usd",
Quantity = 10,
},
},
PaymentIntentData = new SessionPaymentIntentDataOptions {
ApplicationFeeAmount = 200,
OnBehalfOf = "{{CONNECTED_STRIPE_ACCOUNT_ID}}",
TransferData = new SessionPaymentIntentTransferDataOptions {
Destination = "{{CONNECTED_STRIPE_ACCOUNT_ID}}",
},
},
SuccessUrl = "https://example.com/success",
CancelUrl = "https://example.com/cancel",
};
var service = new SessionService();
Session session = service.Create(options);
Client-side code
// Initialize Stripe.js with the same connected account ID used when creating
// the Checkout Session.
var stripe = Stripe('pk_test_TYooMQauvdEDq54NiTphI7jx', {
stripeAccount: '{{CONNECTED_STRIPE_ACCOUNT_ID}}'
});
stripe.redirectToCheckout({
// Make the id field from the Checkout Session creation API response
// available to this file, so you can provide it as parameter here
// instead of the {{CHECKOUT_SESSION_ID}} placeholder.
sessionId: '{{CHECKOUT_SESSION_ID}}'
}).then(function (result) {
// If `redirectToCheckout` fails due to a browser or network
// error, display the localized error message to your customer
// using `result.error.message`.
});
// Initialize Stripe.js with the same connected account ID used when creating
// the Checkout Session.
const stripe = Stripe('pk_test_TYooMQauvdEDq54NiTphI7jx', {
stripeAccount: '{{CONNECTED_STRIPE_ACCOUNT_ID}}'
});
stripe.redirectToCheckout({
// Make the id field from the Checkout Session creation API response
// available to this file, so you can provide it as parameter here
// instead of the {{CHECKOUT_SESSION_ID}} placeholder.
sessionId: '{{CHECKOUT_SESSION_ID}}'
}).then((result) => {
// If `redirectToCheckout` fails due to a browser or network
// error, display the localized error message to your customer
// using `result.error.message`.
});
Branding
Platforms and Standard Connect accounts control their own branding via the Branding settings in the Dashboard. Platforms may configure the branding settings for Express and Custom accounts via the Accounts API.
The account update API accepts the following parameters for branding:
icon
is displayed alongside the business name in the header of the Checkout page.- If specified,
logo
is displayed instead of the icon and business name in the header of the Checkout page. primary_color
is used as the accent color of various UI elements on the Checkout page.
curl https://api.stripe.com/v1/accounts/{{CONNECTED_STRIPE_ACCOUNT_ID}} \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d settings[branding][icon]=file_123 \
-d settings[branding][logo]=file_456 \
-d settings[branding][primary_color]="#663399"
Stripe::Account.update(
'{{CONNECTED_STRIPE_ACCOUNT_ID}}',
{
settings: {
branding: {
icon: 'file_123',
logo: 'file_456',
primary_color: '#663399',
},
},
},
)
stripe.Account.modify(
'{{CONNECTED_STRIPE_ACCOUNT_ID}}',
settings={
branding: {
icon: 'file_123',
logo: 'file_456',
primary_color: '#663399',
},
},
)
\\Stripe\\Account::update(
'{{CONNECTED_STRIPE_ACCOUNT_ID}}',
[
'settings' => [
'branding' => [
'icon' => 'file_123',
'logo' => 'file_456',
'primary_color' => '#663399',
],
],
],
)
Account account = Account.retrieve('{{CONNECTED_STRIPE_ACCOUNT_ID}}');
HashMap<String, Object> params = new HashMap<String, Object>();
HashMap<String, Object> settings = new HashMap<String, Object>();
HashMap<String, Object> branding = new HashMap<String, Object>();
branding.put("icon", "file_123");
branding.put("logo", "file_456");
branding.put("primary_color", "#663399");
settings.put("branding", branding);
params.put("settings", settings);
account.update(params);
stripe.accounts.update(
'{{CONNECTED_STRIPE_ACCOUNT_ID}}',
{
settings: {
branding: {
icon: 'file_123',
logo: 'file_456',
primary_color: '#663399',
},
},
},
)
params := &stripe.AccountParams{
Settings: &stripe.AccountSettingsParams{
Branding: &stripe.AccountSettingsBrandingParams{
Icon: stripe.String("file_123"),
Logo: stripe.String("file_456"),
PrimaryColor: stripe.String("#663399"),
},
},
}
account.Update("{{CONNECTED_STRIPE_ACCOUNT_ID}}", params)
var options = new AccountUpdateOptions {
Settings = new AccountUpdateSettingsOptions {
Branding = new AccountUpdateSettingsBrandingOptions {
IconFileId = "file_123",
LogoFileId = "file_456",
PrimaryColor = "#663399",
},
},
};
var accountService = new AccountService();
accountService.Update("{{CONNECTED_STRIPE_ACCOUNT_ID}}", options);