Reply
Highlighted
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.

Highlighted
Administrator
Posts: 131
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?

Highlighted
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.

Highlighted
Posts: 433
Topics: 0
Kudos: 89
Blog Posts: 0
Ideas: 0
Solutions: 34
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
Highlighted
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
      }
  }
Highlighted
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

Highlighted
Posts: 433
Topics: 0
Kudos: 89
Blog Posts: 0
Ideas: 0
Solutions: 34
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
Highlighted
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

Highlighted
Administrator
Posts: 131
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>