<?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>thread I'm getting an undefined error in the square.js file in Archived Discussions (Read Only)</title>
    <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/I-m-getting-an-undefined-error-in-the-square-js-file/m-p/657372#M92519</link>
    <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;I've implemented the square payment just like the documentation indicated and I'm getting an error when loading the page and the card section does not come up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's a Django project, hosted in AWS EC2. We do use cloudflare but I've disabled it and it still doesn't work. Works perfectly in localhost.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Uncaught (in promise) TypeError: window.Square.payments is not a function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my implementation&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;script type=&lt;SPAN class=""&gt;"text/javascript"&lt;/SPAN&gt; src=&lt;SPAN class=""&gt;"https://web.squarecdn.com/v1/square.js"&lt;/SPAN&gt;&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;!-- &lt;SPAN class=""&gt;Square&lt;/SPAN&gt; payment scripts --&amp;gt;
&amp;lt;script&amp;gt;
  &lt;SPAN class=""&gt;const&lt;/SPAN&gt; appId = &lt;SPAN class=""&gt;"{{APPID}}"&lt;/SPAN&gt;;
  &lt;SPAN class=""&gt;const&lt;/SPAN&gt; locationId = &lt;SPAN class=""&gt;"{{LOCATIONID}}"&lt;/SPAN&gt;;

   &lt;SPAN class=""&gt;document&lt;/SPAN&gt;.&lt;SPAN class=""&gt;addEventListener&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'DOMContentLoaded'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;async&lt;/SPAN&gt; &lt;SPAN class=""&gt;function&lt;/SPAN&gt; () {
    &lt;SPAN class=""&gt;if&lt;/SPAN&gt; (!&lt;SPAN class=""&gt;window&lt;/SPAN&gt;.&lt;SPAN class=""&gt;Square&lt;/SPAN&gt;) {
      &lt;SPAN class=""&gt;throw&lt;/SPAN&gt; &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;Error&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'Square.js failed to load properly'&lt;/SPAN&gt;);
    }

    &lt;SPAN class=""&gt;const&lt;/SPAN&gt; payments = &lt;SPAN class=""&gt;window&lt;/SPAN&gt;.&lt;SPAN class=""&gt;Square&lt;/SPAN&gt;.&lt;SPAN class=""&gt;payments&lt;/SPAN&gt;(appId, locationId); &lt;SPAN class=""&gt;// This is where the error is thrown&lt;/SPAN&gt;
    ...
    }&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Sat, 06 May 2023 15:20:56 GMT</pubDate>
    <dc:creator>rentovault</dc:creator>
    <dc:date>2023-05-06T15:20:56Z</dc:date>
    <item>
      <title>I'm getting an undefined error in the square.js file</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/I-m-getting-an-undefined-error-in-the-square-js-file/m-p/657372#M92519</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;I've implemented the square payment just like the documentation indicated and I'm getting an error when loading the page and the card section does not come up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's a Django project, hosted in AWS EC2. We do use cloudflare but I've disabled it and it still doesn't work. Works perfectly in localhost.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Uncaught (in promise) TypeError: window.Square.payments is not a function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my implementation&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;script type=&lt;SPAN class=""&gt;"text/javascript"&lt;/SPAN&gt; src=&lt;SPAN class=""&gt;"https://web.squarecdn.com/v1/square.js"&lt;/SPAN&gt;&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;!-- &lt;SPAN class=""&gt;Square&lt;/SPAN&gt; payment scripts --&amp;gt;
&amp;lt;script&amp;gt;
  &lt;SPAN class=""&gt;const&lt;/SPAN&gt; appId = &lt;SPAN class=""&gt;"{{APPID}}"&lt;/SPAN&gt;;
  &lt;SPAN class=""&gt;const&lt;/SPAN&gt; locationId = &lt;SPAN class=""&gt;"{{LOCATIONID}}"&lt;/SPAN&gt;;

   &lt;SPAN class=""&gt;document&lt;/SPAN&gt;.&lt;SPAN class=""&gt;addEventListener&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'DOMContentLoaded'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;async&lt;/SPAN&gt; &lt;SPAN class=""&gt;function&lt;/SPAN&gt; () {
    &lt;SPAN class=""&gt;if&lt;/SPAN&gt; (!&lt;SPAN class=""&gt;window&lt;/SPAN&gt;.&lt;SPAN class=""&gt;Square&lt;/SPAN&gt;) {
      &lt;SPAN class=""&gt;throw&lt;/SPAN&gt; &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;Error&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'Square.js failed to load properly'&lt;/SPAN&gt;);
    }

    &lt;SPAN class=""&gt;const&lt;/SPAN&gt; payments = &lt;SPAN class=""&gt;window&lt;/SPAN&gt;.&lt;SPAN class=""&gt;Square&lt;/SPAN&gt;.&lt;SPAN class=""&gt;payments&lt;/SPAN&gt;(appId, locationId); &lt;SPAN class=""&gt;// This is where the error is thrown&lt;/SPAN&gt;
    ...
    }&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 06 May 2023 15:20:56 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/I-m-getting-an-undefined-error-in-the-square-js-file/m-p/657372#M92519</guid>
      <dc:creator>rentovault</dc:creator>
      <dc:date>2023-05-06T15:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting an undefined error in the square.js file</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/I-m-getting-an-undefined-error-in-the-square-js-file/m-p/657443#M92520</link>
      <description>&lt;P&gt;Hello &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.squareup.com/t5/user/viewprofilepage/user-id/606404"&gt;@rentovault&lt;/a&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And &lt;span class="lia-unicode-emoji" title=":sparkles:"&gt;✨&lt;/span&gt;WELCOME&lt;span class="lia-unicode-emoji" title=":sparkles:"&gt;✨&lt;/span&gt; to our Seller Community, we're always excited to see new faces.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Although this is a great place to get a developer discussion started, you seem to have a specific question and there will be better chances of getting answers if you post &lt;A href="https://developer.squareup.com/forums/" target="_blank"&gt;here&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know how that goes!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 May 2023 22:49:27 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/I-m-getting-an-undefined-error-in-the-square-js-file/m-p/657443#M92520</guid>
      <dc:creator>frances_a</dc:creator>
      <dc:date>2023-05-06T22:49:27Z</dc:date>
    </item>
  </channel>
</rss>

