Bug in generated buy button

I just generated a buy button via online checkout and there's a bug in it.

 

There are two attempts to create a reference to the pay button:

 

On line 46:

const url = document.getElementById('embedded-checkout-modal-checkout-button').getAttribute('data-url');

 

On line 72:

document.getElementById('embedded-checkout-modal-checkout-button').addEventListener('click', function (e) {

 

The button is defined on line 25 but it is not given an id.

 

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.

 

The problem is corrected by adding:

id="embedded-checkout-modal-checkout-button" in the a tag.

 

Andy

579 Views
Message 1 of 3
Report
2 REPLIES 2

I should have said it opens the payment dialogue in a new window in the browser instead of a modal one.

578 Views
Message 2 of 3
Report
Square

Hey @AndyHenderson, thanks for flagging this here. 

 

Sorry to hear you are running into this and for the delayed response. 

 

Can you let me know how to set up your buy button - I'd imagine you followed the steps in this article but I'd just like to confirm. 

 

From there can you please share a link to your site with the buy buttons here so our team can take a look? 

 

Thanks, I'll keep an eye out for your response. 

 

 

Breffni
Community Moderator, Ireland, Square
Sign in and click Mark as Best Answer if my reply answers your question

After a wonderful three years supporting the Seller Community, I've moved teams!
Check out article "A Contact Guide to the Seller Community" to reach out to current Seller Community Moderators.
Thank you for all the memories and connections—here’s to new adventures! 
558 Views
Message 3 of 3
Report