#adamjarling - Product IDs

1 messages · Page 1 of 1 (latest)

lilac geyser
#

Hi 👋

random creek
#

Hmmm, not sure, but I'm using the webhook, which is firing correctly when an checkout session completes. Then I re-fetch the checkout session by id, expanding line_items as I've seen referenced on Stack Overflow. And line_items contains both price and product ids, but these ids are different from my main Product and default Price ids. Does this make sense?

lilac geyser
#

I mean I get what you are saying I'm just trying to get a concrete example I can review.

random creek
#

Ah, ok. Let me try to get a request ID for you . Thanks.

#

Looks like this is the request id: req_HD7uUkgBeHTO7N

lilac geyser
#

Thanks!

#

So just to be clear, you see a different ID in your dashboard than prod_LqRFo2OEvQLA6F

random creek
#

Exactly. When I go to "Products" in my dashboard, I see prod_LpOBKIvbl8ZFWP

#

For this particular example....

#

I think the prod_LqRFo2OEvQLA6F id is the Product in the Payment Intent Items. I'm basically trying to display to the user which products they've ordered in the past, and my system needs to know about the original product cause it has metadata my system needs.

#

I suppose I could pass Product Ids into the Checkout session as custom data and grab it on the other side, but seems weird that I can't get this info directly from Stripe's API, right?

lilac geyser
#

So when you query the API for prod_LqRFo2OEvQLA6F it does not return the product?

#

I agree this does seem odd.

random creek
#

For the above product id, it tells me the Product was created today, and is archived.

#

I'm in Test Mode, if that matters?

#

I'm also using use-shopping-cart to pass the Cart Items into the Checkout Session. But the Price Id going into the Checkout Session is the correct default Price for my Product. It's just that on the other side, both Price and Product Ids are different.

lilac geyser
#

Okay...wait... so can you share the request ID that creates the Checkout Session?

#

I'm not familiar with use-shopping-cart but that could be doing something odd

random creek
#

Sure one sec

#

req_JQTRjg4Zae7sCH

lilac geyser
#

Okay got it. Neither the price or the product are used here.

#

It's all created on the fly which will generate a one-off product data

#

You can see it's passing in product_data. This creates a one-off product record that does not persist

#

If you want to retrieve the product you'll need to pass in the ID as product in the request to create the Checkout session

random creek
#

Ah, hot damn you're right.

#

use-shopping-cart gives a convenience method validateCartItems which is supposed to send in all the data, but it's doing something funky. I think I can troubleshoot this from here. Thank you so much.

lilac geyser
#

Sure thing, happy to help.

random creek
#

So I shouldn't be passing in product_data at all, correct?

lilac geyser
#

Not if you want it to relate to an actual product. You should be able to just pass the Price ID and that will link to the product.

random creek
#

Gotcha. Thanks