Reputation: 387
I've searched through the documentation on both the Stripe website and JaymeDavis' GitHub and still cannot manage to figure out if I'm correctly creating a bank account for a managed stripe account. From Stripe's website, it's clear this is what I need...
curl https://api.stripe.com/v1/accounts/acct_1032D82eZvKYlo2C/external_accounts \
-u sk_test_xxxxxxxxxxxxxxxxxxxxxx: \
-d external_account=btok_xxxxxxxxxxxxxxxxxxx
I have the token (btok....) returned from Stipe.js, and I have the account ID used in the curl link for the managed account, as well as the secret key. However, I cannot figure out what the process is to execute this in C#
My guess so far has been:
//Sample code for creating a managed account
StripeAccountService stripeAccountService = new StripeAccountService();
StripeAccountCreateOptions managedAccountCreateOption = new StripeAccountCreateOptions();
managedAccountCreateOption.Managed = true;
managedAccountCreateOption.Country = "US";
StripeRequestOptions connectAccountRequest = new StripeRequestOptions();
connectAccountRequest.ApiKey = ConfigurationManager.AppSettings["StripeApiKey"];
Stripe.StripeAccount response = stripeAccountService.Create(managedAccountCreateOption, connectAccountRequest);
// ADD Bank Account
var myAccount = new StripeAccountUpdateOptions();
myAccount.ExternalBankAccount.TokenId = "SampleToken";
var accountService = new StripeAccountService();
Stripe.StripeAccount bankAccount = accountService.Update(response.Id, myAccount);
The problem I'm having here is with adding the bank account. I want to create the bank account separately so that I can save the last 4 digits of a card/bank account (non-sensitive data) used in payouts in our database. The way above simply adds a single bank account to the managed user, and will not work as I would like to add multiple bank accounts for payouts. Any sample code in adding a bank account to an already existing managed account would help immensely (i.e. create a bank account with the token returned from Stripe.js, then in a separate action add this bank account to the managed user account so that I can grab the last 4 digits of this bank account as well as any additional accounts that are added in this way in the future). Thank you in advance for your help and time!
Upvotes: 1
Views: 1137
Reputation: 8727
You can just retrieve a Managed Account instead of creating one, i.e.:
StripeAccount response = accountService.Get(accountId);
From there you can add additional Bank Accounts. The result of that API call is a BankAccount
, and you should be able to access the last4
from there.
Upvotes: 1