After playing around with the Authorize.Net CIM XML API C# sample code, I started using the Authorize.Net C# SDK. I am able to add credit cards and bank accounts to customer profiles using the CIM XML API sample code. I don’t see how to add bank accounts using the SDK though.
Adding bank account with CIM XML API:
...
customerPaymentProfileType new_payment_profile = new customerPaymentProfileType();
paymentType new_payment = new paymentType();
bankAccountType new_bank = new bankAccountType();
new_bank.nameOnAccount = "xyz";
new_bank.accountNumber = "4111111";
new_bank.routingNumber = "325070760";
new_payment.Item = new_bank;
new_payment_profile.payment = new_payment;
createCustomerPaymentProfileRequest request = new createCustomerPaymentProfileRequest();
XmlAPIUtilities.PopulateMerchantAuthentication((ANetApiRequest)request);
request.customerProfileId = profile_id.ToString();
request.paymentProfile = new_payment_profile;
request.validationMode = validationModeEnum.testMode;
...
Using the SDK I only see a .AddCreditCard() method, but no way to add a bank account. When I loop through all my PaymentProfiles It throws an exception when it comes across a bank account too:
CustomerGateway cg = new CustomerGateway("xxx", "yyy");
foreach (string cid in cg.GetCustomerIDs())
{
Customer c = cg.GetCustomer(cid);
foreach (PaymentProfile pp in c.PaymentProfiles)
{
Console.WriteLine(pp.ToString());
}
}
Exception:
Unable to cast object of type 'AuthorizeNet.APICore.bankAccountMaskedType' to type 'AuthorizeNet.APICore.creditCardMaskedType'.

How do I add a bank account to a CIM profile using the Authorize.Net C# SDK?
Update:
Proof that CIM can store bank account information:

The following is tested, but only so far as what the original question brought up (Test it more for me?), I wrote it using the provided XML example and by copying the code for the AddCreditCard code.
When you are all done updating the following code will work:
First, download the C# source code for the API from http://developer.authorize.net/downloads/.
In reviewing the code I can see 4 files that use “creditCardType”, these are SubscriptionRequest.cs, CustomerGateway.cs, PaymentProfile.cs and AnetApiSchema.cs (this last one we don’t have to touch). We also need to watch out for ‘creditCardMaskedType’, which is used in PaymentProfile.cs, Transaction.cs and AnetApiSchema.cs. Any place these files show up we need to make sure we support the bankAccount equivelants as well.
Open the AuthorizeNET solution. We’ll be jumping around a bit through the files listed above.
In CustomerGateway.cs add the following block of code:
In PaymentProfile.cs add some public properties
Modify the the following block of the
PaymentProfile(customerPaymentProfileMaskedType apiType)constructor:Add this block to the
PaymentProfile.ToAPI()method:Add the following public properties to SubscriptionRequest.cs > SubscriptionRequest class (around line 187)
Add the following else if block TWICE to SubscriptionRequest. The first time is in the ToAPI method, the second is in the ToUpdateableAPI method, in both cases it goes after the CC number null check.
Add the following public properties to Transaction.cs
In Transaction.cs in the static NewFromResponse(transactionDetailsType trans) method, find the block that checks for
trans.payment != nulland tweak as shown: