Question

I'm trying to integrate Paypal login within my Rails app and I can't make it work.

I was following the guide: http://cristianobetta.com/blog/2013/09/27/integrating-login-with-paypal-into-rails/

I created an application from the paypal developer site, and set the followings:

  • App return URL (test): http:/ /localhost:3000/auth/paypal/callback
  • App return URL (live): http:/ /localhost:3000/auth/paypal/callback

and I get the error:

"Relying Party Validation error: redirect_uri provided in the request does not match with the registered redirect_uri. Please check the request."

when I try to visit the URL:

http:/ /localhost:3000/auth/paypal

Interesting enough, I get the same error if I input my application credential in the official Paypal API integration tool:

https://devtools-paypal.com/guide/openid/ruby?interactive=ON&env=sandbox

Any ideas?

Thanks

Was it helpful?

Solution 2

You need to set this value inside of your sandbox application on the developer website.

  • Log into developer.paypal.com
  • Click Applications
  • Under My Rest Apps click your App name
  • Click Edit next to App redirect URLs
  • Set the return URLs for live or test
  • Save

OTHER TIPS

This has changed a bit since the accepted answer, and will presumably change again soon... but here's how you do this now.

  • Log into developer.paypal.com
  • Click on Dashboard (https://developer.paypal.com/developer/applications)
  • Click your app name under "Rest API Apps"
  • Scroll to the box at the bottom of the screen labeled "Sandbox (or Live) App Settings
  • Set the Return URL (Where users will be redirected after test transactions)
  • Click save

NOTE

This Return URL must exactly match the redirect_uri that you pass in via querystring (so it's confusing as to why you'd need to pass it in in the first place)

GOTCHA

At this point in time, the Return URL can seemingly never be updated. In my recent experience, if you don't type it correctly the first time you save it, you will have to create a new app.

I resolved it by setting both the live and test redirect URLs to the same thing.

Plus, I ensured that I ticked to get Personal Information from the advanced settings panel, also adding URLs for privacy and agreement links.

The portal hung when set to localhost addresses for those links, so possibly PayPal tried to dereference them, so I put in real fake URLs.

I was encountering this issue myself, albeit in a Sinatra rather than Rails app - like you, I was using http://localhost:4567/auth/paypal/callback as the return URL - changing it to http://127.0.0.1:4567/auth/paypal/callback on the PayPal dev portal and accessing my app from 127.0.0.1 rather than localhost fixed it for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top