#muhammet-product-list
1 messages ยท Page 1 of 1 (latest)
Hi ๐ when interacting with our API, you would use this function/endpoint to create Product objects:
https://stripe.com/docs/api/products/create
I had no problems with the build process. I'm having a problem retrieving an existing product in bulk using its ids.
const products = await stripe.products.list({
limit: 3,
});
I want to get product details by using this method with id's. How should I create an object?
I'm sorry, I'm not sure I'm understanding the question. You're trying to use the ids parameter that is available for that function, but are running into problems doing so?
Yes. It says in the document that I can use the ids, but I don't know how to use them. https://stripe.com/docs/api/products/list my question is actually clear in the link here.
I want to get multiple items using only ids
Gotcha, so it sounds like you're trying to figure out what the syntax should be to use that ids parameter.
Yes, I tried many things but it didn't work.
I was able to put the product IDs in a list, like this:
limit: 3,
ids: ['prod_abc','prod_def']
});```
I'm sorry, it doesn't work.
PROD LIST { object: 'list', data: [], has_more: false, url: '/v1/products' }
Can you share the ID of the request (req_123) that didn't work?
There are no logs. Actually, our request works, but it does not bring the products.
There is still a log for the request that you can view in the Stripe dashboard. Did you replace the placeholder values in the snippet that I provided with real IDs matching your Product objects?
๐ I'm stepping in for my teammate! Let me know if you have a request ID handy, or if you can share your Stripe account ID. Your account ID should look like acct_...
If you're testing out this request using curl, your request would look like this:
curl -G https://api.stripe.com/v1/products -u sk_test_... -d ids[]=prod_... -d ids[]=prod_...
I think I found my mistake. I don't create a product at checkout. It comes when I call single. My multiple calls are called from the product list that I have already created. But since I do not create the products, naturally, no product comes. What I don't understand is that the product arrives in my single calls.
By the way my id: acct_1LYZHXG7TiqQhuQ2
Thanks! I think I understand what's happening. I see that Checkout Sessions are being created, and you're using line_items.price_data to pass along amount, currency etc.
Yes
got it. the details you pass in line_items.price_data are ultimately used to create a new Price object: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data
I don't think I follow this:
What I don't understand is that the product arrives in my single calls.
can you clarify what you mean by this?
Note that a Product will also be created based on the values you pass in line_items.price_data.product_data. If you don't want to create a new Product, you should pass in a product ID as the value of line_items.price_data.product instead
When I make a request like this, this result comes
However, when I want to do this in bulk, it returns an empty array.
do you get any data if you omit the second ID from that array?
I'm not able to reproduce this, unfortunately. I'm using the same syntax on my end
muhammet-product-list
@shy hound it's because you're on an old API version
make sure that you use the most recent API version when making the call, see https://stripe.com/docs/api/versioning
ah you seem to use the latest API version, so print how many elements you have in productsList.data