#MarkoBoras

1 messages · Page 1 of 1 (latest)

median ledgeBOT
snow slate
proper ravine
#

ok

#

for failed checkout

snow slate
#

What do you mean by that?

proper ravine
#

nevermind this

#

so I need. to implement this to better explain maybe

snow slate
proper ravine
#

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?

snow slate
#

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.

proper ravine
#

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.

snow slate
#

Wait wait, what does a checkout event have to do with Invoice creation/finalization?

#

I'm confused

proper ravine
#

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?

snow slate
#

Don't think so, but I'll try to get there.

proper ravine
#

I am now looking to solve it like this

snow slate
proper ravine
#

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.

proper ravine
#

I need a way to track who has used my promotion code to display. them in admin dashboard

snow slate
#

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.

proper ravine
#

ok

#

can I somehow force user to enter his street,city and country in checkout?

snow slate
#

Yes, for shipping or billing address?

proper ravine
#

billing

#

I need that address for fiscalization of invoices

#

to know what tax I'll apply to user

snow slate
proper ravine
#

tnx