#varovas

1 messages ยท Page 1 of 1 (latest)

gloomy caveBOT
last mulch
#

Hi there!

fervent loom
#

How to test them if local event listener doesnt have some of the webhook events

#

subscription_schedule.completed is missing for example

last mulch
#

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?

fervent loom
#

This is screenshot from stripe-cli command line. Local event listener is here

last mulch
#

The Stripe CLI will listen to subscription_schedule.completed. What exactly are you trying to do?

fervent loom
#

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.

last mulch
#

Actually command line does not listen to subscription_schedule.completed.
What Stripe CLI command are you running? If you get a subscription_schedule.completed event and are using the stripe listen command, you will receive that event.
Note that the subscription_schedule.completed is sent when all the phases of the Subscription Schedule have ended.

fervent loom
#

To listen events I use this command: ./stripe listen --forward-to wantly.top/stripe/webhook

last mulch
#

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.

fervent loom
#

If i trigger subscription_schedule.complete, I get this

last mulch
#

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?

fervent loom
#

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.

last mulch
#

Oh, I see! Thanks for the clarification!

#

I guess you can just listen to customer.subscription.updated

fervent loom
#

is there some attribute in customer.subscription.updated that update was made due to subscription schedule phase?

last mulch
#

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.

fervent loom
#

hmm

#

Is there any webhook event that I could know if new billing period just began? ๐Ÿ˜„

last mulch
#

I think customer.subscription.updated does this.

fervent loom
#

this hook fires on the subscription update too

#

I mean to subscription upgrade

last mulch
#

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.

fervent loom
#

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

last mulch
#

Yes that should work!

fervent loom
#

But that could be a cool feature to get a webhook subscription_schedule.phase.applied

#

๐Ÿ˜„