#knarkzel

1 messages · Page 1 of 1 (latest)

hollow brambleBOT
hot falcon
unreal meadow
#

I used checkout session previously but the sessions suddenly disappeared

#

Like so:

async function loadOrders() {
  const checkouts = await stripe.checkout.sessions.list({
    expand: ['data.payment_intent', 'data.line_items'],
  });
  const validCheckouts = checkouts.data.filter(
    (checkout) =>
      checkout.payment_intent &&
      checkout.line_items &&
      checkout.customer_details &&
      checkout.customer_details.address,
  );
  return validCheckouts.map((checkout) => {
    let lineItems = checkout.line_items?.data.map((item) => {
      return {
        amount: item.amount_total,
        description: item.description,
      };
    });
    if (lineItems) lineItems.sort((a, b) => a.amount - b.amount);
    return {
      checked: false,
      amount: checkout.amount_total,
      shipping: checkout.customer_details,
      lineItems,
    };
  });
}
hot falcon
#

Can you elaborate more what you meant by disappeared? From your code, I only see you listing the Checkout Session instead of creating one.

unreal meadow
#

Yeah basically I'm trying to display this information:

#

And I have succesful payments that previously worked with the same code

#

But now I don't even get the succesful payment with stripe.checkout.sessions.list()

hot falcon
#

Can you share what you're trying to do?

unreal meadow
#

I'm trying to show the data that Stripe shows after paying for physical paintings such as name, total price, order (line_items) and shipping address

#

I want to show all of them in a neat table

hot falcon
#

I see! In this part of your code, did you get any checkout session in response before any of your filtering logic? If it doesn't, can you share the request ID (req_xxx) of your list request? Here’s how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request

const checkouts = await stripe.checkout.sessions.list({
    expand: ['data.payment_intent', 'data.line_items'],
  });
unreal meadow
#

Yeah, I get 8 checkout sessions that are expired.

#

The name and shipping address has disappeared from the checkout I assume because the status is expired

hot falcon
#

Can you share the full response that your system received for above request?

unreal meadow
#

Hmm I think it contains private data

#

I'll look at it another time, it's not too important

#

Thanks for the help 👍