Search code examples
stripe-payments

Retrieve a coupon associated with a checkout session during the stripe webhook named payment_intent.succeeded


I created a payment session with stripe with the AllowPromotionCodes option set to true. Once the payment is done, I would like to retrieve the associated discount coupon (if it exists) in the payment_intent.succeeded webhook. I have the impression that this is not possible and I don't understand why. If this is the case, is there a way to get around this problem?

Edit: I think this link is part of the answer but I don't really understand what stripe proposes as a workaround.


Solution

  • If that's a Checkout Session, you should listen to the checkout.session.completed event and look at amount_discount for the discounted amount. Once the Checkout Session is discounted, everything on payment_intent.succeeded will be the post discounted value and doesn't contain coupon information.