<head>
<script type="text/javascript" src="https://jstest.authorize.net/v1/Accept.js" charset="utf-8"></script>
</head>
Works, however hard coding this is a really bad practice (just think if someone left the jstest url and deployed to prod!), and my Aurelia app has the ability to check which environment I'm in. So here's what I did
<head>
</head>
app.js:
addAuthNetScriptTag() {
let element = document.createElement('script')
element.charset = 'utf-8'
if (environment.debug || environment.testing) {
element.src = 'https://jstest.authorize.net/v1/Accept.js'
} else {
element.src = 'https://js.authorize.net/v1/Accept.js'
}
document.querySelector('head').appendChild(element)
}
^^^ This code puts the correct tag in the <head> element, but when I call Accept.dispatchData(), it returns the error code E_WC_14:Accept.js encryption failed. Surley there must be some way to switch CDN's based on environment.
02-16-2017 01:19 PM - edited 02-16-2017 01:20 PM
Hi @Coletrane,
I'm afraid that's a known issue with Accept.js for now. "Lazy loading", conditional loading, or anything causing the Accept.js script to be loaded after the page load will cause problems. The good news is that the fix has been made on our end, and it's just winding its way through the release process. Expect an announcement of its availability soon.
02-17-2017 08:46 AM
Just a heads up for anyone watching this thread that we've released code in sandbox that fixes the lazy loading issue and more issues brought up here, and this code should make it into the production environment within the next couple of days.
Specifically for Accept.js, there's no longer any "Access-Control-Allow-Origin" related error in the console, the accept.js script can now be loaded at any point in the workflow, and the response handler function can be passed directly in the function call instead of having to pass the name.
Of course, please let us know if anything's not working as expected!
03-07-2017 03:52 PM
Aaron, I am still getting the E_WC_14:Accept.js encryption failed error. I am including the accept.js script reference by hardcoding it on top of my file. The rest of the script is copied from your code samples. I can't beet this error no matter what I do. I read several posts claiming that with the recent new release, this error has been resolved.
Is still happens for me, though. Any suggestions?
03-15-2017 01:53 PM
Hi @msorokinecc1,
It sounds like in your case the error must be caused by something else.
Can you post the entire code you're using so that we can see if there's anything different going on there?
03-15-2017 02:03 PM
Hi All,
I am also facing this issue after hardcoding this script url in my script tag.
All code has been copied from the accept.js integration guid only.
Please help me.
04-13-2017 02:36 AM