Stripe Node.js - 如何在多个受益人(关联账户)之间拆分付款?

时间:2021-01-29 12:52:52

标签: node.js stripe-payments

对于我的第一个实现,我将交易金额从从我的应用 (Flutter) 中检索到的 paymentMethod Id 直接转给了收款人。现在我的目标是在同一笔交易的几个受益人之间分摊付款。

第一个实现代码:

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;

通过检查 documentation,我注意到不再指定 stripe.paymentMethods.create 方法,而是添加了 stripe.transfers.create 方法。

1 个答案:

答案 0 :(得分:1)

此代码试图将付款方式克隆到关联的帐户,然后在该帐户上直接收费。为了创建费用,然后将该费用的资金拆分到单独的关联账户,需要采用不同的方法。该模型更接近于“单独收费和转账”,在该平台上收费,然后使用转账在连接的帐户之间共享一些金额。此处概述了完整说明 [1]。

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