Connect with PayPal race condition, `login.render is not a function`
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using the code snippet from the connect with PayPal tutorial (link) to add a "log in with PayPal" button on my site, the basic code is here:
paypal.use( ['login'], function (login) {
login.render ({ ... });
});
I'm encountering some kind of race condition about 1/10 page loads and get a `login.render is not a function` error. It looks like the `use(['login'])` call dynamically adds the login library to the header. Obviously the callback is not working as expected, and somehow `login.render` is being called before the library is loaded.
Has anyone run into a similar issue? I tried loading the login library separately so I would have it on page load and that would not work for me either.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The issue came from a global variable naming conflict with another library. My site also uses the Amplitude SDK (link) which uses some of the same variable names as PayPal. It seems that, at the moment, these 2 libraries cannot be used together. Staggering when they are loaded or loading in a specific order will not fix.
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Add Others data in SDKs
- I want to implement subscription functionality. in REST APIs
- Change the button from Sandbox to Production in REST APIs
- Issue with Rendering Trustly Payment Button via PayPal JavaScript SDK in SDKs
- When I do PayPal capture Order, I keep on getting Invalid Request Connection in REST APIs