#Raman-promotion code
1 messages ยท Page 1 of 1 (latest)
You can list all Promotion Codes that have a specific Code - see https://stripe.com/docs/api/promotion_codes/list#list_promotion_code-code
Thank you. And 1 more question. We are use the checkout session payments with enabled promotion codes. Can I retrieve the promotion code in this session by any callback?
So I need to know did user use the promotion code or not, and if he used, what the code?
@ornate jewel let me look
The info about the discount(s) claimed if any would be in this: https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-total_details-breakdown-discounts you need to retrieve them via the API after you get the event
But now i receive only the discount amount instead the discount id. How I can set up to retrieve the discount id?
This is checkout.session.completed callback
that's expected, the information inside breakdown is not included by default, you have to explicitly expand it. You can read more about expand here: https://stripe.com/docs/expand
So when you get the event you need to retrieve the Session and pass expand: ['total_details.breakdown']
Ohh, ok, I will try. Thank you
Can I expand multiple parameters like expand: [
'total_details.breakdown',
'total_details.breakdown.discounts.promotion_code'
] ??
yeah but that's expected
expansion works based off of the API layer
total_details -> breakdown -> discounts -> discount -> promotion_code
you can't just pass promotion_code after discounts, there's a layer in between
sadly, the maximum is 4 deep so you won't be able to reach promotion code
Ohh, yep, I see ๐ So thank you ๐
sure! Expand is super easy once you grasp it fully but it takes a while to resonate ๐ฆ