简体   繁体   English

Stripe Connect-共享客户,无法收费

[英]Stripe Connect - shared customer , cant charge

Hi I am trying to implement stripe connect where the platform takes an application fee but the connected user gets majority of charge. 嗨,我正在尝试在平台收取应用程序费用但连接的用户收取大部分费用的情况下实现条纹连接。

Following this as my guide https://stripe.com/docs/connect/shared-customers 按照此作为我的指南https://stripe.com/docs/connect/shared-customers

I have this as my code. 我将其作为我的代码。 The user is saved w/ default credit card source in another view. 在另一个视图中,使用默认信用卡来源保存了该用户。

    Parse.Cloud.define("chargeCard", function(req, res){
      stripe.tokens.create({
        customer: req.params.customer,
      }, {
        stripe_account: req.params.stripeAccount,
      }).then((token) => {
        console.log("successfully created token");
        stripe.charges.create({
          amount: req.params.amount,
          currency: req.params.currency,
          source: token.id,
          application_fee: req.params.fee,
        }, {
          stripe_account: req.params.stripeAccount,
        }).then((charge) => {
          console.log("successfully charged card");
          res.success(charge);
        }).catch((error) => {
          console.log(error);
          res.error(error.message);
        });
      }).catch((error) => {
        console.log(error);
        res.error(error.message);
      });
    });

But receive the error: 但是收到错误:

"You provided a customer without specifying a source. The default source of the customer is a source and cannot be shared from existing customer". “您提供的客户没有指定来源。客户的默认来源是来源,不能与现有客户共享”。

Im not able to specify its default source in the create token body. 我无法在创建令牌正文中指定其默认来源。 any help? 有什么帮助吗?

This issue was with the users source. 此问题与用户来源有关。 Although the user had a credit card source it is not "shareable" (as the error kinda states) , you need to create a shared source when using stripe-connect. 尽管用户拥有信用卡来源,但该来源不是“可共享的”(如错误提示所述),但在使用Stripe-Connect时,您需要创建一个共享来源。

https://stripe.com/docs/sources/connect#creating-direct-charges https://stripe.com/docs/sources/connect#creating-direct-charges

You want to use this instead of the above tokens.create for direct charges in stripe-connect. 您想使用它代替上面的tokens.create来进行条带连接中的直接收费。

stripe.sources.create({
  customer: "cus_AFGbOSiITuJVDs",
  usage: "reusable",
  original_source: "src_19YP2AAHEMiOZZp1Di4rt1K6",
}, {
  stripe_account: "{CONNECTED_STRIPE_ACCOUNT_ID}",
}).then(function(token) {
  // asynchronously called
});

FYI: I do not save or attach this new source, kept the primary one and the regenerate a new token for each purchase since my application is 1 to many sellers. 仅供参考:由于我的申请对许多卖家而言都是1,因此我不会保存或附加此新资源,而是保留主要资源,并为每次购买重新生成新令牌。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM