简体   繁体   English

使用Stripe.js(iOS)为Stripe Connect付款创建external_account

[英]Create external_account for Stripe Connect payouts with Stripe.js (iOS)

I am trying to connect actual bank accounts to the stripe accounts in Stripe Connect. 我正在尝试将实际的银行帐户连接到Stripe Connect中的条纹帐户。

However, I am struggling with the actual implementation. 但是,我正在为实际的实现而苦苦挣扎。

I use Custom Accounts, so I want to provide the user with the account creation logic through my iOS app. 我使用自定义帐户,因此我想通过我的iOS应用为用户提供帐户创建逻辑。

In the Stripe API Reference it says that the recommended way to accomplish this is: "Destination accounts are added via the external_accounts parameter when creating or updating Custom accounts. The value should be a bank account or debit card token returned from Stripe.js." 在《 Stripe API参考》中,建议完成此操作的推荐方法是:“在创建或更新自定义帐户时,通过external_accounts参数添加目标帐户。该值应该是从Stripe.js返回的银行帐户或借记卡令牌。”

Creating the token is documented as follows (I am using NodeJS): 创建令牌的记录如下(我正在使用NodeJS):

stripe.createToken('bank_account', {
  country: 'US',
  currency: 'usd',
  routing_number: '110000000',
  account_number: '000123456789',
  account_holder_name: 'Jenny Rosen',
  account_holder_type: 'individual',
}).then(function(result) {
  // Handle result.error or result.token
});

Where to I link that token in the account creation process? 在帐户创建过程中,我应该在哪里链接该令牌? See related code below: 请参阅下面的相关代码:

app.post('/create_account', (req, res) => {
console.log('create account called');
var email = req.body.email;
var firstname = req.body.firstname;
var lastname = req.body.lastname;

stripe.accounts.create({
    country: "CH",
    type: "custom",
    email: email,
    business_name: "examplename",
    legal_entity: {
        first_name: "firstname",
        last_name: "lastname",
        dob: {
            day: 1,
            month: 1,
            year: 1900
        }
    }

}).then((account) => {
    res.status(200).send(account)
}).catch((err) => {
    console.log(err, req.body)
    res.status(500).end()
});
});

Is the token creation just a means of validating the account information client-side? 令牌创建只是一种在客户端验证帐户信息的方法吗?

Would be glad if someone can elaborate on this with a simple step-by-step explanation, thank you in advance! 如果有人可以通过简单的逐步说明来详细说明这一点,我们将非常高兴,在此先感谢您!

You'd pass the token in the external_account parameter: 您可以在external_account参数中传递令牌:

var bankAccountToken = req.body.stripeToken;

stripe.accounts.create({
  country: "CH",
  type: "custom",
  // ...
  external_account: bankAccountToken,
}).then((account) => {
  // ...

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

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