sandeep manglani
sandeep manglani

Reputation: 87

Sessions between two different servers .

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

Answers (2)

BalusC
BalusC

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

Bozho
Bozho

Reputation: 597026

  • check if your session-timeout is not configured too low (in web.xml)
  • make sure the client uses cookies and the server is not configured to not use cookies.
  • verify the protocol. If you are creating the user session in 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

Related Questions