Reply
Highlighted
Member
Posts: 5
Registered: ‎12-16-2017

Accept.JS with Hosted Payment Form. Error E_WC_21

Hello!
I'm using Accept.JS with Hosted Payment Form.
Looks like it works fine. but only in test mode. When I'm trying to switch off test mode at merchant interface, I'm receiving an error "E_WC_21: User authentication failed due to invalid authentication values."
I switched off test mode here: Settings -> Security Settings -> Test Mode
No, I didn't forget to change library link from https://jstest.authorize.net/v3/AcceptUI.js to https://js.authorize.net/v3/AcceptUI.js
I've tried to regenerate Public Client Key here Account > Settings > Security Settings > General Security Settings > Manage Public Client Key.

Also, I've tried to create a new Authorize.net sandbox account, it didn't help.

 

My code is:

 

<form id="paymentForm"
      method="POST"
      action="">
	<input type="hidden" name="dataValue" id="opaqueDataValue" />
	<input type="hidden" name="dataDescriptor" id="opaqueDataDescriptor" />

	<input type="hidden" name="payment_provider" value="OmnipayAuthorizeNETAPI"/>

			<input type="hidden" name="tariff_id" value="1" />
	
	
	<button class="AcceptUI btn commonBTN"
	        data-billingAddressOptions='{"show":true, "required":true}'
	        data-apiLoginID="7b3U8pQV8"
	        data-clientKey="599UsQ9n3Hb2GtBcMCnh2fZx785Wb83FWfdVQ8d5Q7naQN6fJam55Qt74rHX5R4V"
	        data-acceptUIFormBtnTxt="Pay"
	        data-acceptUIFormHeaderTxt="Card Information"
	        data-paymentOptions='{"showCreditCard": true, "showBankAccount": false}'
	        data-responseHandler="responseHandler">Pay</button>
</form>
<script type="text/javascript"
        src="https://js.authorize.net/v3/AcceptUI.js"
        charset="utf-8">\
</script>
<script type="text/javascript">
	function responseHandler(response) {
		if (response.messages.resultCode === "Error") {
			var i = 0;
			while (i < response.messages.message.length) {
				alert(
					response.messages.message[i].code + ": " +
					response.messages.message[i].text
				);
				i = i + 1;
			}
		} else {
			paymentFormUpdate(response.opaqueData);
		}
	}
	function paymentFormUpdate(opaqueData) {
		console.log(opaqueData);
		document.getElementById("opaqueDataDescriptor").value = opaqueData.dataDescriptor;
		document.getElementById("opaqueDataValue").value = opaqueData.dataValue;
		document.getElementById("paymentForm").submit();
	}

	$(document).ready(function () {

	});

</script>

 

At test mode everything is okay, and I can recieve opaqueData and do a purchase.

 

Any help are really appreciate! Thanks!