Is it possible to somehow resume a User Session later in PHP?

We have the following scenario:

  • User browses the shop
  • Adds some products to the cart
  • User places an order, but this is is not yet payed

Everything is tracked as one visit. Then some external steps happens

  • The order is payed later in the PHP backend (so no Browser/Session)
  • The PHP Backend will track an eCommerceOrder

Is it possible to “find” and resume the user session somehow, so that everything is together? We currently don’t use _id nor uid as far as I can see.

@SKlocke Yes, it’s possible to resume a user session in PHP, but it requires a few strategies to ensure you can track the session across different requests. Here’s a general approach:

Make sure you are using PHP sessions to store user data. When the user adds items to their cart, store the cart information in the session.

Implement a unique identifier for users, such as a user ID or a token that can be stored in the session or as a cookie. This will help you link the user’s session data with the order later.

When the user places an order, save the order details in a database with a reference to the user’s session ID or unique identifier. This way, even after the user leaves the site, you can retrieve the order details later.

When the payment is processed in your PHP backend, retrieve the session data using the user identifier or session ID. You can then associate the order with the user’s previous session data.

By implementing these strategies, you can effectively resume user sessions and keep track of their activities throughout the order process.

Have you considered using a unique user token to help with this tracking?