#rhy-checkout-quantity
1 messages · Page 1 of 1 (latest)
rhy-checkout-quantity
@waxen cave It does seem like https://stripe.com/docs/payments/checkout/adjustable-quantity is exactly what you want no?
but I don't want them to be able to adjust the quantity after they click the buy button
I want them to select the pixels/grids beforehand, which determines the quantity, and then plug this quantity into stripe
I'm sorry, the buy button is on our Checkout page so what's the problem?
Do you mean you want them to pick the quantity before you send them to Checkout?
kind of, I want them to select the number of pixels (aka quantity) which is stored by a selectedPixels.length variable, and I want to use this as the quantity in checkout
I'm sorry you're being super specific an talking about some kind of variable that isn't a Stripe thing, just seems to be your code so I don't really get what any of that could mean
But if you have a payment page, where they pick the quantity and then you send them to Checkout, then I don't get what's the issue. You write your code, send the quantity to your server, there you create a Checkout Session with the right quantity and you're all set
Sorry if I'm not explaining well enough; here's a quick demo of what I mean; the user can select let's say 5 grids in this example (they want to buy these exact 5 grids), let's say for example each grid is $1, then when they click the checkout button, it counts the quantity of grids selected (which is 5 in this case) and then uses that as the quantity for payment
and once they click checkout, they can't change the quantity purchased unless they cancel the transaction
The "checkout button" is your own button right? So you write Javascript code that sends a request to your server with the list of pixels. You store that information in your database and you call the Create Checkout Session API with the right quantity. There isn't more to it than this I think
ohh I see, I read in the doc that it ' enable your customers to update the quantity of an item during checkout.' so I assumed they could still change the quantity when checking out (which I don't want to allow)
That is a feature you explicitly have to enable. By default they can't change the quantity!
ahh gotcha, so I should be able to pass my quantity into the checkout session; could you direct me to the documentation to get started with this process?
quantity is required by default so really you would just follow our quickstart https://stripe.com/docs/checkout/quickstart
cheers koopajah, thanks for the help - could we keep this thread open if/when I have questions relating to this topic?
I'll keep it open for a bit, but not long, we have lots of people asking questions in parallel so it will be archived if it stays inactive. You are welcome to just ask new questions again in #dev-help if so
for the price: '{{PRICE_ID}}' field, do I have to create a price_id on stripe and add it here? or can I just write '100', or pass in a custom price based off js logic? Also do I have to create a development server to test this or can I test it directly with my live public and secret key?
You have to create a Price on Stripe first. Either in the Dashboard or in the API, or use price_data though I discourage that. Read https://stripe.com/docs/products-prices/manage-prices carefully
so I'm following the quickstart pre-built checkout page you mentioned https://stripe.com/docs/checkout/quickstart but encountering some issues; when I click the checkout button nothing happens and the page is just loading - I copied and pasted the code in new components, (fyi I moved the index.js and checkout_sessions.js are in the same folder) the only things I changed in the code are the following:
price: 'price_1NxXosB5oiepJ50uC81tllmt',
<form action="/checkout_sessions" method="POST">
I'm sorry, you sahred nothing actionable. Step 1 is to add logs to your code and debug this on your own, you're the developer writing all of this so you need to understand the pieces and where things are failing
alright will do some more digging around and test it out, but just to clarify, the price should be entered like this right?
price: 'price_1NxXosB5oiepJ50uC81tllmt',
yes