Reply
Member
Posts: 4
Registered: ‎06-01-2012

Add Bank Account Payment Profile Using C# SDK

[ Edited ]

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?

Administrator
Posts: 1,064
Registered: ‎08-17-2009

Re: Add Bank Account Payment Profile Using C# SDK

Hi ghartsho,

 

Thanks for bringing this up. It looks like there may be an issue with the SDK. I'm forwarding this on to our development teams.

 

Thanks,

 

Michelle

Developer Community Manager

Member
Posts: 1
Registered: ‎07-13-2012

Re: Add Bank Account Payment Profile Using C# SDK

I wrote up a little walk through on adding bank account support, it involves downloading the source code and modifying a number of files.  If you are interested check out http://stackoverflow.com/a/11475815/328968

Contributor
Posts: 10
Registered: ‎07-11-2012

Re: Add Bank Account Payment Profile Using C# SDK


patricker1 wrote:

I wrote up a little walk through on adding bank account support, it involves downloading the source code and modifying a number of files.  If you are interested check out http://stackoverflow.com/a/11475815/328968


Thanks for the walkthrough on this.  Is there going to be a new version of the SDK released to reflect this change?  I have linked several SDK classes in my project and I try to avoid modifying these types of libraries as best practice.  

 

I'm using the version from Anet's download section.  anet_dotnet_sdk-1.7.1.zip - C#

Member
Posts: 8
Registered: ‎11-28-2013

Re: Add Bank Account Payment Profile Using C# SDK

Is this issue fixed? Im facing a similar problem while fetching the customer details using CIM api.

Posts: 1,020
Topics: 30
Kudos: 55
Blog Posts: 33
Registered: ‎12-05-2011

Re: Add Bank Account Payment Profile Using C# SDK

Hello @nik_0811 

 

Are you using the latest SDK from GitHub?

 

https://github.com/AuthorizeNet/sdk-dotnet

 

Richard

--------
Pro Tip: Never use test mode in the sandbox, instead use the Error Generation Guide.
New Video: Integrating Mobile Payments with Authorize.Net.