The problem is, the session stores the cart items in cookies on users pc.
Paypal runs the ipn verifications script which has to access the session cookies which populate a database with the cart items but paypal will not have access to the cookies since this all happens between my sites server and paypal, omitting the user.
By the time it gets back to the user, they will see the complete page with all the cart items listed as if everything worked.
Or are the items in the session stored on my server and just a session id in the users cookie?
If so, sending the session ID to paypal might work if I can recall the session in the verify script.
How do I get the session id and then set it as the session again later on?
Sorry for the quality of the picture:
- User adds items to cart stored in session arrays and clicks on "buy"
- User directed to paypal where they click on "pay now"
- User waits whilst paypal secretly contacts my server for verification and gets it and asks my server to run my verify script.
- my script runs using the values from the stored session variables and populates the database and sends emails etc... and hands the reigns back over to paypal
- paypal redirects the user to my server for summary of order
Because steps 3 and 4 are between paypal and my server, whatever is stored in the users session on their pc is not accessed. Hence, empty session variables when trying to populate my database.
I hope this and my drawing make things a bit clearer
ok. Sorry for all the questions. I have it sorted and working.
set custom field to post to paypal as session_id()
then added :
at start of verify ipn file.
Let me know if there are any security issues with my methods though please.
thanks