#a.sheliutsin
1 messages · Page 1 of 1 (latest)
Hi 👋
How are you generating the Payment Intent?
Sorry, but I don't know. I get access to the data to make a report. Is it necessary?
The Payment Intent object does not retain any information about applied discounts, only the amount charged
So if you were looking to understand the discounts I would recommend finding how they were applied (e.g. if through Stripe Checkout then you can find them on the Checkout Session object) https://stripe.com/docs/api/checkout/sessions/object?lang=node#checkout_session_object-line_items-data-discounts
Interesting. I've tried to retrieve Checkout sessions by payment_intent_id but I cannot find anything related to promo codes
Do you have an example checkout session ID I could look at?
Sure:
payment_intent_id = "pi_3MEcx2EIkdyumnBw1upVbTGx"
session_checkout_id = "cs_live_b1SHbJDDe4JOEESw6mjxbRYw99fGzbEFiZqT1Kp8B0wmzsBF5oEplFafhX"
There were no discounts applied to this Checkout Session from what I see
It was. I found what was the problem. Apparently these fields doesn't includes by default, I have to expand it
Here is the final request if you are interested:
stripe.checkout.Session.list(
payment_intent="pi_3MEcx2EIkdyumnBw1upVbTGx", expand=["data.line_items", "data.line_items.data.discounts"])
Thank you
for your time and link
Oh, yeah, just not on a specific line item (where I was looking). The discounts hash has the link to the Promo code applied
Yes!
So does that work for you?
Yes, it works. Thank you