Reputation: 87
Hello friends i am developeing a e-commerce application in which i am integrating the paypal sandbox.
After transactions at Paypal, my session gets destroyed on returning to my own site. How can i maintain that session in JSP servlets?
Upvotes: 2
Views: 512
Reputation: 1108632
It has been a long time I used Paypal for the last and it was with PHP only, but as far as I recall you had to supply Paypal a "return URL" as parameter which Paypal should use to redirect the request back to your site after processing the payment. In order to keep the session alive, you need to append the jsessionid
attribute to the URL with the current session ID as value.
String returnURL = "http://example.com/completed.jsp;jsessionid=" + session.getId();
String paypalURL = "http://paypal.com/process?returnURL=" + URLEncoder.encode(returnURL, "UTF-8"));
An alternative is to handle this in a popup window instead and let the window close when Paypal returns. The session in the parent window will just be retained.
Upvotes: 0
Reputation: 597026
http
but paypal is returning to https
, there can be problems.If both timeout, cookies and protocol are fine, the visitor should get the same session when he returns to your site.
Upvotes: 2