#rk0660-Checkout

1 messages · Page 1 of 1 (latest)

glad loom
#

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

glossy vault
#

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

glad loom
#

How about normal input inside form?

#

Like old traditional way of submitting

glossy vault
#

Like in the form have a <input type="hidden"> {cart.products} </input>

#

sorry not sure what you mean

glad loom
#

yes! input. But I am not sure if cart.products is an array. You may want to do some trial and error there

glossy vault
#

yeah cart.products is an array

#

So would I get the data via req.input?

glad loom
#

on backend?

#

It depends on the language

glossy vault
#

Yeah so I'm using node.js in backend

#

Just learning it tbh

#

Sorry I didn't specify

glad loom
#

Here for node

glossy vault
#

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

glad loom
#

Yeah but I am not sure if an array could fit in there....

glossy vault
#

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

glad loom
#
<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"

glossy vault
#

Ok sorry