#Tanuki-webhook

1 messages · Page 1 of 1 (latest)

steady notch
tired trail
#

hm.... the checkout.session.completed can be sent after customer.subscription.updatedd ?

steady notch
#

it could be yes

tired trail
#

i mean the minimum i need is the customer id that is generated from the checkout session (from the first purchase only), if i receive another event before... ><

steady notch
#

you can get the customer ID from all of those events though

tired trail
#

Yes but the checkout has a metadata that allow me to bind customerid to my app's user

steady notch
#

so in general the way to approach this is to retrieve the relevant object(let's say the subscription object in this case) and sync your system against that, making API requests if needed to pull extra information

tired trail
#

Or maybe i'm doing it wrong

steady notch
#

but yeah the order can't be guranteed so you'll need to workaround this somehow

#

my question would be, do you need any event other than checkout.session.completed ? I don' think you do

#

since when handling that event, you can just retrieve session.subscription from the API and you get all the same context the other events would have

tired trail
#

i need at least to listen to customer.subscription.updated as i use renewable subscriptions and i follow the subscription workflow by listening to customer.subscription.created / customer.subscription.deleted too

steady notch
#

then I'd just ignore customer.subscription.updated if it relates to the start of a subscription

#

since your handler for checkout.session.completed can take the load instead

steady notch
tired trail
#

ok i'm thinking about all that
maybe create the customer myself before the first checkout can save me time / queries too ?

steady notch
#

you could do that as well potentially yep! not a bad idea