<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic AcceptUI responseHandler error in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-responseHandler-error/m-p/63550#M37640</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm receiving the following error when using AcceptUI (hosted mode):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Uncaught TypeError: window[s] is not a function
    at _sendRespondBackToMerchant (AcceptUI.js:1)
    at U (AcceptUI.js:1)&lt;/PRE&gt;&lt;P&gt;When you prettify the minified JS source (&lt;A href="https://jstest.authorize.net/v3/AcceptUI.js" target="_blank"&gt;https://jstest.authorize.net/v3/AcceptUI.js&lt;/A&gt;), you'll see that the code tries to find out if the responseHandler is a function or not:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;"function"==typeof s?s.call(null,t):window[s](t)&lt;/PRE&gt;&lt;P&gt;Unfortunately, the responseHandler is set as a data-attribute (data-responseHandler) on the initiating button.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;form id="paymentForm"
    method="POST"
    action="https://YourServer/PathToExistingPaymentProcessingScript"&amp;gt;
    &amp;lt;input type="hidden" name="dataValue" id="dataValue" /&amp;gt;
    &amp;lt;input type="hidden" name="dataDescriptor" id="dataDescriptor" /&amp;gt;
    &amp;lt;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"&amp;gt;Pay
    &amp;lt;/button&amp;gt;
&amp;lt;/form&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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:&amp;nbsp;&lt;SPAN&gt;The responseHandler value (regardless if set inline or by JavaScript) returns as a string no matter what in my testing:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;element.setAttribute("data-responseHandler", function() { console.log('Hello World'); });&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Will still return as "string" when using typeof.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this a bug in the AcceptUI code or is there a workaround?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 01 Jul 2018 16:28:02 GMT</pubDate>
    <dc:creator>geetfun</dc:creator>
    <dc:date>2018-07-01T16:28:02Z</dc:date>
    <item>
      <title>AcceptUI responseHandler error</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-responseHandler-error/m-p/63550#M37640</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm receiving the following error when using AcceptUI (hosted mode):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Uncaught TypeError: window[s] is not a function
    at _sendRespondBackToMerchant (AcceptUI.js:1)
    at U (AcceptUI.js:1)&lt;/PRE&gt;&lt;P&gt;When you prettify the minified JS source (&lt;A href="https://jstest.authorize.net/v3/AcceptUI.js" target="_blank"&gt;https://jstest.authorize.net/v3/AcceptUI.js&lt;/A&gt;), you'll see that the code tries to find out if the responseHandler is a function or not:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;"function"==typeof s?s.call(null,t):window[s](t)&lt;/PRE&gt;&lt;P&gt;Unfortunately, the responseHandler is set as a data-attribute (data-responseHandler) on the initiating button.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;form id="paymentForm"
    method="POST"
    action="https://YourServer/PathToExistingPaymentProcessingScript"&amp;gt;
    &amp;lt;input type="hidden" name="dataValue" id="dataValue" /&amp;gt;
    &amp;lt;input type="hidden" name="dataDescriptor" id="dataDescriptor" /&amp;gt;
    &amp;lt;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"&amp;gt;Pay
    &amp;lt;/button&amp;gt;
&amp;lt;/form&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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:&amp;nbsp;&lt;SPAN&gt;The responseHandler value (regardless if set inline or by JavaScript) returns as a string no matter what in my testing:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;element.setAttribute("data-responseHandler", function() { console.log('Hello World'); });&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Will still return as "string" when using typeof.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this a bug in the AcceptUI code or is there a workaround?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jul 2018 16:28:02 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-responseHandler-error/m-p/63550#M37640</guid>
      <dc:creator>geetfun</dc:creator>
      <dc:date>2018-07-01T16:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: AcceptUI responseHandler error</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-responseHandler-error/m-p/63747#M37796</link>
      <description>&lt;P&gt;Hi;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just ran into this. Did you get it figured out?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 16:59:13 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-responseHandler-error/m-p/63747#M37796</guid>
      <dc:creator>leehinde</dc:creator>
      <dc:date>2018-07-18T16:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: AcceptUI responseHandler error</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-responseHandler-error/m-p/63750#M37799</link>
      <description>&lt;P&gt;Here's what I found.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My callback is called:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;myNameSpace.myResponseHandler.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my button definition I had:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;" data-responseHandler='myNameSpace.myResponseHandler'&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;Based on problems with earlier versions of&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;AcceptUI that I found discussed here, I changed as follows.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;After the &lt;SPAN&gt;AcceptUI is loaded, I do this:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;window.responseHandler &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; myNameSpace.myResponseHandler; // assign my response handler to a global 'responseHandler'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;and then I changed the responseHandler call as so:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;data-responseHandler='responseHandler'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I'm not sure if responsHandler is a magic word (I'm guessing not), or if there's something about calling a nested function or who knows. But this works.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 18 Jul 2018 18:17:40 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-responseHandler-error/m-p/63750#M37799</guid>
      <dc:creator>leehinde</dc:creator>
      <dc:date>2018-07-18T18:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: AcceptUI responseHandler error</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-responseHandler-error/m-p/64957#M38707</link>
      <description>&lt;P&gt;The leehinde explanation&amp;nbsp;helped a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my case, I'm using Vue w/ Nuxt and ran accross the same issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;template.vue:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; mounted: function() {
    let accept = document.createElement("script");
    accept.setAttribute("src", "https://jstest.authorize.net/v3/AcceptUI.js");
    document.body.appendChild(accept);
    if (process.client) {
      window.checkout = this.checkout;
    }

...&amp;lt;snip&amp;gt;...

 methods:{
    checkout() {
      console.log('hello world');
    }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Nov 2018 17:28:16 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-responseHandler-error/m-p/64957#M38707</guid>
      <dc:creator>kevintechie</dc:creator>
      <dc:date>2018-11-02T17:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: AcceptUI responseHandler error</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-responseHandler-error/m-p/71594#M44100</link>
      <description>&lt;P&gt;I'm having the same problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;button code:&lt;/P&gt;&lt;P&gt;&amp;lt;form id="paymentForm"&lt;BR /&gt;method="POST"&lt;BR /&gt;action="https://YourServer/PathToExistingPaymentProcessingScript"&amp;gt;&lt;BR /&gt;&amp;lt;input type="hidden" name="dataValue" id="dataValue" /&amp;gt;&lt;BR /&gt;&amp;lt;input type="hidden" name="dataDescriptor" id="dataDescriptor" /&amp;gt;&lt;BR /&gt;&amp;lt;button type="button"&lt;BR /&gt;class="AcceptUI btn btn-primary"&lt;BR /&gt;data-billingAddressOptions='{"show":true, "required":true}'&lt;BR /&gt;data-apiLoginID="6jWN5Num7s"&lt;BR /&gt;data-clientKey="45WcsGtuZutcLj2Kfu5qx5dRk5Bb55vVcZ9GB9kzqjsqQBn3y99VA5jKX8TUKd2q"&lt;BR /&gt;data-acceptUIFormBtnTxt="Submit"&lt;BR /&gt;data-acceptUIFormHeaderTxt="Card Information"&lt;BR /&gt;data-responseHandler= "responseHandler"&amp;gt;&lt;BR /&gt;Submit For Payment&lt;BR /&gt;&amp;lt;/button&amp;gt;&lt;BR /&gt;&amp;lt;/form&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Javascript code:&lt;/P&gt;&lt;P&gt;function responseHandler(response) {&lt;BR /&gt;if (response.messages.resultCode === "Error") {&lt;BR /&gt;var i = 0;&lt;BR /&gt;while (i &amp;lt; response.messages.message.length) {&lt;BR /&gt;console.log(&lt;BR /&gt;response.messages.message[i].code + ": " +&lt;BR /&gt;response.messages.message[i].text&lt;BR /&gt;);&lt;BR /&gt;i = i + 1;&lt;BR /&gt;}&lt;BR /&gt;} else {&lt;BR /&gt;paymentFormUpdate(response.opaqueData);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, what is this:https://YourServer/PathToExistingPaymentProcessingScript?&amp;nbsp; No documentation on Authorize.net.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error I'm getting is:&amp;nbsp; window[I] is not a function..&amp;nbsp; AcceptUI.js:1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 19:16:21 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-responseHandler-error/m-p/71594#M44100</guid>
      <dc:creator>dking</dc:creator>
      <dc:date>2020-04-16T19:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: AcceptUI responseHandler error</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-responseHandler-error/m-p/73308#M45379</link>
      <description>&lt;P&gt;I am also facing this issue in React.js version&amp;nbsp;16.13.1&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Did anybody found any solution?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 13:38:48 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-responseHandler-error/m-p/73308#M45379</guid>
      <dc:creator>anush</dc:creator>
      <dc:date>2020-09-22T13:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: AcceptUI responseHandler error</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-responseHandler-error/m-p/73536#M45557</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I used this solution for React, according to solutions above and it's working for me:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;useEffect(() =&amp;gt; {&lt;BR /&gt;&amp;nbsp; window.responseHandler = responseHandler;&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope it helps!&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2020 13:44:46 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-responseHandler-error/m-p/73536#M45557</guid>
      <dc:creator>Dimitar_Terzov</dc:creator>
      <dc:date>2020-10-12T13:44:46Z</dc:date>
    </item>
  </channel>
</rss>

