#kosakanatops-checkout-lineitems
1 messages · Page 1 of 1 (latest)
Does it not work to simply retrieve the Payment Intent object?
yeah I was looking at this but i don't see anything related to the quantity? I only see the total amount charged
Where are you specifying quantity during the Payment Intent creation process?
stripe.checkout.sessions.create({
customer: response.locals.user.id,
line_items: [
{
price: 'price_1Li1uoLHhuDfABwIwMZYRfVx',
adjustable_quantity: {
enabled: true,
maximum: 999,
minimum: 0
},
quantity: request.body.quantity,
},
],
mode: 'payment',
shipping_address_collection: {
allowed_countries: ['US']
},
allow_promotion_codes: true,
// automatic_tax: {
// enabled: true
// },
phone_number_collection: {
enabled: true
},
this is how i create the checkout session for users to checkout, there is a place for specifying the quantity for each line items
Ah, okay. There is a quantity field here: https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items-data-quantity
Does that have what you're looking for?
It's on the Checkout Session itself, rather than the Payment Intent object
right, yes i have no trouble creating checkout session.
now i want to show my customers their order history. so i used this
https://stripe.com/docs/api/payment_intents/retrieve
but it does not include the quantity
You need to retrieve the Checkout Session object and expand the line_items.data hash in order to get line_items.data.quantity (as well as other payment data)
Here's how to retrieve a Checkout Session object: https://stripe.com/docs/api/checkout/sessions/retrieve
Here's documentation on expanding objects: https://stripe.com/docs/api/expanding_objects
kosakanatops-checkout-lineitems