#varovas
1 messages ยท Page 1 of 1 (latest)
Hi there!
You can see all webhook events related to Subscriptions Schedules here: https://stripe.com/docs/api/events/types#event_types-subscription_schedule.aborted
How to test them if local event listener doesnt have some of the webhook events
subscription_schedule.completed is missing for example
How to test them if local event listener doesnt have some of the webhook events
Can you clarify what you mean by "local event listener"? What is this screenshot exactly?
This is screenshot from stripe-cli command line. Local event listener is here
The Stripe CLI will listen to subscription_schedule.completed. What exactly are you trying to do?
Actually command line does not listen to subscription_schedule.completed. What I am trying to do is, I create subscription schedule phase to apply subscription update on the next billing cycle. And I have that update on my end. So I want to delete that update on my end, when stripe subscription schedule completes that phase.
Actually command line does not listen to subscription_schedule.completed.
What Stripe CLI command are you running? If you get asubscription_schedule.completedevent and are using thestripe listencommand, you will receive that event.
Note that thesubscription_schedule.completedis sent when all the phases of the Subscription Schedule have ended.
To listen events I use this command: ./stripe listen --forward-to wantly.top/stripe/webhook
Yes, so IF you get a subscription_schedule.completed event, it will be forwarded to your endpoint. My guess is you simply never got that event.
OK, that's different. It's true that you cannot generate a subscription_schedule.complete event with the CLI. If you want to generate that event, you'll have to do it manually (by creating a Subscription Schedule and then using Test Clocks to get to the end of the schedule https://stripe.com/docs/billing/testing/test-clocks)
What I am trying to do is, I create subscription schedule phase to apply subscription update on the next billing cycle. And I have that update on my end. So I want to delete that update on my end, when stripe subscription schedule completes that phase.
Unfortunately I'm still not sure I understand what you are trying to do. Can you maybe share a concrete example of exactly what you want to do?
I did that, but that webhook event never arrives
Ok, here's an example
User has per seat subscription. Basic plan, 2 users; user decides to downgrade to 1 user. Then I create subscription schedule with 1 user and set phase start date to current subscription period end. Then I create a record in my database with subscription schedule id, so I can show my customer that he has subscription schedule. When than subscription schedule phase is activated, I want to delete that record in my database.
Oh, I see! Thanks for the clarification!
I guess you can just listen to customer.subscription.updated
is there some attribute in customer.subscription.updated that update was made due to subscription schedule phase?
In the webhook event payload you can see exactly what changed on the Subscription object, so in your previous example you would see the quantity decreased. However no it would not specifically mention that it comes from the subscription schedule.
hmm
Is there any webhook event that I could know if new billing period just began? ๐
I think customer.subscription.updated does this.
Yes, it fires every time the subscription is updated, including when a new billing period starts. Then you can check in the event payload what exactly changed on the subscription.
I think I will try to check if customer.subscription.updated payload current period end is different than current subscription period end, then consider that this is billing cycle update
Yes that should work!