If i was to store some order details in a session whilst the customer is redirected to a payment gateway, would they be lost by the time the custom returns back from the gateway?
My plan is:
website take order -> store order in session -> website goes to paypal -> payment made -> returns using paypal autoreturn to confirmation page -> on return get session order data and submit to database.
That depends on how long it takes them to come back to your site. I don’t know what the default expire time is for sessions but you can assume it to be anywhere from a few minutes to a few hours.
If you want to assure the user gets to see whatever he needs to, you will need the payment gateway to redirect the user to a URL that you specify. For instance:
/payment.php?status=complete&receipt=875628dwf87sdfsg785623
Where the receipt identifies anything you want it to: the user, the transaction, both?
Most payment gateways support such a feature. If yours does not, contact your payment gateway.
If you want to show them a receipt, do not use sessions or cookies, use the return URL method I describe.