Javascript issue inside PayPal's apdg.js: Cannot read property 'apps' of undefined
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I'm posting here because I'm getting a TypeError from a PayPal Javascript file, remotely included into a website.
In our cart page (site under testing and not public at the moment) we reference, using the script tag, https://www.paypalobjects.com/js/external/apdg.js.
There seems to be a Javascript error in this script file. A TypeError is thrown.
Below is a screenshot. I placed a breakpoint at line twenty-two, and it seems that Javascript is hoisting the variable PAYPAL before window.PAYPAL is set, with window.PAYPAL being correctly initialised and the locally scoped, hoisted, PAYPAL is, if I'm correct, undefined - hence the error.
I'm running:
Chrome Version 67.0.3396.87 (Official Build) (64-bit)
Everything's been working fine until I noticed this error, I believe last time this worked would be a month ago or more.
We are using sandbox PayPal Chained Payments, with a sandbox AU business account. But this issue occurs before checkout can proceed.
Not sure if this technology is now deprecated, or the June security tests affect it, and hope this is the correct forum.
Thank you kindly
Leo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Leo,
Hope you're doing well. I'm facing similar issues with embedded adaptive payments. I reached support yesterday and they told me that the lightbox is no longer supported. I'm trying to get the 'mini' flow to work but I ran into this issue. Here are some things I've tried out:
- For some reason if I use the JS functions for the lightbox, it works a little better for the 'mini-browser', however the popup window shows a different style than before. For example, using 'dg.js' and initializing the object like this:
let embeddedPPFlow = new PAYPAL.apps.DGFlow({expType: 'mini', trigger: 'submitBtn'});
Opens up a popup and a mini-browser. In order for this to work I downloaded 'dg.js' and set line 3 to false. This also needs to be done on 'apdg.js'fullpageRedirect = false;
- For 'apdg.js' to work, I had to replicate the PAYPAL object declaration similar to 'dg.js', however using 'apdg.js' does show the mini browser but it doesn't show the popup window.
if (typeof PAYPAL == 'undefined' || !PAYPAL) {
let PAYPAL = {};
}
window.PAYPAL = window.PAYPAL || {};
PAYPAL.apps = PAYPAL.apps || {};
I hope this helps you out a bit. Good Luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I have no idea why my previous reply was rejected. Here I go again. I'll just copy/paste.
-----------------------------------------------------------------------------
Hi Leo,
Hope you're doing well. I'm facing similar issues with embedded adaptive payments. I reached support yesterday and they told me that the lightbox is no longer supported. I'm trying to get the 'mini' flow to work but I ran into this issue. Here are some things I've tried out:
- For some reason if I use the JS functions for the lightbox, it works a little better for the 'mini-browser', however the popup window shows a different style than before, I added a photo at the end so you can see what I mean. For example, using 'dg.js' and initializing the object like this:
let embeddedPPFlow = new PAYPAL.apps.DGFlow({expType: 'mini', trigger: 'submitBtn'});
Opens up a popup and a mini-browser (image at the end). In order for this to work I downloaded 'dg.js' and set line 3 to false. This also needs to be done on 'apdg.js'. If not then any trigger on the flow will redirect instead of open the embedded window.fullpageRedirect = false;
- For 'apdg.js' to work, I had to replicate the PAYPAL object declaration similar to 'dg.js', however using 'apdg.js' does show the mini browser but it doesn't show the popup window.
if (typeof PAYPAL == 'undefined' || !PAYPAL) { let PAYPAL = {}; } window.PAYPAL = window.PAYPAL || {}; PAYPAL.apps = PAYPAL.apps || {};
I hope this helps you out a bit. Good Luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No worries, glad I could help. Quick question though, were you able to get the 'mini' working? I do get it to show however I get the full page inside the mini instead of the embedded style. User won't know to scroll sideways to log-in.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
same issue you had. It brings up the full window inside the dialog box. Though, we have 2 sites basically integrated into our site. One is using the paypalobjects.com/.../dg.js and the other is using a local copy of some paypal code that is different. The one using the dg.js does not work as mini, it goes to the full page view. The one using I think somewhat newer paypal code, behaves the same as yours. The dialog does come up, but with a full page enclosed in it.
Will update here if we get any progress on this. We are connecting with them also on a direct support event.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you heard anything back from PayPal regarding this issue?
Also has anyone found a way to get the PayPal mini browser to stop displaying in the full page view?
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Need merchant logo in Paypal checkout page. in SDKs
- Capture API call issue- Undefined property admin_area_1 in REST APIs
- TypeError: Cannot read property "phone_number" from undefined in REST APIs
- Different errors with the Paypal Advanced credit debit card payment in REST APIs
- Vue integration gives "TypeError: Cannot read properties of undefined (reading 'component')" in Sandbox Environment