Starting a new thread on this, per Aaron's instructions from here... https://community.developer.authorize.net/t5/Integration-and-Testing/Accept-js-error-E-WC-14-Accept-...
We have customers reporting this error approximately once daily. The other 1,500(ish) daily transactions go through no problem. Due to the infrequency, I haven't been able to duplicate it on my end. Here's some code from our implementation (PHP). Let me know if there's anything else I can provide that might be helpful. Thanks!
* On the billing info page...
<script language="javascript">
function sendPaymentDataToAnet() {
if (validate_checkout_form(document.getElementById('checkout_form'))) {
var secureData = {}, authData = {}, cardData = {};
cardData.cardNumber = document.getElementById('cc_num').value;
cardData.month = document.getElementById('cc_month').value;
cardData.year = document.getElementById('cc_year').value;
secureData.cardData = cardData;
authData.clientKey = '<?php echo MERCHANT_CLIENT_KEY; ?>';
authData.apiLoginID = '<?php echo MERCHANT_LOGIN_ID; ?>';
secureData.authData = authData;
Accept.dispatchData(secureData, 'responseHandler');
}
}
function responseHandler(response) {
if (response.messages.resultCode === 'Error') {
for (var i = 0; i < response.messages.message.length; i++) {
alert("Error... "+response.messages.message[i].code + ':' + response.messages.message[i].text);
console.log(response.messages.message[i].code + ':' + response.messages.message[i].text);
}
} else {
useOpaqueData(response.opaqueData);
$("#checkout_form").submit();
}
}
function useOpaqueData(responseData) {
// This is where you would set the data descriptor & data value to be posted back to your server
console.log(responseData.dataDescriptor);
console.log(responseData.dataValue);
$("#response_data_descriptor").val(responseData.dataDescriptor);
$("#response_data_value").val(responseData.dataValue);
}
</script>
<script type="text/javascript" src="https://js.authorize.net/v1/Accept.js" charset="utf-8"></script>
* In the processing script...
require '/home/acct/vendor/autoload.php';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;
function chargeCreditCard($amount) {
// variables defined in calling script
global $auth_bill_fname, $auth_bill_lname, $auth_bill_address, $auth_bill_city, $auth_bill_state, $auth_bill_zip, $auth_bill_country;
global $auth_bill_rdd, $auth_bill_rdv;
// Common setup for API credentials
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName(MERCHANT_LOGIN_ID);
$merchantAuthentication->setTransactionKey(MERCHANT_TRANSACTION_KEY);
$refId = 'ref' . time();
// Create the payment data for a payment nonce
$opaqueData = new AnetAPI\OpaqueDataType();
$opaqueData->setDataDescriptor($auth_bill_rdd);
$opaqueData->setDataValue($auth_bill_rdv);
$paymentOne = new AnetAPI\PaymentType();
$paymentOne->setOpaqueData($opaqueData);
$order = new AnetAPI\OrderType();
$order->setDescription("New Order");
// Set the customer's Bill To address
$customerAddress = new AnetAPI\CustomerAddressType();
$customerAddress->setFirstName($auth_bill_fname);
$customerAddress->setLastName($auth_bill_lname);
$customerAddress->setCompany("");
$customerAddress->setAddress($auth_bill_address);
$customerAddress->setCity($auth_bill_city);
$customerAddress->setState($auth_bill_state);
$customerAddress->setZip($auth_bill_zip);
$customerAddress->setCountry($auth_bill_country);
//create a transaction
$transactionRequestType = new AnetAPI\TransactionRequestType();
$transactionRequestType->setTransactionType("authCaptureTransaction");
$transactionRequestType->setCustomerIP($_SERVER["REMOTE_ADDR"]);
$transactionRequestType->setAmount($amount);
$transactionRequestType->setOrder($order);
$transactionRequestType->setPayment($paymentOne);
$transactionRequestType->setBillTo($customerAddress);
$request = new AnetAPI\CreateTransactionRequest();
$request->setMerchantAuthentication($merchantAuthentication);
$request->setRefId($refId);
$request->setTransactionRequest($transactionRequestType);
$controller = new AnetController\CreateTransactionController($request);
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::PRODUCTION); // SANDBOX or PRODUCTION
return $response;
}
$authorized = false;
$pending = false;
$auth_charge_response = chargeCreditCard( $cartTotal );
if ($auth_charge_response != null) {
if($auth_charge_response->getMessages()->getResultCode() == "Ok") {
$tresponse = $auth_charge_response->getTransactionResponse();
if ($tresponse != null && $tresponse->getMessages() != null) {
$tresponse_code = $tresponse->getResponseCode();
if ($tresponse_code == 1) {
$authorized = true;
} elseif ($tresponse_code == 4) {
$pending = true;
}
} else {
if($tresponse->getErrors() != null) {
$auth_declined_reason_text = $tresponse->getErrors()[0]->getErrorText();
} else {
$auth_declined_reason_text = "unknown";
}
}
} else {
$tresponse = $auth_charge_response->getTransactionResponse();
if($tresponse != null && $tresponse->getErrors() != null) {
$auth_declined_reason_text = $tresponse->getErrors()[0]->getErrorText();
} else {
$auth_declined_reason_text = $auth_charge_response->getMessages()->getMessage()[0]->getText();
}
}
}
if( $authorized || $pending ){
// order processing code goes here
} else {
echo $auth_declined_reason_text;
}
05-04-2017 07:29 AM
Hi there,
Can you confirm that the responseHandler is not actually getting called twice? Easiest way to do this is just drop an alert() or console.write or something in there and see if there is one successful response followed immediately by one failed (E_WC_14) error.
If that is the case there a couple of things you can do, renaming the responseHandler does seem to work for many people.
Let us know,
Brian
01-23-2018 06:36 AM
Thank you for your prompt response! I truly appreciate it.
Yes, I've confirmed that the response handler is not getting called twice; I'd put alert() calls in my response handler to ensure that the execution actually stops when it's called, and the error is getting returned on the first call.
From the start, I've been using a nonstandard response handler function name, so unless the Accept.js code includes a response handler called "ALSFPaymentsAuthResponseHandler," I don't think that's the problem!
Please let me know if you'd like me to send you my code or a URL where you can see this in action!
01-23-2018 10:26 AM