简体   繁体   中英

Paypal integration in java

I've generated some expresscheckout and paypalfunctions classes via wizard, tried to integrate it to my spring mvc app and make it to communicate with sandbox account. I get a success respond and then the generated function wants to redirect to paypal with this piece of code in expresscheckout class:

  //' Redirect to paypal.com            
response.sendRedirect(response.encodeRedirectURL(nvp.get("TOKEN").toString()));

Neveretheless it redirects to something like http://localhost:8080/EC-48480369JN366854F

I'm confused if this is really how it should work or do I have to adjust the code? Is there any decent tutorial, how to integrate it to java projects? All what I've found was out of date or for PHP only.

You probably need to be doing this instead:

//' Redirect to paypal.com
response.sendRedirect(response.encodeRedirectURL("https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=" + nvp.get("TOKEN").toString()));

(Change www.paypal.com to www.sandbox.paypal.com if you're testing on the Sandbox.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM