#TazI1I - Webhooks

1 messages ยท Page 1 of 1 (latest)

nova elk
grizzled wedge
#

Hi @nova elk , ok but in this output :

#

its a subscription

nova elk
#

Yup, that's the object

grizzled wedge
#

is there a field that says subscription is active or not?

#

it's plan>active : True ?

#

or maybe I don't need to do this verification, are we sure that the object send and only for the registration of a subscription?

nova elk
#

or maybe I don't need to do this verification, are we sure that the object send and only for the registration of a subscription
I'm sorry I don't really understand this question. What are you trying to verify?

#

The event is customer.subscription.updated meaning something about this subscription has been changed.

#

You can see in the previous_attributes property that the default_payment_method and status have been changed so I would look at those fields in the Subscription.

grizzled wedge
#

I created a local database with my product ids and their names
I have a server that listens to the weebhook for :

  • customer.subscription.created
  • customer.subscription.updated
  • customer.subscription.deleted

I would like to update my users database, and according to the received webhook modify the subscriptions locally. Do I only need to get the customer id and the products id to modify my user when I receive a wekhook, or do I need to get a field as status: deleted or status:created?

Translated with www.DeepL.com/Translator (free version)

nova elk
grizzled wedge
#

but my status is incomplete

#

in my JSON output

#

but my user is create and my user is subscribe

nova elk
grizzled wedge
#

ok i understand

#

when i create user and subscribe to my plan, stripe send me a webhook customer.subscription.create with this object and status:active id ... and when i receive to stripe a webhook customer.subscription.deleted with an object id ,prduct, active:cancelled. I can modify my database without problem ?

nova elk
#

The Stripe webhook request provides you the current state of the object in the event at the time the request is sent. You can update your database to locally reflect the state of this record.

grizzled wedge
#

Very well you understood my pointy question
we can trust without problem to complete our local database

#

perfect I will be able to develop my code well

#

Thanks you guy

nova elk
#

Happy to help ๐Ÿ™‚