Showing results for 
Search instead for 
Did you mean: 

PSA: PayPal JavaScript Buttons + VSCode + Chrome Debug Mode, PayPal Smart Buttons Do Not Work

Posted on

Hello, I am posting to raise awareness of an issue that has cost me some time. Using the PayPal JavaScript "smart buttons", if one is using VSCode with chrome debug tools and the browser is launched as a debugging session, the PayPal smart buttons do not work. OK, sometimes they work, but most of the times they do not. 

After spending hours presume there is an error in my code on the page that the buttons are placed, it turns out that the code is not the issue. I can confirm that by making a new HTML page, and follow the documentation to put those smart buttons on the page, and it doesn't work. 

By "doesn't work", here is what I mean. The expected behavior is that when the user clicks one of the PayPal buttons, the page should go slightly dark and have the PayPal message in the center regarding the popup window, then (or almost immediately) the paypal popup should come up and allow the user to login to their PayPal. 

 But what happens instead, is the page does not go dark at all, and the PayPal popup opens but never finishes its initialization. A spinner will appear for about 10 seconds, and then the popup closes. In the console log in the browser, one will see a number of ERROR events indicating that "no response was found for" etc. 

After many hours trying to get this to work, in the end the way I "fixed" this is to either use Chrome but not in debug mode and connected to VSCode as a debugger, or to use Firefox.  Firefox works fine even in debug mode etc. 

It is worth mentioning that the integration I am working on is dealing with subscriptions, not product checkout. So it is possible the issue I have hit is only hit when working with subscriptions. Though I doubt that is the case. 

It would have saved me some time and headache if I had known this, and hence why I am posting it here. 

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.