Creating Direct Charges
With Connect, you can make charges directly on the connected account and take fees in the process.
Connect supports three approaches for processing charges on behalf of the connected account. When using Standard accounts, the recommended route is to create direct charges on the connected account. Using this approach, the connected account is responsible for the cost of the Stripe fees, refunds, and chargebacks.
For some users of Express and Custom accounts, it may also be preferable to create direct charges on the connected account. In that case, although the connected account is initially responsible for Stripe fees, refunds, and chargebacks, your platform account does have the ultimate responsibility to cover any losses.
Creating direct charges on the connected account is particularly appropriate for platforms that enable e-commerce for its users. An end customer is purchasing from an individual business, not the platform, and the business can easily see their own sales in their Stripe Dashboard.
To directly charge on the connected account, perform a standard create charge request using your platform’s secret key while authenticated as the connected account:
curl https://api.stripe.com/v1/charges \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d amount=1000 \
-d currency=usd \
-d source=tok_visa \
-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_4eC39HqLyjWDarjtT1zdp7dc"
charge = Stripe::Charge.create({
:amount => 1000,
:currency => "usd",
:source => "tok_visa",
}, :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_4eC39HqLyjWDarjtT1zdp7dc"
charge = stripe.Charge.create(
amount=1000,
currency="usd",
source="tok_visa",
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_4eC39HqLyjWDarjtT1zdp7dc");
$charge = \Stripe\Charge::create([
"amount" => 1000,
"currency" => "usd",
"source" => "tok_visa",
], ["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_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> params = new HashMap<String, Object>();
params.put("amount", 1000);
params.put("currency", "usd");
params.put("source", "tok_visa");
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_4eC39HqLyjWDarjtT1zdp7dc");
stripe.charges.create({
amount: 1000,
currency: "usd",
source: "tok_visa",
}, {
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_4eC39HqLyjWDarjtT1zdp7dc"
params := &stripe.ChargeParams{
Amount: stripe.Int64(1000),
Currency: stripe.String(string(stripe.CurrencyUSD)),
}
params.SetStripeAccount("{CONNECTED_STRIPE_ACCOUNT_ID}")
params.SetSource("tok_visa")
charge, err := charge.New(params)
The example uses a test token—tok_visa—but you could tokenize a test card using Stripe.js and Elements or Stripe Checkout instead.
When directly charging on the connected account, you can provide a token created using either your platform’s or the connected account’s publishable key. (You can also use a shared customer to create a token.)
Charges created directly on the connected account are only reported on that account; they aren’t shown in your platform’s Dashboard, exports, or other reporting, although you can always retrieve this information via the API.
Collecting application fees
With Connect, your platform can take an application fee on direct charges and subscriptions. To assess an application fee on a charge, pass an optional application_fee_amount
value as a positive integer:
curl https://api.stripe.com/v1/charges \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d amount=1000 \
-d currency=usd \
-d source=tok_visa \
-d application_fee_amount=123 \
-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_4eC39HqLyjWDarjtT1zdp7dc"
charge = Stripe::Charge.create({
:amount => 1000,
:currency => "usd",
:source => "tok_visa",
:application_fee_amount => 123,
}, :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_4eC39HqLyjWDarjtT1zdp7dc"
charge = stripe.Charge.create(
amount=1000,
currency="usd",
source="tok_visa",
application_fee_amount=123,
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_4eC39HqLyjWDarjtT1zdp7dc");
$charge = \Stripe\Charge::create([
"amount" => 1000,
"currency" => "usd",
"source" => "tok_visa",
"application_fee_amount" => 123,
], ["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_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> params = new HashMap<String, Object>();
params.put("amount", 1000);
params.put("currency", "usd");
params.put("source", "tok_visa");
params.put("application_fee_amount", 123);
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_4eC39HqLyjWDarjtT1zdp7dc");
stripe.charges.create({
amount: 1000,
currency: "usd",
source: "tok_visa",
application_fee_amount: 123,
}, {
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_4eC39HqLyjWDarjtT1zdp7dc"
params := &stripe.ChargeParams{
Amount: stripe.Int64(1000),
Currency: stripe.String(string(stripe.CurrencyUSD)),
ApplicationFeeAmount: stripe.Int64(123),
}
params.SetStripeAccount("{CONNECTED_STRIPE_ACCOUNT_ID}")
params.SetSource("tok_visa")
charge, err := charge.New(params)
There are three things to note about application fees:
- While you may pass in any positive number, the final amount collected as the application fee is capped at the total transaction amount minus any Stripe fees
- There are no additional Stripe fees on the application fee itself
- The currency for the
application_fee_amount
depends upon a few multiple currency factors
The resulting charge’s balance transaction includes a detailed fee breakdown of both the Stripe and application fees. To provide a better reporting experience, an application fee object is created once the fee is collected. Use the amount
property on the application fee object for reporting. You can then access these objects with the Application Fees endpoint.
Earned application fees are added to your available account balance on the same schedule as funds from regular Stripe charges. Application fees are viewable in the Collected Fees section of the Dashboard.
Flow of funds with fees
When you specify an application fee on a charge, the fee amount is transferred to your platform’s Stripe account. When processing a charge directly on the connected account, the charge amount—less the Stripe fees and application fee—is deposited into the connected account. For example, if a charge of $10 with a $1.23 application fee is made (as in the example above), $1.23 is transferred to your platform account, and $8.18 ($10 - $0.59 - $1.23) is netted in the connected account (assuming standard U.S. Stripe fees).
If you process payments in multiple currencies, you should also read how that is handled in Connect.
Issuing refunds
Just as platforms can create charges on connected accounts, they can also create refunds of charges on connected accounts. To refund a charge on a connected account, perform a standard create refund request using your platform’s secret key while authenticated as the connected account.
Application fees are not automatically refunded when issuing a refund. Your platform must explicitly refund the application fee or the connected user—the account on which the charge was created—loses that amount.
You can refund an application fee by passing a refund_application_fee
value of true in the refund request:
curl https://api.stripe.com/v1/refunds \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d charge="{CHARGE_ID}" \
-d refund_application_fee=true \
-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_4eC39HqLyjWDarjtT1zdp7dc"
refund = Stripe::Refund.create({
:charge => "{CHARGE_ID}",
:refund_application_fee => true,
}, :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_4eC39HqLyjWDarjtT1zdp7dc"
refund = stripe.Refund.create(
charge="{CHARGE_ID}",
refund_application_fee=True,
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_4eC39HqLyjWDarjtT1zdp7dc");
$refund = \Stripe\Refund::create([
"charge" => "{CHARGE_ID}",
"refund_application_fee" => true,
], ["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_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> params = new HashMap<String, Object>();
params.put("charge", "{CHARGE_ID}");
params.put("refund_application_fee", true);
RequestOptions requestOptions = RequestOptions.builder().setStripeAccount({CONNECTED_STRIPE_ACCOUNT_ID}).build();
Refund refund = Refund.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_4eC39HqLyjWDarjtT1zdp7dc");
stripe.refunds.create({
charge: "{CHARGE_ID}",
refund_application_fee: true,
}, {
stripe_account: "{CONNECTED_STRIPE_ACCOUNT_ID}",
}).then(function(refund) {
// 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.RefundParams{
Charge: stripe.String("{CHARGE_ID}"),
RefundApplicationFee: stripe.Bool(true),
}
params.SetStripeAccount("{CONNECTED_STRIPE_ACCOUNT_ID}")
refund, err := refund.New(params)
By default, the entire charge is refunded, but you can create a partial refund by setting an amount
value as a positive integer.
If the refund results in the entire charge being refunded, the entire application fee is refunded. Otherwise, a proportional amount of the application fee is refunded.
Alternatively, you can provide a refund_application_fee
value of false and refund the application fee separately through the API.
Further reading
Discover what other Connect functionality is available.