Also keep in mind that it’s easy for the visitor to edit the values in their local storage so you should never take those values as accurate. They could change the price, for example.
What I do is pass just the product ID and the quantity to my checkout script. I then do another query using those IDs to get the prices and do the calculation again with the quantities. So even if the local storage says a product is 99p, my checkout will look it up and use the real value of £99 (for example). It would also mean that if a product is no longer available, it won’t be in the query and so the checkout won’t proceed with it.
The other values in the local storage I generally ignore. They are just used to populate the cart every time it’s viewed.
Thanks for the input, guys. I am about to embark on this scary journey. My next question is that should I be able to get a working cart using this tutorial will it then be still compatible with the tutorial that @max_gb put out on Stripe Checkout integration?
Yep, it’s in the showcases - ukpaint.co.uk. Select a category, then a product, then choose a colour and size so you can add it to the cart. The cart count updates in the top-right automatically.
Has anyone who followed this tutorial been able to hook up to a payment gateway? Paypal?
I tried following the Stripe Integration tutorial but can’t even get started. I now have a wonderful shopping cart thanks to this tutorial but it’s all for not if I can’t hook it up to a payment gateway.
We need a step by step follow up tutorial for this one. Stripe or Paypal doesn’t matter. Just need some sort of step by step guide.
The tutorial @max_gb created should give you all you need to integrate Stripe. That’s exactly what I used to build mine. I’d previously got Stripe up and running using another technique but much prefer Max’s method so I would say go with that.
I’ve integrated payment systems with WorldPay and a few banks in the past (not with Wappler), but have no experience with Stripe. @Hyperbytes, @Antony and @max_gb have all kindly contributed very detailed tutorials on Stripe Integration. I’m not sure what the difference between them is.
I think the one by @Hyperbytes covers a more detailed type of integration. @Antony’s is for ‘SCA Compatible Payment’. Is @max_gb’s different to this - ie not SCA compatible - or is it just a different approach?
I would be grateful for any clarification. I might well consider using Stripe at some point.
As far as I’m aware Brian’s tutorial is based upon the Charges API which is now no longer SCA compliant, but still usable in countries outside of the EU for the time being. Antony’s tutorial is based on Stripe Elements which is basically the embeddable card detail collection form (on-domain way of taking payment) which is SCA compliant.
Mine was based on Stripe Checkout which is a redirect to Stripe’s hosted checkout page which is SCA compliant and they are constantly adding new features to it, i.e Apple/Google Pay etc.
Yes that is correct, it is an old tutorial. I have not actually used stripe since so can't offer and alternative at this timer. I will go back to it one day but not for a while
I am having an issue when adding a product to the data store with the quantity. I have tried different variations and after 2 days I surrender! The quantity +1 with ticks as outlined in the tutorial does not work. See attached picture. Without ticks random quantities appear, usually adding one to the previous selection. Any help to finish this would be most appreciated!
I am trying to add a product to the cart using upsert. Everything is fine except the quantity.
Using ticks as per the tutorial you just get the string as shown in my previous message. Without the ticks, if I buy the product once no problem. If I click again instead of updating the quantity it adds the product separately BUT it adds it as a quantity of 2 not 1.