Connect Platforms Using the Payment Methods API

    Considerations for Stripe Connect platforms adding support for new payment methods using the Payment Methods API.

    Stripe Connect platform owners can make use of additional payment methods supported with the Payment Methods API. 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 PaymentMethods directly on the connected account

    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. Direct charges require creating PaymentMethods on connected accounts. You can do so by passing paymentMethod.stripeAccount with a value of a connected account’s ID when using Stripe.js.

    // Set the connected Stripe Account on which the PaymentMethod should be created
    var stripe = Stripe('pk_test_TYooMQauvdEDq54NiTphI7jx', {
      stripeAccount: "{{CONNECTED_STRIPE_ACCOUNT_ID}}"
    });
    
    stripe.createPaymentMethod('card', cardElement, {
      billing_details: {
        name: 'Jenny Rosen',
      },
    }).then(function(result) {
      // Handle result.error or result.payment_method
    });
    // Set the connected Stripe Account on which the PaymentMethod should be created
    const stripe = Stripe('pk_test_TYooMQauvdEDq54NiTphI7jx', {
      stripeAccount: "{{CONNECTED_STRIPE_ACCOUNT_ID}}"
    });
    
    (async () => {
      const {error, paymentMethod} = await stripe.createPaymentMethod('card', cardElement, {
        billing_details: {
          name: 'Jenny Rosen',
        },
      });
    
      // Handle error or paymentMethod
    })();

    If you’re creating PaymentMethods from the server, you can make use of authentication using the Stripe-Account header with any of our supported libraries.

    Shared PaymentMethods

    PaymentMethods can also be created on your platform and then shared to a connected account to create direct charges there.

    After you create a PaymentMethod and attach it to a Customer, you can share that PaymentMethod on a connected account using the connected account’s ID as the Stripe-Account header. See Saving and Reusing Cards for more details on how the PaymentMethod and Customer objects interact.

    curl https://api.stripe.com/v1/payment_methods \
      -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
      -d customer=cus_FrAlbPOPx2w8q9 \
      -d payment_method=pm_123456789 \
      -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'
    
    payment_method = Stripe::PaymentMethod.create({
      customer: 'cus_FrAlbPOPx2w8q9',
      payment_method: 'pm_123456789',
    }, {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'
    
    payment_method = stripe.PaymentMethod.create(
      customer='cus_FrAlbPOPx2w8q9',
      payment_method='pm_123456789',
      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');
    
    $payment_method = \Stripe\PaymentMethod::create([
      'customer' => 'cus_FrAlbPOPx2w8q9',
      'payment_method' => 'pm_123456789',
    ], ['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("customer", "cus_FrAlbPOPx2w8q9");
    params.put("payment_method", "pm_123456789");
    
    RequestOptions requestOptions = RequestOptions.builder().setStripeAccount("{{CONNECTED_STRIPE_ACCOUNT_ID}}").build();
    PaymentMethod paymentMethod = PaymentMethod.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
    const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
    
    (async () => {
      const paymentMethod = await stripe.paymentMethods.create({
        customer: 'cus_FrAlbPOPx2w8q9',
        payment_method: 'pm_123456789',
      }, {
        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.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
    
    params := &stripe.PaymentMethodParams{
      Customer: stripe.String("cus_FrAlbPOPx2w8q9"),
      PaymentMethod: stripe.String("pm_123456789"),
    }
    params.SetStripeAccount("{{CONNECTED_STRIPE_ACCOUNT_ID}}")
    PaymentMethod, err := PaymentMethod.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 paymentMethodOptions = new PaymentMethodOptions() {
      CustomerId = "cus_FrAlbPOPx2w8q9",
      PaymentMethodId = "pm_123456789",
    };
    
    var paymentMethodService = new PaymentMethodService();
    var requestOptions = new RequestOptions() {
      StripeConnectAccountId = "{{CONNECTED_STRIPE_ACCOUNT_ID}}",
    };
    
    PaymentMethod paymentMethod = paymentMethodService.Create(paymentMethodOptions, requestOptions);
    

    If you want to create PaymentMethods that can be reused multiple times on your connected account, you should make sure to attach them to Customers before using them with PaymentIntents to create charges. You must provide the Customer ID in the request when sharing PaymentMethods that are attached to Customers for security purposes.

    It is possible to share PaymentMethods to connected accounts without previously attaching them to Customers. However, please note that the original PaymentMethod will be not be chargeable after creating a shared PaymentMethod, since PaymentMethods that are not attached to Customers can only be used once.

    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.

    Related resources

    Was this page helpful?

    Thank you for helping improve Stripe's documentation. If you need help or have any questions, please consider contacting support.

    Questions?

    We're always happy to help with code or other questions you might have. Search our documentation, contact support, or connect with our sales team. You can also chat live with other developers in #stripe on freenode.

    On this page