Connect Platforms Using the Sources API
Considerations for Stripe Connect platforms adding support for new payment methods using the Sources API.
Stripe Connect platform owners can make use of additional payment methods supported with Sources. To learn more about creating payments for connected users, and which approach is best for you, refer to our Connect payments and fees documentation.
Creating destination charges
If you opt for destination charges, you should create Sources on your platform directly and create Charges using the appropriate destination parameter. Customers are charged by your platform, which then transfers the necessary amount to the destination account.
With destination charges that use cards, your platform name appears on statement descriptors and the charge is attributed to the connected account. With destination charges that use alternative payment methods (APMs), your platform name appears on statement descriptors but the charge is attributed to your platform.
Creating direct charges
If you opt for direct charges, you will need to make sure that the connected account is onboarded on the payment method you intend to use (see below). Direct charges require creating sources on connected accounts. You can do so by passing source.stripeAccount with a value of a connected account’s ID when using Stripe.js.
// Set the connected Stripe Account on which the source should be created
var stripe = Stripe(
'pk_test_martYi5BVvIhfwNanC2fuhpm',
{stripeAccount: "acct_24BFMpJ1svR5A89k"},
);
stripe.createSource({
type: 'ideal',
amount: 1099,
currency: 'eur',
owner: {
name: 'Jenny Rosen',
},
redirect: {
return_url: 'https://shop.example.com/crtA6B28E1',
},
}).then(function(result) {
// handle result.error or result.source
});
If you’re creating sources server-side, you can make use of authentication using the Stripe-Account header with any of our supported libraries.
Shared card Sources
Card Sources (because they are not intrinsically tied to your platform as they do not require any authentication flow) can be created on your platform and then shared to connected account to create direct charges there.
Once you created a card Source and attached it to a Customer (see Sources and Customers for more details on how these two objects interact), you can share that card Source on a connected account using the connected account’s ID as Stripe-Account header:
curl https://api.stripe.com/v1/sources \
-u sk_test_TeV0YjI5jYSHFO89wwFbqblx: \
-d customer=cus_AFGbOSiITuJVDs \
-d original_source=src_19YP2AAHEMiOZZp1Di4rt1K6 \
-d usage=reusable \
-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_TeV0YjI5jYSHFO89wwFbqblx"
token = Stripe::Source.create({
:customer => "cus_AFGbOSiITuJVDs",
:original_source => "src_19YP2AAHEMiOZZp1Di4rt1K6",
:usage => "reusable",
}, {: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_TeV0YjI5jYSHFO89wwFbqblx"
token = stripe.Source.create(
customer="cus_AFGbOSiITuJVDs",
original_source="src_19YP2AAHEMiOZZp1Di4rt1K6",
usage="reusable",
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_TeV0YjI5jYSHFO89wwFbqblx");
$token = \Stripe\Source::create(array(
"customer" => "cus_AFGbOSiITuJVDs",
"original_source" => "src_19YP2AAHEMiOZZp1Di4rt1K6",
"usage" => "reusable",
), 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_TeV0YjI5jYSHFO89wwFbqblx";
Map<String, Object> params = new HashMap<String, Object>();
params.put("customer", "cus_AFGbOSiITuJVDs");
params.put("original_source", "src_19YP2AAHEMiOZZp1Di4rt1K6");
params.put("usage", "reusable");
RequestOptions requestOptions = RequestOptions.builder().setStripeAccount("{CONNECTED_STRIPE_ACCOUNT_ID}").build();
Source source = Source.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_TeV0YjI5jYSHFO89wwFbqblx");
stripe.sources.create({
customer: "cus_AFGbOSiITuJVDs",
usage: "reusable",
original_source: "src_19YP2AAHEMiOZZp1Di4rt1K6",
}, {
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_TeV0YjI5jYSHFO89wwFbqblx"
params := &stripe.SourceObjectParams{
Customer: stripe.String("cus_AFGbOSiITuJVDs"),
OriginalSource: stripe.String("src_19YP2AAHEMiOZZp1Di4rt1K6"),
Usage: stripe.String(string(stripe.SourceUsageReusable)),
}
params.SetStripeAccount("{CONNECTED_STRIPE_ACCOUNT_ID}")
s, err := source.New(params)
Card Sources are generally reusable. However, when sharing them, you can override the usage to constrain how the connected account uses them. You do so by specifying the usage as single_use when sharing the Source.
If you are creating reusable card Sources on your connected account, you should make sure to attach them to Customers before charging them. Please refer to Sources and Customers for more details on how to attach and manage Sources on Customers.
Onboarding of connected accounts
We are currently working on enabling Connect platforms to activate payment methods for their users programmatically. If you are interested in this functionality, please get in touch.
As a fallback, if you are relying on Standard accounts you can direct your users to their payment settings so that they can enable payment methods from the Stripe dashboard. Alternatively you can rely on destination charges with the caveat that your platform will be the merchant of record on these payments, not the connected account.