Home > other >  Stripe - Is it possible to retrieving promotion code from payment_intent.succeeded?
Stripe - Is it possible to retrieving promotion code from payment_intent.succeeded?

Time:07-09

So I'm trying to implement promotion codes in my Stripe Checkout. I got everything working just fine, the only thing I'm missing is the ability to see which promotion-code was used in the payment_intent.succeeded object.

I can't find it in the object and was wondering if I'm looking in the right place or do I need to try a different approach? I need this information do increment an Integer on a dashboard to keep track of the amount of promotion codes redeemed for a specific user.

CodePudding user response:

The Checkout Session object has a total_details.breakdown.discounts.discount field that contains the ID of the coupon or promotion code that was used in the Checkout Session: https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-total_details-breakdown-discounts-discount

  • Related