当我尝试向托管账户付款时出现错误

Getting error when I try to payout to managed account

正在尝试使用托管帐户进行付款。基本上是向用户收费,并将钱发送到托管帐户而不是平台帐户。我正在使用 "sharing customers" 我正在使用 link https://stripe.com/docs/connect/shared-customers 底部的代码。取回令牌后,我尝试进行一次充电,但出现错误 "Card information not found",但我在创建令牌时传递了 cardId

错误:message: "Could not find payment information"

Stripe.tokens.create(
 { customer: request.params.customerId, card: request.params.cardId },
 { stripe_account: 'acct_xyz' }, // id of the connected account
  function(err, token) {

  Stripe.charges.create(
 {
amount: 1000, // amount in cents
currency: "usd",
source: token,
description: "Example charge",
application_fee: 123 // amount in cents
},
function(err, charge) {
console.log(err);
 });
});

这对你有用吗?这里的主要区别是

  1. 我在 stripe.charges.create 请求中包括 { stripe_account: 'acct_xyz' },如果使用共享客户,这需要在连接的帐户本身上发生。 https://stripe.com/docs/connect/payments-fees#charging-directly

  2. 而不是 token 作为 source 我只使用令牌对象的 id 属性(例如 tok_xxxyyyzzz)。

样本:

// id of connected account you want to create customer on, charge
var connectedAccountId = "acct_16MNx0I5dd9AuSl3";

// id of customer and card you want to create a token from

var platformCustomerId = "cus_8vEdBa4rQTGond";
var platformCustomerCardId = "card_18dOAcFwTuOiiF4uwtDe2Nip";

var stripe = require("stripe")(
  "sk_test_xxxyyyyzzz"
);

    // create a token using a customer and card on the Platform account
    stripe.tokens.create(
      {customer: platformCustomerId, card: platformCustomerCardId },
      {stripe_account: connectedAccountId},
      function(err, token) {
        if (err)
          throw (err);

            stripe.charges.create({
              amount: 4444,
              currency: "usd",
              source: token.id,
              description: "Charge on a connected account",
              application_fee: 1111
            },
            {stripe_account: connectedAccountId},
            function(err, charge) {
              if (err)
                throw (err);
              console.log(charge);
            });
        });

或者,正如您所说的,您正在使用托管帐户,您可能需要考虑通过平台收费,这样您就可以完全避免共享客户流,请参见此处的示例,https://stripe.com/docs/connect/payments-fees#charging-through-the-platform