#jdesignv2_api

1 messages ¡ Page 1 of 1 (latest)

fluid muralBOT
limpid wagonBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

fluid muralBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1241096934379491430

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

umbral echo
#

Sorry for asking a lot of questions this week ^^

lusty sigil
#

It's not clear to me what exactly you mean here. We do not expand the Checkout Session line items by default, you need to retrieve them from the API.

I don't know what command you are referring to

umbral echo
#

ok sorry let me clarify my question...

#

So normally I use the following command for retrieving the checkout session:

let checkoutSession = await stripe.checkout.sessions.retrieve(
  checkout.id,
  {
    expand: ["customer",
      "payment_intent",
      "line_items",
      "line_items.data.price.product",
      "invoice"
    ],
  }
);

This works perfectly fine until I have more then 10 line_items in one checkout session... Which makes sense for Stripe but makes it a bit more complicated for my use-case...

So now I found out that you can retrive all line_items of a checkout session with the stripe.checkout.sessions.listLineItems() command. Which works - but only gives me the product-ID of each product (in line_item->price->product)... So do I need to explicitly call await stripe.products.retrieve() for each line_item or is there a method of expanding the line_item result before - like when receiving the checkout session...

#

I hope my question is now more clear

#

English is not my main language :/

lusty sigil
#

Okay ,no that makes sense.

#

The list line items function is just another API call, like the retrieve method.

#

So i just tested out passing expand=['data.price'] to my call to list_line_items (I'm using Python)

umbral echo
#

oh so I can also add the expand: [] param to the stripe.checkout.sessions.listLineItems() call?

lusty sigil
#

Correct!

umbral echo
#

ahhhh nice

fluid muralBOT
umbral echo
#

I did not know that

#

I will try it out quickly

#

Perfect! it works

#

Good to know that you can add expand to all api calls!