简体   繁体   中英

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.

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.

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."

Creating the token is documented as follows (I am using 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:

var bankAccountToken = req.body.stripeToken;

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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