<?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 Re: Bug in generated buy button in Payments Troubleshooting</title>
    <link>https://community.squareup.com/t5/Payments-Troubleshooting/Bug-in-generated-buy-button/m-p/346949#M57028</link>
    <description>&lt;P&gt;I should have said it opens the payment dialogue in a new window in the browser instead of a modal one.&lt;/P&gt;</description>
    <pubDate>Sat, 05 Mar 2022 19:04:56 GMT</pubDate>
    <dc:creator>AndyHenderson</dc:creator>
    <dc:date>2022-03-05T19:04:56Z</dc:date>
    <item>
      <title>Bug in generated buy button</title>
      <link>https://community.squareup.com/t5/Payments-Troubleshooting/Bug-in-generated-buy-button/m-p/346948#M57027</link>
      <description>&lt;P&gt;I just generated a buy button via online checkout and there's a bug in it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are two attempts to create a reference to the pay button:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On line 46:&lt;/P&gt;&lt;P&gt;const url = document.getElementById('embedded-checkout-modal-checkout-button').getAttribute('data-url');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On line 72:&lt;/P&gt;&lt;P&gt;document.getElementById('embedded-checkout-modal-checkout-button').addEventListener('click', function (e) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The button is defined on line 25 but it is not given an id.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a result, Javascript throws an error when when trying to assign the event listener. Clicking the button is then treated as a normal link which opens the payment dialogue in a new page replacing our payment page, instead of in a modal window.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is corrected by adding:&lt;/P&gt;&lt;P&gt;id="embedded-checkout-modal-checkout-button" in the a tag.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;</description>
      <pubDate>Sun, 21 Sep 2025 13:00:23 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Payments-Troubleshooting/Bug-in-generated-buy-button/m-p/346948#M57027</guid>
      <dc:creator>AndyHenderson</dc:creator>
      <dc:date>2025-09-21T13:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in generated buy button</title>
      <link>https://community.squareup.com/t5/Payments-Troubleshooting/Bug-in-generated-buy-button/m-p/346949#M57028</link>
      <description>&lt;P&gt;I should have said it opens the payment dialogue in a new window in the browser instead of a modal one.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2022 19:04:56 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Payments-Troubleshooting/Bug-in-generated-buy-button/m-p/346949#M57028</guid>
      <dc:creator>AndyHenderson</dc:creator>
      <dc:date>2022-03-05T19:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in generated buy button</title>
      <link>https://community.squareup.com/t5/Payments-Troubleshooting/Bug-in-generated-buy-button/m-p/347748#M57029</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.squareup.com/t5/user/viewprofilepage/user-id/431554"&gt;@AndyHenderson&lt;/a&gt;, thanks for flagging this here.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Sorry to hear you are running into this and for the delayed response.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Can you let me know how to set up your buy button - I'd imagine you followed the steps in &lt;A href="https://squareup.com/help/gb/en/article/7068-add-a-square-checkout-button-to-your-website#:~:text=Create%20a%20Buy%20Button,-To%20create%20a&amp;amp;text=In%20your%20online%20Square%20Dashboard,the%20Advanced%20settings%20if%20needed." target="_blank"&gt;this article&lt;/A&gt;&amp;nbsp;but I'd just like to confirm.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;From there can you please share a link to your site with the buy buttons&amp;nbsp;here so our team can take a look?&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thanks, I'll keep an eye out for your response.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 13:40:22 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Payments-Troubleshooting/Bug-in-generated-buy-button/m-p/347748#M57029</guid>
      <dc:creator>Breffni</dc:creator>
      <dc:date>2022-03-09T13:40:22Z</dc:date>
    </item>
  </channel>
</rss>

