Posts: 1
Registered: ‎07-01-2018
AcceptUI responseHandler error
[ Edited ]

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 (, you'll see that the code tries to find out if the responseHandler is a function or not:


"function"==typeof s?,t):window[s](t)

Unfortunately, the responseHandler is set as a data-attribute (data-responseHandler) on the initiating button.




<form id="paymentForm"
    <input type="hidden" name="dataValue" id="dataValue" />
    <input type="hidden" name="dataDescriptor" id="dataDescriptor" />
    <button type="button"
        data-billingAddressOptions='{"show":true, "required":false}' 
        data-apiLoginID="YOUR API LOGIN ID" 
        data-clientKey="YOUR PUBLIC CLIENT KEY"
        data-acceptUIFormHeaderTxt="Card Information" 


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?


Who Me Too'd this topic