#bird-coupon-events
1 messages · Page 1 of 1 (latest)
@still turtle Hello! Are you asking what Event type to listen for to know when a given Coupon is redeemed? You mentioned a "code" (which is on PromotionCode) and I'm a bit unclear on what you're really trying to do, how you integrate, etc.
Really the best approach would be to try it in Test mode on your account and then look at the Event(s) it generates
Hey! Basically, whenever a promotional code is used by a paying customer, I want to send that promotional code to a referral program tracker. However, I can't find which event to send to my webhook endpoint
It depends a lot on your overall integration. So I'd recommend to try what I said above
Does Checkout Session have any info about promotional codes that were used during checkout? https://stripe.com/docs/api/checkout/sessions
Yes inside https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-total_details you can see amount_discount and breakdown would have the list of discounts
bird-coupon-events
Oh got it this is helpful: so, total_details.breakdown.discounts would return the list of promotional codes used?
the Coupon
PromotionCode and Coupon and Discounts are separate API Resources.
I recommend trying it in Test mode
Can I forward events to the online CLI? Seems like its not letting me
I'm sorry I don't know what you call "the online CLI"
I just tried on my end and after I use a one-time use Coupon on Checkout I get customer.discount.created as an Event which is likely the Event you are after
But if it were me I would use checkout.session.completed and for each completed Session I'd use the API to retrieve it and check the total_details property
Think that makes sense
When I trigger checkout.session.completed, total_details isn't included. I would need to add it to my payload using the API, correct?
Ah no, sorry you're likely misunderstanding multiple key parts here
total_details is includable which means it's not returned by default. You have to explicitly retrieve it via the API. See https://stripe.com/docs/expand for more details about the Expand feature in our API that lets you do this.
thank you