#fagun-shah_webhooks

1 messages · Page 1 of 1 (latest)

oak troutBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1318195503992934460

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

placid wharf
#

Explained here: https://docs.stripe.com/billing/subscriptions/cancel#events

Sent when you cancel a customer’s subscription at the end of the billing period. This triggers when you set cancel_at_period_end to true and the event reflects a change in the cancel_at_period_end value for the subscription.

#

(you'd use customer.subscription.updated yes)

rain schooner
#

So customer.subscription.updated will not be triggered if we update other details of the subscription?

#

Like duration or amount etc?

placid wharf
#

Yes it will. But you'd check the cancel_at_period_end value and compare it against the previous_attributes hash to see if it has changed

rain schooner
#

oh, that is bad

#

Something that should be a separate event is all mixed up with other things

#

subscription_schedule.canceled , what will this do then?

placid wharf
placid wharf
rain schooner
#

okay

#

Let me try these things and I will get back here if need extra help

#

thanks

#

is there sample payload for customer.subscription.updated?

placid wharf
rain schooner
#

and then make changes to other part of the subscription

#

then I have first store value of each subscription somewhere and match against it?

#

Sorry, but I don't understand hash and other things

#

I am trying to use webhooks as a no-code guy, I understand APIs

placid wharf
#

Well webhooks are quite complex in nature so generally recommended you have some coding experience as your requirements dictate. But the customer.subscription.updated payload would include the latest Subscription object, where cancel_at_period_end: true, and a previous_attributes hash which would have the old values for any fields changes in the update

#

In the scenario you describe, previous_attributes[cancel_at_period_end] would be false so you can infer from that that they just set it to cancel