AuthorizeNet / sdk-dotnet

.Net SDK for Authorize.Net API
Other
149 stars 205 forks source link

CustomerProfileId is not returned in createCustomerProfile response #280

Open kingeric027 opened 4 years ago

kingeric027 commented 4 years ago

I am getting an E00039 error in my createCustomerProfile response. This error indicates that a duplicate profile already exists. I understand this error and why is is returned in my request but unfortunately the customerProfileId is not returned in the response. It just has a null value.

If I had the matching customerProfileId returned in the response then I could get the matching profile and continue with my process, or I could delete or edit that profile. How come the customerProfileId is not returned in this instance? *Note: the customerProfileId is included in the error message "A duplicate record with ID XXXXXXXXXX already exists." I suppose I could parse this message and grab the ID but that seems like an unnecessary hack.

jonaslarance commented 4 years ago

I ran into this problem implementing the Accept Hosted form and I strongly sympathize. This issue creates a sequence paradox returning customerProfileId, which should be much more accessible. I had to solve it using the error text hack you mentioned.

string errorCustomerProfileId = Regex.Match(response.messages.message[0].text, @"(\s\d+\s)").Value.Trim();