This is a migrated thread and some comments may be shown as answers.

PayPal plugin doen't work

10 Answers 193 Views
Android Devices
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Boyan
Top achievements
Rank 1
Boyan asked on 08 Sep 2015, 08:29 AM

I have a problem with paypal plugin for appbuider hybrid app.

I used demo app. When I try top make a payment app closed immediately.

I used following code as attach file.

 

When I try to make "paynow"

 

I used debug :

checkSimulator returns false 

after getPayment return app broken.

 

Best Regards,

B.Zhelyazkov

10 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 11 Sep 2015, 12:34 PM
Hi Boyan,

I wasn't able to crash the sample application. Using your PayPalEnvironmentSandbox ID I get an error: "payments to this merchant are not allowed" but such an error is usually displayed when you don't have a configured sandbox account in https://developer.paypal.com/. I have created a test app in the PayPal development portal, using the default settings PayPal offers - I only added a mock webhook to the app that gets created. I next created a Sandbox account. With my Client ID available under the Sandbox API credentials in the app details I was able to test the PayPal sample.

Clicking on Pay now allows me to log in PayPal using the email and password from my sandbox account (in https://developer.paypal.com/). I can then proceed to purchasing and I end up back in the sample app with an alert confirming the success of the operation. I get a response that includes the following information:
  • environment: sandbox,
  • product_name: PayPal-Android-SDK
  • response: containing the create time and id of the transaction 
  • intent: sale,
  • state: approved
  • response_type:payment

If the app crashes on your side, then I would recommend that you use the adb tool that comes with the Android SDK to examine the device logs. They should have captured the exact error causing the app to crash. If you can post that error, I might be able to provide a better insight into what is going wrong.

If by the app is broken you mean that you get an error, I would recommend that you ensure that your PayPay developer account contains a valid app and that you have properly configured your sandbox credentials. This tutorial describes the testing process in PayPal.


Regards,
Tina Stancheva
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
Artie
Top achievements
Rank 1
answered on 06 Oct 2015, 03:49 PM

Hi Tina,

I am actually having an identical issue to Boyan, except my crash is happening on an iPad.  Like you, I am also able to get the sample PayPal app to run using my own sandbox ID, so I'm currently investigating what the differences are between my application and the sample application.

I do however have the actual error message being reported by the crash, since you were asking:

<Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'​

0
Artie
Top achievements
Rank 1
answered on 06 Oct 2015, 04:05 PM

As an additional follow-up, apparently I had a typo in the keys I was setting for "clientIDs"...once I got that straightened out I was able to get past the initialization call on both devices.  I took a look at Boyan's code, and I'm not seeing this issue on his end so it appears his crash was related to something else.

The Android actually reported a "JSON Error" in the failure callback of the initialization method (which is how I found the issue), whereas the iPad simply crashed with the error above.

0
Artie
Top achievements
Rank 1
answered on 08 Oct 2015, 06:12 PM

I am now getting a crash in my app when I try to use the "PayPalMobile.renderSinglePaymentUI" method, here's what I saw in the adb logs:

 10-08 14:07:39.053    3077-3191/com.suretint.mia W/PluginManager﹕ THREAD WARNING: exec() call to PayPalMobile.renderSinglePaymentUI blocked the main thread for 88ms. Plugin should use CordovaInterface.getThreadPool().
10-08 14:07:39.116    3077-3077/com.suretint.mia D/dalvikvm﹕ GC_FOR_ALLOC freed 4407K, 45% free 9575K/17192K, paused 16ms, total 16ms
10-08 14:07:39.387    3077-3077/com.suretint.mia D/dalvikvm﹕ GC_FOR_ALLOC freed 212K, 34% free 11410K/17192K, paused 19ms, total 19ms
10-08 14:07:39.664    3077-3077/com.suretint.mia I/Choreographer﹕ Skipped 36 frames!  The application may be doing too much work on its main thread.
10-08 14:07:39.731    3077-3077/com.suretint.mia W/paypal.sdk﹕ PayPalService created. PayPalSDK/PayPal-Android-SDK 2.8.8 (Android 4.4.4; motorola XT1030; )
10-08 14:07:39.779    3077-3077/com.suretint.mia I/dalvikvm﹕ Could not find method com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable, referenced from method com.paypal.android.sdk.bA.a
10-08 14:07:39.779    3077-3077/com.suretint.mia W/dalvikvm﹕ VFY: unable to resolve static method 1950: Lcom/google/android/gms/common/GooglePlayServicesUtil;.isGooglePlayServicesAvailable (Landroid/content/Context;)I
10-08 14:07:39.779    3077-3077/com.suretint.mia D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0006
10-08 14:07:39.836    3077-3077/com.suretint.mia D/AndroidRuntime﹕ Shutting down VM
10-08 14:07:39.836    3077-3077/com.suretint.mia W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41663d40)
10-08 14:07:39.838    3077-3077/com.suretint.mia E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.suretint.mia, PID: 3077
    java.lang.RuntimeException: Unable to bind to service com.paypal.android.sdk.payments.PayPalService@424ec530 with Intent { cmp=com.suretint.mia/com.paypal.android.sdk.payments.PayPalService (has extras) }: java.lang.RuntimeException: Missing EXTRA_PAYPAL_CONFIGURATION. To avoid this error, set EXTRA_PAYPAL_CONFIGURATION in both PayPalService, and the initializing activity.
            at android.app.ActivityThread.handleBindService(ActivityThread.java:2624)
            at android.app.ActivityThread.access$1900(ActivityThread.java:139)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1297)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5097)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.RuntimeException: Missing EXTRA_PAYPAL_CONFIGURATION. To avoid this error, set EXTRA_PAYPAL_CONFIGURATION in both PayPalService, and the initializing activity.
            at com.paypal.android.sdk.payments.PayPalService.a(Unknown Source)
            at com.paypal.android.sdk.payments.PayPalService.onBind(Unknown Source)
            at android.app.ActivityThread.handleBindService(ActivityThread.java:2611)
            at android.app.ActivityThread.access$1900(ActivityThread.java:139)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1297)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5097)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)

 

I am still able to run the demo app on my device so I'm trying to figure out what the differences are but with no luck yet.  I thought I'd post this stack trace to see if you guys could find anything.

0
Artie
Top achievements
Rank 1
answered on 08 Oct 2015, 06:18 PM

Looks like this is a known issue that's been fixed in a more recent version of the plugin:

 https://github.com/paypal/PayPal-Cordova-Plugin/issues/72

 This was marked resolve in April, but the Telerik Verified version of the plugin dates back to March.  Any recommendations on what to do?

0
Artie
Top achievements
Rank 1
answered on 08 Oct 2015, 06:26 PM
Didn't read my own link very well, looks like it wasn't a "fix" it was some kind of configuration problem.  I will take another look at this.
0
Artie
Top achievements
Rank 1
answered on 08 Oct 2015, 08:40 PM

Okay, I've finally tracked down exactly what's going on.  The real problem is that on my Android device, "window.navigator.simulator" actually is undefined.  In my case I was only executing the initialization routine on window.navigator.simulator === false, once I expanded this to (window.navigator.simulator === undefined || window.navigator.simulator === false) then the initialization routine actually ran.

 This crash and subsequent adb stack trace are a result of PayPalMobile.init() never actually being run.

0
Tina Stancheva
Telerik team
answered on 09 Oct 2015, 03:41 PM
Hi Artie,

Thank you for sharing your experience. The window.navigator.simulator will only be defined when the app is running in the AppBuilder Device Simulator and you have to keep this behavior in mind when using the property.

In any case, I hope you can now successfully utilize the PayPal plugin in your project.

Regards,
Tina Stancheva
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
ranjeet
Top achievements
Rank 1
answered on 23 Nov 2015, 02:22 PM

I tried to implement paypal payment gateway in my android application and got a error :

 11-23 19:31:08.302 E/AndroidRuntime( 1573): FATAL EXCEPTION: main
11-23 19:31:08.302 E/AndroidRuntime( 1573): java.lang.RuntimeException: Unable to start service com.paypal.android.sdk.payments.PayPalService@42a4bb80 with Intent { cmp=PayPalAndroid_Example.PayPalAndroid_Example/com.paypal.android.sdk.payments.PayPalService (has extras) }: java.lang.RuntimeException: Service extras invalid.  Please check the docs.
11-23 19:31:08.302 E/AndroidRuntime( 1573):     at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2575)
11-23 19:31:08.302 E/AndroidRuntime( 1573):     at android.app.ActivityThread.access$2000(ActivityThread.java:143)
11-23 19:31:08.302 E/AndroidRuntime( 1573):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1338)
11-23 19:31:08.302 E/AndroidRuntime( 1573):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-23 19:31:08.302 E/AndroidRuntime( 1573):     at android.os.Looper.loop(Looper.java:137)
11-23 19:31:08.302 E/AndroidRuntime( 1573):     at android.app.ActivityThread.main(ActivityThread.java:4960)
11-23 19:31:08.302 E/AndroidRuntime( 1573):     at java.lang.reflect.Method.invokeNative(Native Method)
11-23 19:31:08.302 E/AndroidRuntime( 1573):     at java.lang.reflect.Method.invoke(Method.java:511)
11-23 19:31:08.302 E/AndroidRuntime( 1573):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
11-23 19:31:08.302 E/AndroidRuntime( 1573):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
11-23 19:31:08.302 E/AndroidRuntime( 1573):     at dalvik.system.NativeStart.main(Native Method)
11-23 19:31:08.302 E/AndroidRuntime( 1573): Caused by: java.lang.RuntimeException: Service extras invalid.  Please check the docs.
11-23 19:31:08.302 E/AndroidRuntime( 1573):     at com.paypal.android.sdk.payments.PayPalService.a(Unknown Source)
11-23 19:31:08.302 E/AndroidRuntime( 1573):     at com.paypal.android.sdk.payments.PayPalService.onStartCommand(Unknown Source)
11-23 19:31:08.302 E/AndroidRuntime( 1573):     at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2558)
11-23 19:31:08.302 E/AndroidRuntime( 1573):     ... 10 more

 

Can anyone please help me why this error comes, i am using xamarin.android forapp development..

Thanks

 

0
Tina Stancheva
Telerik team
answered on 26 Nov 2015, 04:05 PM
Hi Ranjit,

This issue is probably caused by the PayPal Android SDK. We found a few similar issues logged in its repository:
Both issues seems to be fixed in the latest version of the SDK. Hopefully updating it will get you back on track.

Regards,
Tina Stancheva
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
Android Devices
Asked by
Boyan
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Artie
Top achievements
Rank 1
ranjeet
Top achievements
Rank 1
Share this question
or