#MarkoBoras
1 messages · Page 1 of 1 (latest)
There are several choices depending on what data you're most interested in. checkout.session.completed is usually a good option.
https://stripe.com/docs/api/events/types#event_types-checkout.session.completed
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
What do you mean by that?
You can reproduce the scenarios you're interested in via test mode, and then check what Events were generated in your Stripe dashboard to get an idea of what to look for.
https://dashboard.stripe.com/test/events
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
My user can use on Checkout promotion code that I've shared with him, he can enter vat id to purchase as a business. In which event I can listen in webhook and extract promotion code id to update it with some metadata
so I need to extract in my webhook
which promotion code was used to update that promotion code with the name of the user who has used it
should I update my promotion code with metadata "fullName" in event customer.discount.created
when user uses promotion code maybe?
I don't think so, I'm pretty sure that type of Event is thrown is when you attach a Coupon to a Customer object, are you seeing that Event being thrown in your logs for the flow you're testing?
I'm pretty sure checkout.session.completed is the Event you're looking for.
That event is thrown also. I'll use checkout.session.completed for creation of invoices and fiscalization and stuff like that so that's okay.
But I need to implement this logic
We are creating promotion codes that we are sharing to multiple people and each code can be used only once.
Wait wait, what does a checkout event have to do with Invoice creation/finalization?
I'm confused
I need way to listen when that code is used and who has used it.
I am from Croatia.
We need to after payment succeeds create one fiscalized invoice in tax administration office.
More correctly -> not invoice, BILL
do you understand me now?
Don't think so, but I'll try to get there.
I am now looking to solve it like this
Are you having trouble getting this information from checkout.session.completed Events?
I'll create customer in Stripe if user isn't yet while creating Stripe Checkout. When user uses promotion code it will be attached to that customer id.
no that is all good
I need a way to track who has used my promotion code to display. them in admin dashboard
checkout.session.completed Events also contain a reference to the Customer that completed the session, so they seem like the right Event to detect when a Promo Code is used and also check who redeemed it.
Yes, for shipping or billing address?
billing
I need that address for fiscalization of invoices
to know what tax I'll apply to user
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
tnx