#mboras_webhooks

1 messages ยท Page 1 of 1 (latest)

rocky pierBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1338535224262529026

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

trail sequoia
#

What event is for promo code usage + successfull payment in checkout (mode: 'payment')

brittle pecanBOT
rotund crag
#

Hi ๐Ÿ‘‹ there isn't a specific type of Event for that scenario. You can listen for checkout.session.completed to be notified when the customer completes the checkout flow.

Depending on the payment methods you're allowing your customers to use, it may not be known whether the payment has succeeded at that point. It depends on whether you accept delayed notificaiton payment methods:
https://docs.stripe.com/payments/payment-methods#payment-notification

trail sequoia
#

I don't accept delayted payment methods (sepa, ...)

#

so I listen to checkout.session.completed and get there what promo code was used?

rotund crag
#

You'll listen to checkout.session.completed to trigger your logic. Then you'll need to retrieve the Checkout Session, and expand total_details.breakdown field, which will have a discounts array containing discount hashes, which will give insight into what created the Discount being used by the session.
https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-total_details-breakdown-discounts

For more details about using expand:
https://docs.stripe.com/api/expanding_objects

trail sequoia
#

wonderful

#

tnx @rotund crag

#

since this is X project on stripe, I have that code on my another project ๐Ÿ™‚

#

tnx

#

that's it

#

I came here because I thought there is maybe simpler way