When we are calling CreateCustomerPaymentProfile and CreateCustomerShippingAddress we occasionally get an ‘E00039’ for a duplicate record.
When this occurs the customerPaymentProfileId and customerAddressId are set to 0 in the response. Is there any way to get the record ids with the duplicate information?
This would make the workflow much easier if there was a way to get that information. Thanks in advance for the help.
07-08-2014 06:58 AM
Hello @todd123
We actually have this request on our enhancement list, but I don't have any specific time line for delivery.
I'd recommend subscribing to this topic so that you'll be alerted via email if there are updates. To subscribe, click Topic Options at the top of this thread and then select Subscribe. You'll then receive an email once anyone replies to your post.
Thanks,
Richard
07-08-2014 07:48 AM
In C#, I do this:
catch (InvalidOperationException ex)
{
Match findCustomerId = Regex.Match(ex.Message, @"\b\d+\b");
if (findCustomerId.Success)
{
// return the existing customer
outCustomer = GetCustomer(findCustomerId.Value);
}
}
07-08-2014 01:39 PM
I should point out that folks have been asking for this since 2009, so I wouldn't recommend waiting on Authorize.Net to change its behavior anytime soon.
We worked around it by looping through the profile and attempting to find the duplicate based on CC last 4, first name, last name, address, and zip. Another option is to just create a new "customer" profile for each transaction.
07-08-2014 02:15 PM
I submitted a pull request on github after implementing my own method and it was accepted. So hopefully they will release it soon.
07-09-2014 08:57 AM
This has been fixed now.
Here is a sample code how to tackle duplicate and get that information from response,
if (response != null && response.messages.message[0].code == "E00039") //E00039 - Duplicate payment profile { var msg = "Error: " + response.messages.message[0].code + " " + response.messages.message[0].text; LogHelper.Error(msg); if (customerPaymentProfile.PaymentProfileId == null && customerPaymentProfile.CustomerProfileId == null) { //Too bad, ideally this won't happen, this is just a safety check. Log and throw error... } else { //Original Payment profile details received customerPaymentProfile.PaymentProfileId = response.customerPaymentProfileId; //Original customerPaymentProfile.CustomerProfileId = response.customerProfileId; } }
01-28-2016 04:24 PM