Reply
Member
Posts: 5
Registered: ‎05-11-2020

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.

Administrator
Posts: 168
Registered: ‎11-29-2017

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

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

Member
Posts: 5
Registered: ‎05-11-2020

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

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.

Posts: 491
Topics: 0
Kudos: 96
Blog Posts: 0
Ideas: 0
Solutions: 41
Registered: ‎04-28-2017

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

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
Member
Posts: 5
Registered: ‎05-11-2020

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

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
      }
  }
Member
Posts: 5
Registered: ‎05-11-2020

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

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

Posts: 491
Topics: 0
Kudos: 96
Blog Posts: 0
Ideas: 0
Solutions: 41
Registered: ‎04-28-2017

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

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
Member
Posts: 5
Registered: ‎05-11-2020

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

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

Administrator
Posts: 168
Registered: ‎11-29-2017

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

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>
New Member
Posts: 1
Registered: ‎05-01-2021

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

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.