Just a wild thought...are you using an authentication id for the api unique to the visitor? I would use that to store a json object holding the cart data. You need some sort of state persistence and this is at least without a session. I wouldn't use a cookie as they are unreliable and could be tampered with.
Laravel RESTful Shopping Cart
Hello everyone,
I am working on project where I implemented some kind of "web shop" to provide ability to customers to buy some services/products. At the beginning, I did not know that I will need to build mobile version using Ionic framework. So, I used a session based approach to store services/products in the cart and switched the session driver to Redis - everything works fine.
Now, I am building the API and Ionic app where I came to the part to add services/products to the cart.
Since REST should be stateless and it does not have session I need to find a way to save items in cart.
Of course, if we take a look in app\Http\Kernel.php, \Illuminate\Session\Middleware\StartSession middleware is missing for api, as expected.
I spent hours and hours to find any good reference or example what is a right way or how to make: "Laravel RESTful Shopping Cart", "Laravel Non Session Cart" etc. and I found almost nothing (just bunch of session or database approaches and a lot outdated Cart packages).
Does anyone have an idea how to organize cart storage, should it be on client side (ex. Ionic storage) or on server side (ex. MySQL database or Redis)?
Does anyone know any good (right way) reference or any premium/free book, tutorial, video course, example, package on how to achieve this?
Many thanks
Please or to participate in this conversation.