Paypal Integration in ionic framework

Hi , All
I was working on an integration of Paypal in my new ionic framework app , Followed instructions as per the github link https://github.com/paypal/paypal-cordova-plugin#your-app-integration,But i am getting the error that
ReferenceError: PayPalMobile is not defined,
It would be great if some one can help me to resolve this issue.

Thanks in advance

do you added the plugin correctly to your project?

cordova plugin add com.paypal.cordova.mobilesdk
1 Like

yes I added the plugin through command prompt correctly,
ionic plugin add com.paypal.cordova.mobilesdk,, Then I got a folder named

  • com.paypal.cordova.mobilesdk

under plugin , and inside that folder i got 2 js files
1 .cdv-plugin-paypal-mobile-sdk
2. paypal-mobile-js-helper,
As per the this link , I referenced helper js file in index.html file after cordova.js import,But the problem is when i tried to use PayPalMobile i got the error ‘PayPalMobile is undefined

Below the code snippet.

ionic.Platform.ready(function () {

                        var clientIDs = {
                            "PayPalEnvironmentProduction": shopSettings.payPalProductionId,
                            "PayPalEnvironmentSandbox": shopSettings.payPalSandboxId
                        };
                        PayPalMobile.init(clientIDs, onPayPalMobileInit);
                    });

Thanks…

Thanks much for the replay,I am happy to let you know that the paypal integration is worked fine for me.Cheers to the spectators…

your solution or what was the problem?

I have called RenderSingleUI before initiating PayPalMobile
Thanks

Hi, im having the same problem. Can i know whether i need to follow the github steps and include the index.js? Currently i’m referring to this sample, but no luck.
http://blog.mastersoftwaresolutions.com/ionic-paypal-integration/

HI, I suggest you to refer this [link] (https://github.com/paypal/PayPal-Cordova-Plugin), It is pretty simple…And also you can use this factory

Please let me know if some other bottleneck happens again…

Thanks…

Hey! I am having the same issue, can you post your code?
Because my app do not loading PaypalMobile properly and shows that that is undefined( same as yours issue).
Thanks))

Hi, PaypalMobile will be undefined when debugging in browser , Did you debug in mobile devices, Better to debug in android emulators.I suggest you to use ADB Plugin of chrome to debug along with emulator.

Thanks…

Hi. Thank you for your reply!
I am tetsting on ionic view and ripple emulator and it even with these emulators not working. Can I launch ADB from pc not using the mobile device?
Regards!!

My big mistake was that my PayPalEnvironment wasn’t PayPalEnvironmentNoNetwork.
Thank you very match!!

yes , you can use ADB plugin in chrome in pc along with emulator,No need of mobile device to debug, but you must add the crosswalk plugin to your app to debug,after that you can debug while running in emulator,Just right click on ‘ADB plugin’ and click inspect.Just put breakpoints , don’t forget to delete the plugin when you are going to production…

Thanks

1 Like

Hi, I am getting Same issue. Please give any suggestion.

hi boss. Are you got the solution!!! please help me http://stackoverflow.com/questions/42337063/paypal-integration-with-ionic-framework-not-working

I’m out for a while man . Really sorry can’t access my laptop. On a leave

Thanks
Ahammad Ali

Thank you boss for replying. If you access your laptop please help me.

Hello Ahammad Ali

I have Follow All these instruction from this link https://github.com/paypal/PayPal-Cordova-Plugin but i have error
Uncaught ReferenceError: module is not defined at cdv-plugin-paypal-mobile-sdk.js:146

Please Please help me out this problem