#rk0660-Checkout
1 messages · Page 1 of 1 (latest)
Hi, in your post handle function I see you are sending an AJAX request
AJAX request doesn't work with Checkout redirection. You would want to let the form submit naturally
Oh so how do you reccomend I pass in my cart.products data
So I can map over the products in my node.js when creating the session
Like in the form have a <input type="hidden"> {cart.products} </input>
sorry not sure what you mean
yes! input. But I am not sure if cart.products is an array. You may want to do some trial and error there
on backend?
It depends on the language
and the backend framework. For example with Ruby: https://github.com/stripe-samples/checkout-one-time-payments/blob/master/server/ruby/server.rb#L70
Here is how the form has input: https://github.com/stripe-samples/checkout-one-time-payments/blob/master/client/react-cra/src/components/Checkout.js#L55-L73
Here for node
So
<input value={cart.products}> </input> on the frontend
then in the post method in the backend, const { data } = req.body
Let me give it a true
Yeah but I am not sure if an array could fit in there....
So how can I get the array to the node.js server from my react page?
I should be able to map through all my products and display them on the stripe checkout session
<form action='results.php' method='post'>
<input name='cars[]' placeholder='Enter Car Name'>
<input name='cars[]' placeholder='Enter Car Name'>
<input name='cars[]' placeholder='Enter Car Name'>
<input name='cars[]' placeholder='Enter Car Name'>
<input name='cars[]' placeholder='Enter Car Name'>
<button name='subimt'>Submit Information</button>
</form>
Just pick an example from internet
literally "How to send an array via HTML form without javascript"
Ok sorry