#bird-coupon-events

1 messages · Page 1 of 1 (latest)

coral topazBOT
vague geode
#

@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

still turtle
#

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

vague geode
#

It depends a lot on your overall integration. So I'd recommend to try what I said above

still turtle
vague geode
#

bird-coupon-events

still turtle
#

Oh got it this is helpful: so, total_details.breakdown.discounts would return the list of promotional codes used?

vague geode
#

the Coupon

#

PromotionCode and Coupon and Discounts are separate API Resources.

#

I recommend trying it in Test mode

still turtle
#

Can I forward events to the online CLI? Seems like its not letting me

vague geode
#

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

still turtle
#

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?

vague geode
#

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.

still turtle
#

thank you