#TazI1I - Webhooks
1 messages ยท Page 1 of 1 (latest)
Hi ๐
We have a reference for the webhook event objet here:
https://stripe.com/docs/api/events/object
But let me know what you're confused about.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yup, that's the object
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?
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.
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)
The subscription object has a status field to help you answer these questions. You can review how it works here:
https://stripe.com/docs/api/subscriptions/object#subscription_object-status
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
but my status is incomplete
in my JSON output
but my user is create and my user is subscribe
I just looked at that event. The previous status was incomplete the current status is active
here is the event in question: https://dashboard.stripe.com/test/events/evt_1L6HfmE37gDY06V3JmNvs9Zd
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 ?
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.
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
Happy to help ๐