Posts: 3
Registered: ‎08-22-2011

Using #C / AIM SOAP to update credit card exp date fails on XML document serialization



When attempting to write a method to update the cc exp date, I get an Unable to Write XML document error when making the call to UpdateCustomerPaymentProfile().


Below is the offending code. Everthing seems to be working fine, but the API (UpdateCustomer...) throws the XML error immediately. It does not even try to communicate with the server.


Huge thanks in advance,



[code follows...]


ArbApiSoap.GetCustomerPaymentProfileResponseType readPayProfile = Service.GetCustomerPaymentProfile(MerchantAuthentication, customer.AuthorizeDotNetCustomerProfileID.Value, paymentProfileID);


if (readPayProfile != null)



//Get the payment object

                        ArbApiSoap.PaymentMaskedType payment = readPayProfile.paymentProfile.payment;

                        ArbApiSoap.CreditCardMaskedType card = (ArbApiSoap.CreditCardMaskedType)payment.Item;



//Update the exp date


                        card.expirationDate = string.Format("{0}-{1}", newExpDate.Year, newExpDate.Month); //"YYYY-MM";


//Write this back to the payment object

                        payment.Item = card;


//Create a "write" profile

                        ArbApiSoap.CustomerPaymentProfileExType writePayPofile = newCustomerPaymentProfileExType();


//Make it look like the "read" profile

                        writePayPofile.billTo = new CustomerAddressType();

                        writePayPofile.billTo = readPayProfile.paymentProfile.billTo;

                        writePayPofile.customerPaymentProfileId = readPayProfile.paymentProfile.customerPaymentProfileId;

                        writePayPofile.customerType = readPayProfile.paymentProfile.customerType;

                        writePayPofile.customerTypeSpecified = readPayProfile.paymentProfile.customerTypeSpecified;

                        writePayPofile.taxId = readPayProfile.paymentProfile.taxId;


//Create a drivers license object

if (readPayProfile.paymentProfile.driversLicense != null)


                            writePayPofile.driversLicense = new DriversLicenseType();

                            writePayPofile.driversLicense.dateOfBirth = readPayProfile.paymentProfile.driversLicense.dateOfBirth;

                            writePayPofile.driversLicense.number = readPayProfile.paymentProfile.driversLicense.number;

                            writePayPofile.driversLicense.state = readPayProfile.paymentProfile.driversLicense.state;



//Create a payment type...

                        writePayPofile.payment = new PaymentType();

                        writePayPofile.payment.Item = payment.Item;


//Apply the changes

                        ArbApiSoap.UpdateCustomerPaymentProfileResponseType resp = Service.UpdateCustomerPaymentProfile(MerchantAuthentication, customer.AuthorizeDotNetCustomerProfileID.Value, writePayPofile, ValidationModeEnum.none);


                        bSuccess = (resp.resultCode == ArbApiSoap.MessageTypeEnum.Ok);




Posts: 4,525
Registered: ‎03-08-2010

Re: Using #C / AIM SOAP to update credit card exp date fails on XML document serialization

[ Edited ]

I think the problem is with the


While it is a CreditCardMaskedType from GetCustomerPaymentProfile

It is a CreditCardType for UpdateCustomerPaymentProfile


P.S. You are using CIM not AIM