cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Accept.js Client Side Errors

Hello,

We Switched from AIM to accept.js with our own payment form a couple months ago, it is live and in production. Works the vast majority of the time but will persistently error out for random customers (as in, it will error out that same customer after multiple refreshes, tries...etc). Upon lacking any information since it is client side I implemented a client side try/catch and logging system. Errors we got recorded are:

E_WC_14

 

As well as base errors of the accept.js itself such as:

ReferenceError Cant find variable Accept

AND

ReferenceError Accept is not defined

Which also seem persistent for each customer when it occurs. I can see in the log multiple entries where they attempted to submit their order multiple times and get the same error.

Currently when any of these errors occur the customer is unable to finish their order and refreshing it or multiple attempts, or even delays of hours between attempts, doesn't solve the issue. Meanwhile, it appears to be working fine for every other customer.
Are these any ways to gracefully recover from E_WC_14? Or the other errors encountered?

E_WC_14 can be read about here:
https://developer.authorize.net/api/reference/features/acceptjs.html#Appendix_Error_Codes


jarrod1937
Member
2 REPLIES 2

Also, to add here is how I am loading accept.js:

<script type="text/javascript" src="https://js.authorize.net/v1/Accept.js" charset="utf-8"></script>

And my processing functions are pretty straight forward (with a bit of extra error handling trying to figure out these issues):

						var authAcceptButtonColor;
						var authAcceptButtonName;
						function sendPaymentDataToAnet()
						{
							var authAcceptButton = document.getElementById("chkotbtn");
							
							try
							{
								authAcceptButtonColor = window.getComputedStyle(authAcceptButton, null).getPropertyValue("background-color");
								authAcceptButtonName = authAcceptButton.value;
							}
							catch(err)
							{
								authAcceptButtonColor = "#BB5600";
								authAcceptButtonName = "Place Order";
							}
							
							
							authAcceptButton.style.backgroundColor = "#757575";
							authAcceptButton.value = "Submitting...";
							var authData = {};
								authData.clientKey = "....";
								authData.apiLoginID = ".....";
								
							 var cc_val=document.getElementsByName("authorizenet_accept_cc_number")[0];
							 var cc_mon=document.getElementsByName("authorizenet_accept_cc_expires_month")[0];
							 var cc_year=document.getElementsByName("authorizenet_accept_cc_expires_year")[0];
							 var cc_name=document.getElementsByName("authorizenet_accept_cc_owner")[0];
							 var cc_cvv=document.getElementsByName("authorizenet_accept_cc_cvv")[0];
							 
							var cardData = {};
								cardData.cardNumber = cc_val.value;
								cardData.month = cc_mon.value;
								cardData.year = cc_year.value;
								cardData.cardCode = cc_cvv.value;


							var secureData = {};
								secureData.authData = authData;
								secureData.cardData = cardData;
							
							try 
							{
								Accept.dispatchData(secureData, responseHandler);
							}
							catch(err)
							{
								authAcceptButton.style.backgroundColor = authAcceptButtonColor;
								authAcceptButton.value = authAcceptButtonName;
								
								var ccerror=document.getElementById("aimccerror");
								ccerror.innerHTML = "- (FD34) An error occured with our payment service, please wait 30 seconds and try again.";
								
								reportAuthScriptError(err);
								
							}
						}
						
							

							function responseHandler(response)
							{
							
								try
								{
									var authAcceptButton = document.getElementById("chkotbtn");
									if(response.messages.resultCode === "Error")
									{
										authAcceptButton.style.backgroundColor = authAcceptButtonColor;
										authAcceptButton.value = authAcceptButtonName;
										var i = 0;

										var errorString = "";
										toggleccerror("cc_mon_div",0);
										toggleccerror("cc_year_div",0);
										while (i < response.messages.message.length) {

											if(response.messages.message[i].code == "E_WC_14")
											{
												errorString += "- Our payment processor is having technical issues, please try again later. Apologies for the inconvenience.<br/>";
												reportAuthScriptError("Submit Error: " + response.messages.message[i].code + ", " + response.messages.message[i].text);
											
											}
											else
											{
												errorString += "- " + response.messages.message[i].text + "<br/>";
												reportAuthScriptError("Submit Error: " + response.messages.message[i].code + ", " + response.messages.message[i].text);
											}

											if(response.messages.message[i].code == "E_WC_08")
											{
												toggleccerror("cc_mon_div", 1);
												toggleccerror("cc_year_div", 1);
											}

											i = i + 1;
										}

										if(i > 0)
										{
											var ccerror=document.getElementById("aimccerror");
											ccerror.innerHTML = errorString;

											var payButtonErrorCont = document.getElementById("payButEr");
											payButtonErrorCont.innerHTML = "<div style=\'float:right;width:100%;text-align:right;padding:10px;font-weight:bold;color:#cc0000;font-size:13px;\'>Issue with credit card information<br/>Please check and try again</div>";
										}
										else
										{
											reportAuthScriptError("Error state, no error.");
										}
									}
									else
									{
										paymentFormUpdate(response.opaqueData);
										var payButtonErrorCont = document.getElementById("payButEr");
										payButtonErrorCont.innerHTML = "";
									}
								}
								catch(exExtern)
								{
								
									var authAcceptButton = document.getElementById("chkotbtn");
									var ccerror=document.getElementById("aimccerror");
									ccerror.innerHTML = "- (FD85) Issue with payment processor, please try again.";
									
									authAcceptButton.style.backgroundColor = authAcceptButtonColor;
									authAcceptButton.value = authAcceptButtonName;

									var payButtonErrorCont = document.getElementById("payButEr");
									payButtonErrorCont.innerHTML = "<div style=\'float:right;width:100%;text-align:right;padding:10px;font-weight:bold;color:#cc0000;font-size:13px;\'>Issue with credit card information<br/>Please check and try again</div>";
									
									reportAuthScriptError(exExtern);
								}
						
							
								return false;
							}

						function paymentFormUpdate(opaqueData)
						{
							document.getElementById("dataDescriptor").value = opaqueData.dataDescriptor;
							document.getElementById("dataValue").value = opaqueData.dataValue;

							document.getElementsByName("authorizenet_accept_cc_owner")[0].value = "XXXXXX XXXXX";
							document.getElementsByName("authorizenet_accept_cc_number")[0].value = "XXXXXXXXXXXXXXXX";
							document.getElementsByName("authorizenet_accept_cc_expires_month")[0].value = "0";
							document.getElementsByName("authorizenet_accept_cc_expires_year")[0].value = "0";
							document.getElementsByName("authorizenet_accept_cc_cvv")[0].value = "XXX";

							var paymentForm = document.getElementsByName("checkout_address");
							paymentForm[0].submit();
						}
jarrod1937
Member

For reference here are some log entries (timestamps in ET):

Submit Error E_WC_14, Accept.js encryption failed.

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15

2020-11-16 18:33:21

Repeated 2 times before they gave up.

---------------------
ReferenceError Accept is not defined

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36 Edg/86.0.622.63

2020-11-16 15:40:15

Repeated 2 times until they gave up

--------------------
Submit Error E_WC_14, Accept.js encryption failed.

Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1

2020-11-16 15:25:23

repeated 6 times until they gave up

------------------
... and so on

I also have the IP addresses in case official support needs them for things like checking network logs. I also record their session ID that is in our system to confirm these are actual customers and not bots.

jarrod1937
Member