#knarkzel
1 messages · Page 1 of 1 (latest)
line_items isn't support in Payment Intent. Payment Intent is the custom integration that supports payment using amount and currency only. If you wish to use line_items, Checkout Session (Stripe hosted payment page) can be used. https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=checkout
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,
};
});
}
Can you elaborate more what you meant by disappeared? From your code, I only see you listing the Checkout Session instead of creating one.
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()
Why don't you just use Checkout Session retrieval API to get the status? https://stripe.com/docs/api/checkout/sessions/retrieve
Can you share what you're trying to do?
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
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'],
});
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
Can you share the full response that your system received for above request?