cancel
Showing results for 
Search instead for 
Did you mean: 

Using Bank Accounts With Authorize.Net C# SDK

After playing around with the Authorize.Net CIM XML API C# sample code /developerbook,   I started using the Authorize.Net C# SDK /chatrandom. 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.

 I use this subscription extension http://ecommerce.aheadworks.com/magento-extensions/subscriptions-and-recurring-payments.html /omegle

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

 

LansoirThemos
Member
0 REPLIES 0