cancel
Showing results for 
Search instead for 
Did you mean: 

3 digit card codes failing with error E00003 The value XXXXXXX is invalid according to its datatype

I am trying to perform a simple CHARGE A CREDIT CARD transaction and most of the code is copy paste from AuthNet site and incase the card code which I am sending to AuthNet is 3 digit then the transaction fails and Api returns null response even though its clearly mentioned in the API documentation that 3 digit card code is valid. Any help on the issue would be appreciated.

9 REPLIES 9

3 digit card codes are valid. It sounds like something else is the issue. Do you have the full error?

mmcguire
Administrator Administrator
Administrator

Full error below:-

 

The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:cardCode' element is invalid -
The value XXXXXX is invalid according to its datatype 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:cardCode' - The Pattern constraint failed.

Error Code: E00003 represents "An error occurred while parsing the XML request".
Are you able to show the XML you are sending?

Powered by NexWebSites.com -
Certified Authorize.net developers
NexusSoftware
Trusted Contributor

I am using c# to send the request, most of my code is copy paste from AuthNet site. Pasting my code below:-

 

public bool AuthorizePayment(string Card_Num, string Exp_Date, string Card_Code, string amount)
{
      //Console.WriteLine("Charge Credit Card Sample");

      ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;

      // define the merchant information (authentication / transaction id)
      ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
      {
          name = ConfigurationManager.AppSettings["AuthNetID"],
          ItemElementName = ItemChoiceType.transactionKey,
          Item = ConfigurationManager.AppSettings["AuthNetKey"],
      };

      var creditCard = new creditCardType
      {
          cardNumber = Card_Num,
          expirationDate = Exp_Date,
          cardCode = Card_Code
      };

      //standard api call to retrieve response
      var paymentType = new paymentType { Item = creditCard };

      var transactionType = objInf.Get("x_type") == "AUTH_CAPTURE" ? transactionTypeEnum.authCaptureTransaction.ToString() : transactionTypeEnum.refundTransaction.ToString();

      var transactionRequest = new transactionRequestType
      {
          transactionType = transactionType,
          amount = Convert.ToDecimal(amount),
          payment = paymentType,
      };

      if (objInf.Get("x_invoice_num") != null)
      {
          transactionRequest.order = new orderType { invoiceNumber = objInf.Get("x_invoice_num") };
      }
      if (objInf.Get("x_trans_id") != null)
      {
          transactionRequest.refTransId = objInf.Get("x_trans_id");
      }

      var request = new createTransactionRequest { transactionRequest = transactionRequest };

      // instantiate the controller that will call the service
      var controller = new createTransactionController(request);
      controller.Execute();

      // get the response from the service (errors contained if any)
      var response = controller.GetApiResponse();

      // validate response
      if (response != null)
      {
          //other code
      }
      else
      {
          //other code
      }
  }

If there is a way with which I can look at the xml being sent, please let me know about it

In Visual Studio the Autos and Locals windows show variable values while you are debugging. The windows are only available during a debugging session. The Autos window shows variables used around the current breakpoint. The Locals window shows variables defined in the local scope, which is usually the current function or method.

 

If you are using another IDE it should have similar functionality or you can print out the values to the console.

Powered by NexWebSites.com -
Certified Authorize.net developers

Just ran another test with CardCode "820" and it failed

The error is complaining about the data type being sent in the cardCode field.  It seems that non-numeric data is being sent. Is there any logging that shows the actual request? Alternatively, you could post your request to a testing site like http://webhookinbox.com/ to see what the script is sending.

 

<xs:simpleType name="cardCode">
<xs:restriction base="anet:numericString">
<xs:minLength value="3"/>
<xs:maxLength value="4"/>
</xs:restriction>
</xs:simpleType>

In Visual Studio the Autos and Locals windows show variable qualities while you are investigating. The windows are just accessible during an investigating meeting. The Autos window shows factors utilized around the current breakpoint. The Locals window shows factors characterized in the neighborhood scope, which is normally the current capacity or strategy.

On the off chance that you are utilizing another IDE it ought to have comparative usefulness or you can print out the qualities to the reassure.