#marlon2k
1 messages ยท Page 1 of 1 (latest)
If you have the Charge ID then you should be able to retrieve the Charge and check invoice right on the Charge object itself
and if you want to get the full Invoice object you can always expand invoice when you retrieve the Charge as well
I'm not creating invoices for one-time payments, only subscriptions.
Ahhh I see what you're saying - sorry I read to fast and misinterpretted
How are you specifying these quantities when you create the charges? Are you using Checkout? Are you just calculating how much the cost should be and creating a charge/payment for the correct amount?
We have a custom shopping cart built - users can select which product they want and the quantity (ie PRODUCT A x 10)
Are you storing/setting those quantities anywhere in the Stripe object you're creating? Like do you set the quantity as metadata when you create the charge/payment?
Not using metadata. The only place the quantity is stored is here on the checkout summary from the Stripe payment page. I would need to pull it from here somehow.
Can you share that payment ID with me so I can see what you're doing?
Yeah are you sure you're using a custom shopping cart? From what I can see on my end it looks like you're using Checkout Sessions to complete payment. If that's the case then you can list all Checkout Sessions tied to that payment intent ID (https://stripe.com/docs/api/checkout/sessions/list#list_checkout_sessions-payment_intent) and then check the quantity from there
Yeah checkout session, my bad
So I need to find the checkout session for that payment ID
And then call it via API?
And that'll get me the quantity amount?
Yes, you'll list all checkout sessions for that payment ID and expand data.line_items -> this will give you 0 (if there are no matches) or 1 checkout session returned in the response -> from there you can check for the quantity in line_items on the Checkout Session (https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items-data-quantity)
OK 1st step,
I have the payment ID and charge ID.
How do I find the checkout session ID using either of these?
Did you check out the link I sent you earlier? https://stripe.com/docs/api/checkout/sessions/list#list_checkout_sessions-payment_intent
That shows what attribute you'd pass in when listing checkout sessions given a payment intent ID
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ok 1 step done. Found the checkout session ID.
Will try expanding line items now
How do I do that?
We give a bunch of examples on how to do this here: https://stripe.com/docs/expand
in your case, you'll want to expand data.line_items if youre expanding from the list api request
What kind of request am I making here though
I'm calling checkout session ID right? Could you link me to that please
Nvm got it
Hey
Not working, can u spot a reason why maybe
I have authorization header at bottom, that's fine
It's because you're retrieving a single Checkout Session - if you're retrieving a single Checkout Session you should expand line_items not data.line_items
you'll probablly also want to do expand[] instead of expand
That's it. You LEGEND!!!
๐ glad you got it working ๐