Shopping Cart: Am I ready for payment gateway?

I have a nicely working shopping cart system now. First off, thanks to those who helped me. And thanks to the Wappler team for forcing me to do this from scratch instead of a ready made extension. :wink:

Here is my cart site.

https://boxoffice.wlstudiotheatre.ca/

Have I done everything I need to do to move on to the next stage, payment gateway? Am I collecting all the important information I need? I hope I can do this next step. Get ready for lots of questions. :beers:

4 Likes

If you’ve dealt with the API connector before in Wappler then the Stripe tutorial isn’t as full on as it looks. There’s a couple of things you’ll need to store in your DB for Stripe but it’s all in the tutorial (hopefully)

Yeah, I may be in over my head. I’m already stuck and haven’t even started. :frowning:

I have a table called order_lines where each line of the order gets inserted to and references the order id. I then do a SUM server side of all of the order lines to calculate the total price which gets sent to Stripe. How do you have your DB setup?

I don’t have any DB set up for it other than my products list.

I was hoping to not have to store anything. Just send the user and myself an email with the order details.

Ok, so this is a simplified version of what I have that you could get away with:

Table: order
order_id
order_datetime
user (identity)
stripe_payment_intent
paid (boolean)

Table: order_lines
order_id
product_id
qty
price_each

Realistically you will need to store some of the information in a database to perform the server side actions easily.

Edit: You could use Stripe to store most of this using their Products feature but then you would need to pull this data back anyway from Stripe.

1 Like

OMG, I’m screwed. I fell so stupid right about now. I don’t even know where to start or what questions to ask. I only have five more days to figure out if I can do this before I have to turn down the project.

I so appreciate your help, @max_gb. Wish I could be more help to you to help me.

1 Like

I thought that when I started the ticket cart project but it’s actually not too bad once you get your head around it. Feel free to PM if you get stuck

1 Like

I’m stuck right at the beginning. What exactly am I querying? What do I include in the query? Where am I getting this query from?

@brad, I didn’t want to add to your woes, but I feel that this requires your attentionL

Yeah I’m aware of that. In our case none of our clientele is that savvy. We are a small city and I pretty much know 90% of the ticket purchasers personally. It is a valid point though that others should be aware of.

1 Like

That’s why you use the values from the local storage to only show the info to the users.
You don’t use this value in the checkout process, as for the checkout you get the info from a database query and send it to the payment API in a server action.

1 Like

This query is for the product and price. That’s why you need to do a SUM server side to avoid people from tampering with the price on the browser console.

3 Likes

This is what @ben and @max_gb are referring to:

That’s what is missing in the tutorial … maybe it should be in both tutorials. What database and what query? According to the shopping cart tutorial there is no mention of a database. Then in Max’s tutorial it starts off with saying my query may be different than his. There is nothing to query! Nothing has been added to a database. How and what does data get added to a database?

The only data table I have is the products.

If someone can just fill in that gap I could possibly move on with Max’s tutorial. I really want that to work.

Well it’s the same table Brad… Just query it before sending the data to the API.
My tutorial only shows how to build your shopping cart functionality, not the checkout.

Query it for what? What info am I trying to get on this query? Can someone supply a sample of this query, maybe that will help understand what this query is to achieve?

I know your tutorial doesn’t explain the check out and Max’s doesn’t explain the cart part. There seems to be a big chunk of information missing on how to get from yours to Max’s.

Brad,
You get the product IDs and the quantity from the local storage and send them to your server action and filter the database query (your product tables) to return the price(s). You use these results in the checkout API :slight_smile:

Ok, let me take a breathe here. Here is my data from my products and my local storage from my cart.

1: Do I have everything I need?
2: What would this query look like?

Yes.
Send your ticket id and quantity to the query - use them as filters.

1 Like