paypal / here-sideloader-api-samples

Sideloader API samples that enable to integrate PayPal Here into other apps
Other
24 stars 32 forks source link

Android crash on all paypalhere:// URLs #39

Closed shankie-codes closed 8 years ago

shankie-codes commented 8 years ago

I'm building a React Native app that processes payments in PayPal Here. Unfortunately Here is crashing regardless of what URL I send it, regardless whether it's a full invoice or simply paypalhere://takepayment. I'm a flummoxed as I've tried it on two devices and I refuse to believe that the API doesn't work at all! I also can't see how it would be anything to do with React Native as it's simply sending a URL.

This seems to be similar to #28 , but not exactly the same as I'm having crashes on first payment (where #28 seems to only be on consecutive payments.

I'm using PayPal here 2.6.1 and a two Android devices, one running 4.4 and one running 5.0.

Any help very much appreciated!

lernerb commented 8 years ago

What's the stack trace?

Sent from my iPhone

On Jan 17, 2016, at 4:41 PM, shankiesan notifications@github.com wrote:

I'm building a React Native app that processes payments in PayPal Here Unfortunately Here is crashing regardless of what URL I send it, regardless whether it's a full invoice or simply paypalhere://takepayment I'm a flummoxed as I've tried it on two devices and I refuse to believe that the API doesn't work at all! I also can't see how it would be anything to do with React Native as it's simply sending a URL

This seems to be similar to #28 , but not exactly the same as I'm having crashes on first payment (where #28 seems to only be on consecutive payments

I'm using PayPal here 261 and a two Android devices, one running 44 and one running 50

Any help very much appreciated!

— Reply to this email directly or view it on GitHub.

djMax commented 8 years ago

Would he have the stack trace for PPH? Either way, can you give us a full URL that causes it?

lernerb commented 8 years ago

If it's a library issue (ex. New google play services) the stack might show. Does your app use google play services? If so what version are you running?

The full url that causes the crash would also be helpful in debugging it, as max pointed out.

On Sunday, January 17, 2016, Max Metral notifications@github.com wrote:

Would he have the stack trace for PPH? Either way, can you give us a full URL that causes it?

— Reply to this email directly or view it on GitHub https://github.com/paypal/here-sideloader-api-samples/issues/39#issuecomment-172394300 .

Sent from Gmail Mobile

shankie-codes commented 8 years ago

Thanks for chipping in, guys.

I'm new-ish to native dev so I don't know how to get a stack trace – it certainly doesn't show on-screen. My app isn't using Google Play Services as far as I know. It's a really basic payment-kiosk service.

The app crashes on both my 'proper' URL:

paypalhere://takePayment?&returnUrl=http%3A%2F%2Fwww.example.com%3F%7Bresult%7D%3FType%3D%7BType%7D%26InvoiceId%3D%7BInvoiceId%7D%26Tip%3D%7BTip%7D%26Email%3D%7BEmail%7D%26TxId%3D%7BTxId%7D&as=b64&step=choosePayment&invoice=%7B%22merchantEmail%22%3A%22bookings@example.com%22%2C%22itemList%22%3A%7B%22item%22%3A%5B%7B%22name%22%3A%22donation%22%2C%22description%22%3A%22donation%22%2C%22quantity%22%3A%221.0%22%2C%22unitPrice%22%3A3%2C%22taxName%22%3A%22Tax%22%2C%22taxRate%22%3A%220%22%7D%5D%7D%2C%22currencyCode%22%3A%22GBP%22%2C%22paymentTerms%22%3A%22DueOnReceipt%22%2C%22discountPercent%22%3A%220.0%22%7D

and just a simple test URL of:

paypalhere://takePayment

Thanks!

lernerb commented 8 years ago

Can you set up the start of your android sideload with paypalhere://takePayment/v2? instead of paypalhere://takePayment? and let us know if it still crashes?

On Mon, Jan 18, 2016 at 4:38 AM, shankiesan notifications@github.com wrote:

Thanks for chipping in, guys.

I'm new-ish to native dev so I don't know how to get a stack trace – it certainly doesn't show on-screen. My app isn't using Google Play Services as far as I know. It's a really basic payment-kiosk service.

The app crashes on both my 'proper' URL:

paypalhere://takePayment?&returnUrl=http%3A%2F%2Fwww.example.com %3F%7Bresult%7D%3FType%3D%7BType%7D%26InvoiceId%3D%7BInvoiceId%7D%26Tip%3D%7BTip%7D%26Email%3D%7BEmail%7D%26TxId%3D%7BTxId%7D&as=b64&step=choosePayment&invoice=% 7B%22merchantEmail%22%3A%22bookings@example.com %22%2C%22itemList%22%3A%7B%22item%22%3A%5B%7B%22name%22%3A%22donation%22%2C%22description%22%3A%22donation%22%2C%22quantity%22%3A%221.0%22%2C%22unitPrice%22%3A3%2C%22taxName%22%3A%22Tax%22%2C%22taxRate%22%3A%220%22%7D%5D%7D%2C%22currencyCode%22%3A%22GBP%22%2C%22paymentTerms%22%3A%22DueOnReceipt%22%2C%22discountPercent%22%3A%220.0%22%7D

and just a simple test URL of:

paypalhere://takePayment

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/paypal/here-sideloader-api-samples/issues/39#issuecomment-172476763 .

Brandon Lerner

shankie-codes commented 8 years ago

Thanks for the suggestion @lernerb but unfortunately it still crashes.

Any other suggestions?

Do you guys have a test app that I can pull and try to make sure that it's not a device specific problem? I don't think it is (as I've tried on two versions of Android on two different devices), but I just want to be sure.

lernerb commented 8 years ago

The test app is located @ https://github.com/paypal/here-sideloader-api-samples/tree/master/android/v2, which runs a sideload with a native android app.

shankie-codes commented 8 years ago

Ok, so the test app works. That's made me go re-investigate my code and it looks like:

paypalhere://takePayment/v2? does work, but my full URL causes it to crash. It looks like I've got some bum data in my URL. I'll be able to sort that out, I hope.

Any idea why a bad URL causes it to crash? Perhaps that could be handled a little more elegantly. I'm happy to provide a crashing URL if you'd like!

I realise now that it is out of date, but it might also be worth seeing if @SeraphimSerapis can update his original blog post explaining the API as it still has the v1 URLs (which might be where I've gone wrong).

lernerb commented 8 years ago

Just as a quick test, can you try changing the tax rate to a non-zero rate in your invoice and see if it still crashes? I'll send a message to @SeraphimSerapis and have him redirect to the side-loader documentation. Thanks.

"taxName":"Tax","taxRate":"0"

shankie-codes commented 8 years ago

Same thing, I'm afraid!

I'll try building up the URL bit by bit this weekend and let you know how I get on. When I find out what kills it, I'll post back here!

shankie-codes commented 8 years ago

Hi guys, finally got around to squashing this.

The problem was the &as=b64 component of the URL – removed this and it works!