Lab
Lab

Reputation: 1407

Stripe Node.js - How to split a payment between several beneficiaries (connected accounts)?

For my first implementation, I transfer the amount of the transaction directly to a beneficiary from a paymentMethod Id retrieved from my app (Flutter). Now my goal would be to split the payment between several beneficiaries on the same transaction.

First implementation code:

var clonedPaymentMethod = await stripe.paymentMethods.create(
        {
          payment_method: paym,
        },
        {
          stripeAccount: stripeVendorAccount,
        }
      );

var paymentIntent = await stripe.paymentIntents.create(
          {
            amount: amount,
            currency: currency,
            payment_method: clonedPaymentMethod.id,
            confirmation_method: "automatic",
            confirm: true,
            application_fee_amount: fee,
            description: "desc",
          },
          {
            stripeAccount: stripeVendorAccount,
          }
        );
const paymentIntentReference = paymentIntent;

By checking the documentation, I noticed that the stripe.paymentMethods.create method was no longer specified, and that the stripe.transfers.create methods were added.

Upvotes: 0

Views: 941

Answers (1)

v3nkman
v3nkman

Reputation: 1179

This code is attempting to clone a payment method to a connected account and then create a direct charge on that account. In order to create charges and then to split the funds of that charge to separate connected accounts a different approach would be needed. The model would be closer to "Separate charges and transfers", where the charge is made on that platform and then some amounts are shared among the connected accounts using transfers. A full description is outlined here [1].

[1] https://stripe.com/docs/connect/charges-transfers

Upvotes: 1

Related Questions