01-08-2021 06:32 AM
CORS issue on requests made within responseHandler. When trying to make an api call to submit the payment token generated from the hosted fields AcceptCore.js, it will trigger CORS issues sometimes.
The issue seems to happen on and off. It works for some time, but then will stop working. Given its inconsistency we cannot isolate the reason it is happening.
Our implmentation uses hosted fields to generate a token, which is sent through api call to our backend where it is used to create a payment intent. However once we make the call to our backend (ajax request) we get a CORS issue before the request is made. At first glance it would seem it comes from our backend, but it does not actually hit our server and it is isolated to only within the responseHandler function defined for the hosted fields.
It seems related to this issue back in 2017 https://community.developer.authorize.net/t5/Integration-and-Testing/Accept-js-Exceptions-regarding-...
Like noted in that post, it sometimes works, it sometimes does not and without any code changes on our end. We use webpack which also makes it difficult to manipulate the window object like noted in the post, in that same post it was also noted that the issue was fixed a couple years ago though.
So right now we don't have much we can do to stabilize the integration, we are hoping we can get direction on what is happening and how to ensure it does not happen at all, not just sometimes.
Does anyone know a way to prevent this from happening at all? Since we cannot predict when it will work and when it will not, it is currently impossible for us to figure this out through trial and error without reverse engineering the AcceptCore.js code.