Connect To PayPal script failed to show the button on recent websites built.

sean_z
Contributor
Contributor

We have used Connect To PayPal to build our websites for 4 years, and built dozens of websites successfully.

Recently we observed that our websites stopped showing the button.

The issue is inconsistent, however. One run on browser could show the button, and next run could fail.

When it failed, it failed on this line: paypal.use( ['login'], function (login) {

When it is successful, https://www.paypalobjects.com/js/external/connect/login.js is happily loaded.

When it failed, https://mywebsite.com/mywebapp/login.js is loaded, and would surely fail.

We used other tracking scripts such as Google Tag Manager, Osano. If we removed those other tracking scripts, the problem would be gone. However, our business mandated that we use them. Please help!


<span id='cwppButton'></span>
<script src='https://www.paypalobjects.com/js/external/connect/api.js'></script>
<script>
paypal.use( ['login'], function (login) {
login.render ({
"appid":"MyPayPalClientID",
"authend":"sandbox",
"scopes":"profile address email https://uri.paypal.com/services/paypalattributes",
"containerid":"cwppButton",
"responseType":"code",
"locale":"en-us",
"buttonType":"CWP",
"buttonShape":"pill",
"buttonSize":"lg",
"returnurl":"MyPayPalReturnURL"
});
});
</script>

 

Login to Me Too
1 ACCEPTED SOLUTION

Accepted Solutions
Solved

sean_z
Contributor
Contributor

Just in case anybody care, I solved the issue myself. I updated the following line:

<script src='https://www.paypalobjects.com/js/external/connect/api.js'></script>

to

<script id="paypal-api" src='https://www.paypalobjects.com/js/external/connect/api.js'></script>

View solution in original post

Login to Me Too
1 REPLY 1
Solved

sean_z
Contributor
Contributor

Just in case anybody care, I solved the issue myself. I updated the following line:

<script src='https://www.paypalobjects.com/js/external/connect/api.js'></script>

to

<script id="paypal-api" src='https://www.paypalobjects.com/js/external/connect/api.js'></script>

Login to Me Too

Haven't Found your Answer?

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