4

我们可以在 NodeJS 中使用 Stripe connect 创建付款并收取 application_fee,如下所示

// Get the credit card details submitted by the form
var token = request.body.stripeToken;

// Create the charge on Stripe's servers - this will charge the user's card
stripe.charges.create(
  {
    amount: 1000, // amount in cents
    currency: "eur",
    source: token,
    description: "Example charge",
    application_fee: 123 // amount in cents
  },
  {stripe_account: CONNECTED_STRIPE_ACCOUNT_ID},
  function(err, charge) {
    // check for `err`
    // do something with `charge`
  }
);

可以使用 Stripe 原生结账处理程序获取源代码。

但是,如果我有一个市场并且我想对具有不同作者的多个项目执行结帐,那么我将如何进行?

问题是我需要从一个来源创建多个费用。但随后系统会认为存在错误,因为总金额(在检索 stripeToken 源时使用)与单个金额(单个项目的)不匹配。

4

3 回答 3

4

如果有人仍然有这个问题,看起来 Stripe 现在有一个transfer_group可以放在PaymentIntent. 这transfer_group是您想出的一些字符串,可以将其附加到多个传输中。

在此处阅读更多信息:https ://stripe.com/docs/connect/charges-transfers

您可以看到,在示例中,同一个PaymentIntent.

于 2020-10-29T20:35:37.793 回答
1

不能在多个帐户之间拆分单笔费用。

1)您需要将令牌保存给平台帐户中的客户。2) 为您要使用“共享客户”创建费用的每个帐户创建一个新令牌

// Create a Token from the existing customer on the platform's account
stripe.tokens.create(
  { customer: CUSTOMER_ID, card: CARD_ID },
  { stripe_account: CONNECTED_STRIPE_ACCOUNT_ID }, // id of the connected account
  function(err, token) {
    // callback
  }

3) 使用新令牌使用您在问题中的代码创建费用

于 2016-02-23T19:14:14.273 回答
0

看看转移组:

// Set your secret key. Remember to switch to your live secret key in 

production.
// See your keys here: https://dashboard.stripe.com/apikeys
const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');

// Create a PaymentIntent:
const paymentIntent = await stripe.paymentIntents.create({
  amount: 10000,
  currency: 'usd',
  payment_method_types: ['card'],
  transfer_group: '{ORDER10}',
});

// Create a Transfer to the connected account (later):
const transfer = await stripe.transfers.create({
  amount: 7000,
  currency: 'usd',
  destination: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
  transfer_group: '{ORDER10}',
});

// Create a second Transfer to another connected account (later):
const secondTransfer = await stripe.transfers.create({
  amount: 2000,
  currency: 'usd',
  destination: '{{OTHER_CONNECTED_STRIPE_ACCOUNT_ID}}',
  transfer_group: '{ORDER10}',
});

参考:https ://stripe.com/docs/connect/charges-transfers

于 2022-01-21T13:42:36.863 回答