Search code examples
c#stripe-paymentsstripe-connectstripe.net

Stripe.NET add bank account using token to Stripe Managed Account


I've searched through Jayme Davis' documentation, and I cannot find how to add a bank account using a token to a Stripe Managed Account. The only way it appears to add a bank account in the documentation, is by using the CustomerBankAccount object, which requires a CustomerID as a parameter, and does not work with an AccountID (i.e. Managed Account ID). I essentially would like to make this request (from Stipe's website) using Stripe.NET and C# code. Any help would be greatly appreciated! Thank you in advance!

curl https://api.stripe.com/v1/accounts/acct_1032D82eZvKYlo2C/external_accounts \
   -u sk_test_xxxxxxxxxxxxxxxxxxxxxx: \
   -d external_account=btok_xxxxxxxxxxxxxxxxxxx

Solution

  • You can use the ExternalBankAccount property for this and see an example in the test here

    var params = new StripeAccountUpdateOptions();
    params.ExternalBankAccount = new StripeAccountBankAccountOptions
    {
        TokenId = _token.Id
    }
    
    var accountService = new StripeAccountService();
    StripeAccount response = accountService.Update("acct_XXX", params);