#DOWNTOWN DUNKARONI-missing-product
1 messages · Page 1 of 1 (latest)
Yes sorry!
What's strange to me is that product_data exists in cartItems, but not when I log it on line 29
can you print line_items before you send the request?
yeah I suspect that function is doing something funky
so when logging line_items on line 45, I actually don't get any output in the console nor the terminal
this is my console
what's strange to me is that this worked with another project that followed the same structure, though. see this screenshot:
I spoke to the creator of use-shopping-cart for a few hours yesterday and we couldn't sort out what was going on
This is validateCartItems under the hood: https://github.com/dayhaysoos/use-shopping-cart/blob/master/use-shopping-cart/utilities/serverless.js
not for production though right?
like try to create checkout session with the raw line_items (without validating it)
With the following (replacing validate_line_items with cartItems), I'm getting this output in my terminal: Missing required param: currency.
I'm also not seeing the output from line 47's log...
however cartItems contains a currency value..?
oh but, notice how the ID is the first child of the object, then the data is contained within the ID
yup that would be it
Right but, see here (scroll down to the banana section) https://useshoppingcart.com/docs/usage/actions/add-item
the lib uses the same data structure
hmm could be a bug with the example
since its a third-party lib, I don't know how much we can help with it 😦
hmm could be a bug with the example
according to Nick from use-shopping-cart, "Validate cart items loops over cartItems with Object.keys"
So the ID-parent structure shouldn't really matter if I'm using validateCartItems though?
do you know why my log on line 47 won't appear in my terminal?
I don't know. It almost seems like some code is getting cached by the server.
Can you try restarting the app?
I tried that + trying localhost in incognito mode
same thing
Going back to my very first message though, is there any kind of bandaid solution you can think of to attach product_data when creating a price, at least for testing?
You can pass in product_data while creating a price yes
https://stripe.com/docs/api/prices/create#create_price-product_data
I'm not clear about your flow though
so can't make any specific recommendations