cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot set CustomerID and Description in Customer profile....

I am trying to set the merchantCustomerID and Description in the customer profile and when I set the ID the description is blank, but when I comment out that code the description is populated. This is just a simple property assignment, at least so I thought. Can you not have both filled in??

 

I'm using the C# XML example CustomerProfileAPIXML.

mgerbi
Member
1 ACCEPTED SOLUTION

Accepted Solutions

Unfortunately, I am being paid to do this, so I can't waist my time on something like this. I will just populate all three fields to get the two I want populated and then write some code to go in and delete the email field later. Thanks for your help though. 

View solution in original post

13 REPLIES 13

It should work with both fields fill in. Can you post your code?

RaynorC1emen7
Expert

Here is the code... The values that are being passed are just strings. 

 

/// <summary>
		/// Create the customer profile
		/// </summary>
		/// <returns>The result of the operation</returns>
		public static long CreateCustomerProfile(CC_Customer cus)
		{
			long out_id = 0;
			createCustomerProfileRequest request = new createCustomerProfileRequest();
			XmlAPIUtilities.PopulateMerchantAuthentication((ANetApiRequest)request);
 
			customerProfileType m_new_cust = new customerProfileType();
			//m_new_cust.email = "fake@example.com";
			//m_new_cust.description = "Example customer " + (DateTime.Now.Ticks.ToString());
            m_new_cust.merchantCustomerId = cus.AcctNum;
            m_new_cust.description = cus.Name;
            
			request.profile = m_new_cust;
 
			System.Xml.XmlDocument response_xml = null;
			bool bResult = XmlAPIUtilities.PostRequest(request, out response_xml);
			object response = null;
			createCustomerProfileResponse api_response = null;
 
			if (bResult) bResult = XmlAPIUtilities.ProcessXmlResponse(response_xml,out response);
			if (!(response is createCustomerProfileResponse))
			{
				ANetApiResponse ErrorResponse = (ANetApiResponse)response;
				Console.WriteLine(String.Format("Create Customer Profile\n	 code: {0}\n	  msg: {1}", ErrorResponse.messages.message[0].code, ErrorResponse.messages.message[0].text));
				return out_id;
			}
			if (bResult) api_response = (createCustomerProfileResponse)response;
			if (api_response != null)
			{
				out_id = Convert.ToInt64(api_response.customerProfileId);
				Console.WriteLine("Created Profile #" + out_id);
				Console.WriteLine(String.Format("	 code: {0}\n	  msg: {1}", api_response.messages.message[0].code, api_response.messages.message[0].text));
			}
 
			return out_id;
		}

So it from the sample CIM XML C# code. I try it and it work fine. I did use a test string of "123" and "abc". Did the console output show the xml input?

Yeah, no errors when it ran. Just the CustomerID/Description doesn't populate when I see it on the Authorize.NET website. Are only one of these fields supposed to be populated?

It not the error the console show the xml input. can you post that and masked out your loginID and transactionKey.

I can't upload pictures locally... There are no errors. Everything comes back successful. 

Is there anyway to debug this? It is referencing AnetApiSchema.cs and using XMLAPIUtilities which is using a web request. I can't get to the source file(s). 

 

After running my code, the description didn't update, so I was able to manually update it through the Authorize.NET site. So the two fields can be populated. 

Just ran it again and uncommented out the email so I was setting all three fields and it ran successfully and the description got popualted with the email and the email got populated correctly. How can we use this if the classes are not working correctly?

You should be able debug it in PostRequest method and see what the xml generated. Again there isn't any error because the it did get create/update. Maybe it something in your data. it is XML encoded?

What we need is that input xml to see why.

example

<?xml version="1.0" encoding="utf-8"?>
<createCustomerProfileRequest xmlns="AnetApi/xml/v1/schema/
AnetApiSchema.xsd"> 
<merchantAuthentication>
<name>API Login ID here</name>
<transactionKey>Transaction Key here</transactionKey>
</merchantAuthentication>
<profile>
<merchantCustomerId>Merchant Customer ID here</merchantCustomerId>
<description>Profile description here</description>
<email>customer profile email address here</email>
<paymentProfiles>
<customerType>individual</customerType>
</paymentProfiles>
</profile>
<validationMode>none</validationMode>
</createCustomerProfileRequest>