paypal / paypal-retail-node

A module and midtier server to help integrate mobile applications with the PayPal Retail SDK
16 stars 32 forks source link

Return URL #2

Closed hamidsani closed 8 years ago

hamidsani commented 8 years ago

I'm trying to add paypal here sdk to my android app and wanted to use this on heroku as mid-tier server. Now i'm a bit confused as the whole process works and some clarification on the variables would be greatly appreciated. Just to double check I have root url set to the heroku server address (http://example.herokuapp.com), the APP_REDIRECT_URL is set to (appname://ouath). Then I created an app in the paypal developer websites and set the return url to heroku server address (http://example.herokuapp.com).

With these parameters my app tries to login and gets the following error "Relying Party Validation error: redirect_url provided in the request.." I assume that is caused by the redirect and return url matching but I don't exactly understand how that works. I know normally in a webapp the return url would point to a webpage but I how would take work on an android app?

djMax commented 8 years ago

The return url has to be the full URL that PayPal will call, i.e.:

Note: You MUST set the redirect URL of your app on developer.paypal.com to match the server to which you deploy the paypal-retail-node code with the path /returnFromPayPal appended. For example, if you've deployed to http://pph-retail-node.herokuapp.com, the return URL MUST be set to http://pph-retail-node.herokuapp.com/returnFromPayPal

djMax commented 8 years ago

Also note it can take a few hours to take effect, so don't worry if it doesn't work right after the change (apologies that this is the case - you could create a new app if that works for you). This server (paypal-retail-node server) will redirect to APP_REDIRECT_URL after doing it's job converting the auth code to an access token and refresh url, so that's where your app comes into play.

hamidsani commented 8 years ago

Awesome. I'm pretty sure that was the issue. I made the changes and now I'm waiting until the changes take into place. I'll try it out tonight and let you know if this did the trick. Thanks for the fast response.

hamidsani commented 8 years ago

@djMax I couldn't get that to work. For the past month I've been using the web signing page comes with the sample paypal here app. Here are the settings that I have:

Result is "Login with PayPal Error! invalid_scope: Client Validation Error: Invalid scope." Even when I access the same url through the web as well. I would really appreciate it if you could tell me what I am doing wrong. Thanks

djMax commented 8 years ago

That would suggest that a scope you need is missing from your app on the PayPal developer page. Is "PayPal Here" checked there? Do you get a "correlationId" or "debugId" along with that error?

hamidsani commented 8 years ago

It gives me absolutely no other ID and paypal here is checked inside my app. I'm attaching pictures just in case.

Another question, the name of the app created in paypal developer has nothing to do with the package name or the actual name of my app, does it? capture screenshot_20151203-163948

hamidsani commented 8 years ago

So I just read the readme file on the retail node github page and I noticed that there are first and third party uses of this node. What I am interested in is the first party where I log in once and then I receive a modified refresh token that stays valid until I disable it. I don't know if that changes anything. Made me a bit confused for sure cause I don't know if that's any different now. Do I not need an APP_REDIRECT_URL anymore?

hamidsani commented 8 years ago

Found the issue finally. So just in case someone else had the same issue as me, you need to make sure that the information that the android app is requesting matching what your paypal server app is providing. You can do this by going to paypal developer website, my apps & credentials, click on your app, click on advanced options on Log in with paypal, make sure that Full name is checked under Personal information, and all items under Address information is checked, add a privacy policy URL, User agreeement URL, and lastly redo all this for your live account as well. That solved my problem.