Hi all,
I'm receiving the following error when using AcceptUI (hosted mode):
Uncaught TypeError: window[s] is not a function at _sendRespondBackToMerchant (AcceptUI.js:1) at U (AcceptUI.js:1)
When you prettify the minified JS source (https://jstest.authorize.net/v3/AcceptUI.js), you'll see that the code tries to find out if the responseHandler is a function or not:
"function"==typeof s?s.call(null,t):window[s](t)
Unfortunately, the responseHandler is set as a data-attribute (data-responseHandler) on the initiating button.
Example:
<form id="paymentForm" method="POST" action="https://YourServer/PathToExistingPaymentProcessingScript"> <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" data-acceptUIFormBtnTxt="Submit" data-acceptUIFormHeaderTxt="Card Information" data-responseHandler="responseHandler">Pay </button> </form>
When set using the example, the code breaks when the AcceptUI library tries to determine if it's a function or not. It always turns out as a string. FYI: The responseHandler value (regardless if set inline or by JavaScript) returns as a string no matter what in my testing:
element.setAttribute("data-responseHandler", function() { console.log('Hello World'); });
Will still return as "string" when using typeof.
Is this a bug in the AcceptUI code or is there a workaround?
07-01-2018 09:25 AM - edited 07-01-2018 09:28 AM