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.
05-11-2020 09:34 AM
3 digit card codes are valid. It sounds like something else is the issue. Do you have the full error?
05-11-2020 01:36 PM
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.
05-12-2020 06:24 AM
Error Code: E00003 represents "An error occurred while parsing the XML request".
Are you able to show the XML you are sending?
05-12-2020 09:51 AM
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 } }
05-12-2020 07:00 PM
If there is a way with which I can look at the xml being sent, please let me know about it
05-12-2020 07:01 PM
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.
05-13-2020 12:51 AM
Just ran another test with CardCode "820" and it failed
05-13-2020 06:13 AM
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.
05-19-2020 09:30 AM
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.
05-01-2021 12:52 AM