#nerder

1 messages · Page 1 of 1 (latest)

queen haloBOT
gleaming marsh
#

it seems like that in production the behaviour is different from test environment

brazen sky
#

no, don't see why it would be(you're creating a sub, not updating one)

gleaming marsh
#

because usually when I create a subscription (without freeTrial), i create the sub incomplete, an when the client secret is returned to the frontend and the payment of the first invoice is completed

#

than it emits a customer.subscription.updated

#

Ok i think i knew what happen

#

it was my bad

#

for some reason in local this are the events that are triggered

#

the last customer.subscription.updated has been triggered manually from the dashboard

brazen sky
#

will look in a little bit

#

ultimately why does it matter? what do you need the event for in your flow?

gleaming marsh
#

because in my webhook handler i'm only listening for customer.subscription.updated has I thought that was not necessary to handle created since was always followed by the updated one

#

but this doesn't seems to be the case in prod

#

so I'll need to handle that event in my webhook in order to replicate the subscription in my DB

brazen sky
#

the recommended way to create the subscription in your database is either:

  • create it when you call the Create Subscription API and synchronously update your DB at that point; or
  • listen for the invoice.paid event where the Invoice object has billing_reason:subscription_start
gleaming marsh
#

make sense

#

I can eventually test for that