I am testing our integration with authorize.net. I have two test accounts on sandbox.authorize.net (one for USD and one for GBP).
I am using the https://jstest.authorize.net/v1/Accept.js library for our testing.
In my testing the Accept.dispatchData method returns the E_WC_21 error even with a valid API login and public client key.
I've double checked against the accounts on sandbox.authorize.net.
I generated a new public client key and tried that but I am getting the same error.
Does it take a while for a new public client key to become "live"?
Thanks,
Brad
Solved! Go to Solution.
12-20-2017 03:38 PM
Hi @Madeleine
Have you seen the Accept sample app at https://github.com/AuthorizeNet/accept-sample-app
It does has example of using AcceptUI.js .
Hope it helps !!
02-07-2018 06:16 PM
Hello
That is a great example but it is in php and it is way more than I need to do - I will need that sort of example once I get past my problems
I need the simplest form ever!
The example on the page says you can even get the token back in pure html - well I am so stuck with out the token I cannot for forward.
All I want is the token back and I am getting an error -
E_WC_21: User authentication failed due to invalid authentication values.
02-08-2018 06:03 PM
The authentication data object includes only two values, your API Login ID and the Public Client Key.
The simplest example is below:
<script type="text/javascript" src="https://jstest.authorize.net/v3/AcceptUI.js" charset="utf-8"> </script> <form id="paymentForm" method="POST" action="https://YourServer/PathToYourPaymentProcessingScript"> <input type="hidden" name="dataValue" id="dataValue" /> <input type="hidden" name="dataDescriptor" id="dataDescriptor" /> <button type="button" class="AcceptUI" data-billingAddressOptions='{"show":true, "required":false}' data-apiLoginID="YOUR API LOGIN ID" data-clientKey="YOUR PUBLIC CLIENT KEY : 64 byte string" data-acceptUIFormBtnTxt="Submit" data-acceptUIFormHeaderTxt="Card Information" data-responseHandler="responseHandler">Pay </button> </form> <script type="text/javascript"> function responseHandler(response) { if (response.messages.resultCode === "Error") { var i = 0; while (i < response.messages.message.length) { console.log( response.messages.message[i].code + ": " + response.messages.message[i].text ); i = i + 1; } } else { paymentFormUpdate(response.opaqueData); } } function paymentFormUpdate(opaqueData) { document.getElementById("dataDescriptor").value = opaqueData.dataDescriptor; document.getElementById("dataValue").value = opaqueData.dataValue; document.getElementById("paymentForm").submit(); } </script>
In the above example, your Sandbox credentials would apply. Once the lightbox payment form is submitted, the dataValue input is auto-populated with the token and submitted to your payment processing script.
<input type="hidden" name="dataValue" id="dataValue" value="eyJjb2XXX...">
To test, login to the Sandbox, get your API Login ID and the Public Client Key and replace the placeholder values in the JavaScript above.
02-09-2018 03:52 AM - edited 02-09-2018 04:01 AM
Hello
I do understand- I have read that doc over and over - I have tried that - exactly that see below with exactly the string for ID and KEY that test successfully.see below. What else could be wrong? still get error...Screen is working - does it all returns E_WC_21: User authentication failed due to invalid authentication values.
Thank you please help
<!DOCTYPE html> <html> <!-- This file is a standalone HTML page demonstrating usage of the Authorize.net Accept JavaScript library using the integrated payment information form. For complete documentation for the Accept JavaScript library, see https://developer.authorize.net/api/reference/features/acceptjs.html --> <head> <title>Sample form</title> </head> <script type="text/javascript" src="https://jstest.authorize.net/v3/AcceptUI.js" charset="utf-8"> </script> <form id="paymentForm" method="POST" action="https://YourServer/PathToYourPaymentProcessingScript"> <input type="hidden" name="dataValue" id="dataValue" /> <input type="hidden" name="dataDescriptor" id="dataDescriptor" /> <button type="button" class="AcceptUI" data-billingAddressOptions='{"show":true, "required":false}' data-apiLoginID="MYID" data-clientKey="9aptdYwtHt2F22XLRgr4B9AM4Pkt5eb6b6MC9d2Nn3m3YEptx3RFFuXmpYWDLHev" data-acceptUIFormBtnTxt="Submit" data-acceptUIFormHeaderTxt="Card Information" data-responseHandler="responseHandler">Pay </button> </form> <script type="text/javascript"> function responseHandler(response) { if (response.messages.resultCode === "Error") { var i = 0; while (i < response.messages.message.length) { console.log( response.messages.message[i].code + ": " + response.messages.message[i].text ); i = i + 1; } } else { paymentFormUpdate(response.opaqueData); } } function paymentFormUpdate(opaqueData) { document.getElementById("dataDescriptor").value = opaqueData.dataDescriptor; document.getElementById("dataValue").value = opaqueData.dataValue; document.getElementById("paymentForm").submit(); } function paymentFormUpdate(opaqueData) { document.getElementById("dataDescriptor").value = opaqueData.dataDescriptor; document.getElementById("dataValue").value = opaqueData.dataValue; // If using your own form to collect the sensitive data from the customer, // blank out the fields before submitting them to your server. // document.getElementById("cardNumber").value = ""; // document.getElementById("expMonth").value = ""; // document.getElementById("expYear").value = ""; // document.getElementById("cardCode").value = ""; document.getElementById("paymentForm").submit(); } </script>
<?xml version="1.0" encoding="utf-8"?>
<getMerchantDetailsResponse xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<messages>
<resultCode>Ok</resultCode>
<message>
<code>I00001</code>
<text>Successful.</text>
</message>
</messages>
<isTestMode>false</isTestMode>
<processors>
<processor>
<name>First Data Nashville</name>
</processor>
</processors>
<merchantName>fwHGwSdCaR</merchantName>
<gatewayId>565697</gatewayId>
<marketTypes>
<marketType>eCommerce</marketType>
</marketTypes>
<productCodes>
<productCode>CNP</productCode>
</productCodes>
<paymentMethods>
<paymentMethod>AmericanExpress</paymentMethod>
<paymentMethod>DinersClub</paymentMethod>
<paymentMethod>Discover</paymentMethod>
<paymentMethod>EnRoute</paymentMethod>
<paymentMethod>JCB</paymentMethod>
<paymentMethod>Mastercard</paymentMethod>
<paymentMethod>Visa</paymentMethod>
</paymentMethods>
<currencies>
<currency>USD</currency>
</currencies>
<publicClientKey>9aptdYwtHt2F22XLRgr4B9AM4Pkt5eb6b6MC9d2Nn3m3YEptx3RFFuXmpYWDLHev</publicClientKey>
</getMerchantDetailsResponse>
02-09-2018 01:43 PM
Where are you getting the error? In that XML response you posted, the response is successful.
If you are getting the error when including https://js.authorize.net/v3/AcceptUI.js instead of https://jstest.authorize.net/v3/AcceptUI.js, the production endpoint requires seperate production login credentials.
02-09-2018 01:50 PM
Hello
I am getting the error in the console so the form will not go to submit- I get no token..
E_WC_21: User authentication failed due to invalid authentication values.
When I use the TRY it in this page URL it WORKS I give you the results, so I have the correct IDs and KEYS.
https://developer.authorize.net/api/reference/#transaction-reporting-get-merchant-details
I am asking the client to regenerate the public Client Key could it be old or something- as you can see I am using the example:
<script type="text/javascript" | |
src="https://jstest.authorize.net/v3/AcceptUI.js" | |
charset="utf-8"> | |
</script> |
02-09-2018 01:59 PM
I got grumpy and made my own sandbox and public key and it works now-
That old public client key was old or something?
So I will have to get this client to regenerate thier keys.
The public client key will not impact anything else. They are very nervous.
Thanks I am not a dork thanks! Moving on now ..
02-09-2018 02:27 PM
I solved this by changing my script source from
src="https://jstest.authorize.net/v3/AcceptUI.js"
to
src="https://js.authorize.net/v3/AcceptUI.js"
Probably wont help everyone but if you're sure your codes are good, maybe this is the issue.
10-25-2019 10:15 AM