Hi,
I am using the latest version of the C# SDK to update an existing Customer Payment Profile. When I attempt to do so, I am getting this error:
The element 'updateCustomerPaymentProfileRequest' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'paymentProfile' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'refId, customerProfileId' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.
I am basically copying and pasting the example code I found here: https://github.com/AuthorizeNet/sample-code-csharp/blob/master/CustomerProfiles/UpdateCustomerPaymen...
Here is a snippet of the code:
var creditCard = new creditCardType { cardNumber = "XXXX1111", expirationDate = "XXXX" }; var paymentType = new paymentType { Item = creditCard }; var paymentProfile = new customerPaymentProfileExType { billTo = new customerAddressType { // change information as required for billing firstName = "John", lastName = "Doe", address = "123 Main St.", city = "Bellevue", state = "WA", zip = "98004", country = "USA", phoneNumber = "000-000-000", }, payment = paymentType, customerPaymentProfileId = paymentProfileMasked.customerPaymentProfileId }; var request = new updateCustomerPaymentProfileRequest(); request.customerProfileId = paymentProfileMasked.customerProfileId; request.paymentProfile = paymentProfile; request.validationMode = validationModeEnum.liveMode; var controller = new updateCustomerPaymentProfileController(request); controller.Execute(); var errorResponse = controller.GetErrorResponse(); if (errorResponse != null) { throw new ApplicationException(errorResponse.messages.message[0].text); }
Does anyone know why I might be getting this error message?
Solved! Go to Solution.
11-03-2016 10:08 AM
Hi Jabberrwocky2,
This error indicates that the customer profile ID is not being set. I suggest that you check the updateCustomerPaymentProfile object prior to submitting the request.
Thanks,
Joy
11-04-2016 12:37 PM
Hi Jabberrwocky2,
This error indicates that the customer profile ID is not being set. I suggest that you check the updateCustomerPaymentProfile object prior to submitting the request.
Thanks,
Joy
11-04-2016 12:37 PM
Joy,
Thanks for the response. Filling in the CustomerProfileId with a valid value did the trick. I was trying to reuse the customer profile ID returned in the masked customer profile, but for whatever reason that is null.
11-07-2016 06:20 AM