Posts: 5
Registered: ‎09-12-2011

Problem to create profile and getting message "credit card number is required"

We don't know the reason for failure in creating payment profiles. If creating Payment profile fails then it also fails at the time of transaction and throws the exception "credit card number is required".  This problem is only for our one client, because we have implemented same code for many clients. Please suggest.


Code for creating profile:



AnetApi.Schema.createCustomerProfileRequest request = new AnetApi.Schema.createCustomerProfileRequest();



AnetApi.Schema.customerProfileType[] m_new_cust = new AnetApi.Schema.customerProfileType[1];

m_new_cust[0] = new AnetApi.Schema.customerProfileType();
m_new_cust[0].email = dsProfile.Tables[0].Rows[0]["Email_id1"].ToString();


request.profile = m_new_cust[0];

request.validationMode = validationModeEnum.liveMode;

System.Xml.XmlDocument response_xml = null;
bool bResult = XmlAPIUtilities.PostRequest(request, out response_xml);
object response = null;
AnetApi.Schema.createCustomerProfileResponse api_response = null;

if (bResult) bResult = XmlAPIUtilities.ProcessXmlResponse(response_xml, out response);

if (!(response is AnetApi.Schema.createCustomerProfileResponse))
       return out_id;
if (bResult) api_response = (AnetApi.Schema.createCustomerProfileResponse)response;

out_id = Convert.ToInt64(api_response.customerProfileId);

Posts: 1,609
Topics: 15
Kudos: 209
Solutions: 121
Registered: ‎06-23-2011

Re: Problem to create profile and getting message "credit card number is required"

The problem is likely not in the section of code you pasted, but rather in the interface that actually collects the number. Maybe you're referencing the wrong field? Have you tried printing out the number just before it gets submitted to to make sure it's actually there?