#a.sheliutsin

1 messages · Page 1 of 1 (latest)

rotund sierraBOT
weary yarrow
#

Hi 👋

How are you generating the Payment Intent?

mystic peak
#

Sorry, but I don't know. I get access to the data to make a report. Is it necessary?

weary yarrow
#

The Payment Intent object does not retain any information about applied discounts, only the amount charged

mystic peak
#

Interesting. I've tried to retrieve Checkout sessions by payment_intent_id but I cannot find anything related to promo codes

weary yarrow
#

Do you have an example checkout session ID I could look at?

mystic peak
#

Sure:
payment_intent_id = "pi_3MEcx2EIkdyumnBw1upVbTGx"
session_checkout_id = "cs_live_b1SHbJDDe4JOEESw6mjxbRYw99fGzbEFiZqT1Kp8B0wmzsBF5oEplFafhX"

weary yarrow
#

There were no discounts applied to this Checkout Session from what I see

mystic peak
#

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

weary yarrow
#

Oh, yeah, just not on a specific line item (where I was looking). The discounts hash has the link to the Promo code applied

mystic peak
#

Yes!

weary yarrow
#

So does that work for you?

mystic peak
#

Yes, it works. Thank you