<?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 modal not charge when change credentials, throw error E_WC_21 in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-modal-not-charge-when-change-credentials-throw-error-E/m-p/88763#M55937</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;I am making an integration on my site so that my customers can charge with authorize.&lt;BR /&gt;I have the following use case where they ask me to charge with more than one account. Then, I provide them with a selector so they can choose which account to charge with.&lt;/P&gt;&lt;P&gt;When I do this and try to charge using the AcceptUI.js library it fails, because the credentials are already loaded.&lt;/P&gt;&lt;P&gt;Then I try to delete the library and all its dependencies and then reload it, and this does not work, because it does not reload it.&lt;BR /&gt;This is the test code I implemented to see if by deleting the library and changing the credentials, I could still get paid.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;

&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Sample form&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;

    &amp;lt;button id='myButton'&amp;gt;
        Load library
    &amp;lt;/button&amp;gt;

    &amp;lt;form id="paymentForm" method="POST"&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"
            id="pay"
            class="AcceptUI"
            data-billingAddressOptions='{"show":false, "required":false}'
            data-apiLoginID="api_login_id"
            data-clientKey="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;

    &amp;lt;script type="text/javascript"&amp;gt;

        document.getElementById('myButton').addEventListener('click', loadLibrary);

        function loadLibrary() {
            deleteLibrary();

            let script = document.createElement('script');
            script.src=`https://jstest.authorize.net/v3/AcceptUI.js?t=${new Date().getTime()}`;
            script.id = 'miScript';
            document.body.appendChild(script);

            eval(script);
        }

        function deleteLibrary() {
            let scriptExists = document.getElementById('miScript');
            if (scriptExists) {
                scriptExists.parentNode.removeChild(scriptExists);

                let background = document.getElementById('AcceptUIBackground');
                if (background) {
                    background.parentNode.removeChild(background);
                }

                let container = document.getElementById('AcceptUIContainer');
                if (container) {
                    container.parentNode.removeChild(container);
                }

                let payButton = document.getElementById('pay');
                payButton.setAttribute('data-apiLoginID', 'new_api_login_id');
                payButton.setAttribute('data-clientKey', 'new_client_key');
            }
        }

        function responseHandler(response) {
            if (response.messages.resultCode === "Error") {
                var i = 0;
                while (i &amp;lt; response.messages.message.length) {
                    console.log(
                        response.messages.message[i].code + ": " +
                        response.messages.message[i].text
                    );
                    i = i + 1;
                }
            } else {
                console.log(response);
                // paymentFormUpdate(response.opaqueData);
            }
        }

        function paymentFormUpdate(opaqueData) {
            document.getElementById("dataDescriptor").value = opaqueData.dataDescriptor;
            document.getElementById("dataValue").value = opaqueData.dataValue;
            document.getElementById("paymentForm").submit();
        }
    &amp;lt;/script&amp;gt;

&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2024 16:41:36 GMT</pubDate>
    <dc:creator>ValenCardozo</dc:creator>
    <dc:date>2024-02-08T16:41:36Z</dc:date>
    <item>
      <title>AcceptUI modal not charge when change credentials, throw error E_WC_21</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-modal-not-charge-when-change-credentials-throw-error-E/m-p/88763#M55937</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I am making an integration on my site so that my customers can charge with authorize.&lt;BR /&gt;I have the following use case where they ask me to charge with more than one account. Then, I provide them with a selector so they can choose which account to charge with.&lt;/P&gt;&lt;P&gt;When I do this and try to charge using the AcceptUI.js library it fails, because the credentials are already loaded.&lt;/P&gt;&lt;P&gt;Then I try to delete the library and all its dependencies and then reload it, and this does not work, because it does not reload it.&lt;BR /&gt;This is the test code I implemented to see if by deleting the library and changing the credentials, I could still get paid.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;

&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Sample form&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;

    &amp;lt;button id='myButton'&amp;gt;
        Load library
    &amp;lt;/button&amp;gt;

    &amp;lt;form id="paymentForm" method="POST"&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"
            id="pay"
            class="AcceptUI"
            data-billingAddressOptions='{"show":false, "required":false}'
            data-apiLoginID="api_login_id"
            data-clientKey="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;

    &amp;lt;script type="text/javascript"&amp;gt;

        document.getElementById('myButton').addEventListener('click', loadLibrary);

        function loadLibrary() {
            deleteLibrary();

            let script = document.createElement('script');
            script.src=`https://jstest.authorize.net/v3/AcceptUI.js?t=${new Date().getTime()}`;
            script.id = 'miScript';
            document.body.appendChild(script);

            eval(script);
        }

        function deleteLibrary() {
            let scriptExists = document.getElementById('miScript');
            if (scriptExists) {
                scriptExists.parentNode.removeChild(scriptExists);

                let background = document.getElementById('AcceptUIBackground');
                if (background) {
                    background.parentNode.removeChild(background);
                }

                let container = document.getElementById('AcceptUIContainer');
                if (container) {
                    container.parentNode.removeChild(container);
                }

                let payButton = document.getElementById('pay');
                payButton.setAttribute('data-apiLoginID', 'new_api_login_id');
                payButton.setAttribute('data-clientKey', 'new_client_key');
            }
        }

        function responseHandler(response) {
            if (response.messages.resultCode === "Error") {
                var i = 0;
                while (i &amp;lt; response.messages.message.length) {
                    console.log(
                        response.messages.message[i].code + ": " +
                        response.messages.message[i].text
                    );
                    i = i + 1;
                }
            } else {
                console.log(response);
                // paymentFormUpdate(response.opaqueData);
            }
        }

        function paymentFormUpdate(opaqueData) {
            document.getElementById("dataDescriptor").value = opaqueData.dataDescriptor;
            document.getElementById("dataValue").value = opaqueData.dataValue;
            document.getElementById("paymentForm").submit();
        }
    &amp;lt;/script&amp;gt;

&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 16:41:36 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/AcceptUI-modal-not-charge-when-change-credentials-throw-error-E/m-p/88763#M55937</guid>
      <dc:creator>ValenCardozo</dc:creator>
      <dc:date>2024-02-08T16:41:36Z</dc:date>
    </item>
  </channel>
</rss>

