how to manage several sessions
Hallo,
my problem is following :
I develop an online shop system in which user sign up and buy some items.
the user information and the item information will be saved in an HttpSession object and then the user will be forwarded to a epayment gateway (paypal or ipayment) and pay the amount and will be forwarded to my site again.
in this time I get some information from epayment gateway, control them and if they are true I want to save the payment, user and item information to the DB but in this case I can not reach to the first information which I have already saved to the session (I think i get a new session from payment)
how can I manage this sessions together without lose any information?
thanks a lot
Taylan
[768 byte] By [
Kezmana] at [2007-11-26 20:35:59]

# 1
I don't think you want to do it this way. I think this strategy will work better:
1) save initial data to database, get ID
2) epayment redirect with ID
3) update database with results
If the user interrupts the payment you will have a record in your database that is incomplete, but that can be cleaned up through a regular maintenance task, if you even want that (might be useful to have orders that are placed but not succesfully paid for, if the user is having problems you can perhaps contact them manually to assist them (you = owner of website)).
This way no session needs to be maintained, all you need is an ID value that you can send along through the payment routine.
# 2
thanks for your answer
but which ID do you mean?
for example I only need the username and user email information before I forward the user to the payment gateway (and the products.)
If i write this info in the DB (username and e-mail) how can I later understand which record belongs to which user (bei concurrent use of system ther will be several users and how can I differ them?)
after my program get the results from payment gateway I must know for which user this informations are.
Thanks again