#blackbearftw_webhooks
1 messages ¡ Page 1 of 1 (latest)
đ 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/1326629911552852119
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hey there
You can listen for customer.subscription.deleted, see: https://docs.stripe.com/billing/subscriptions/event-destinations#events
I am guessing if the user cancels a subscription, they will still be billed at the end of the period. Currently trying to handle the user deleting their account (automatically cancelling their subscription) and just a normal cancellation.
But my system only looks at the current status of the subscription, if its not "active", it will basically lockout the user. But I only want that to happen at the end of the billing period, since their subscription should still be valid for e.g. that month
I don't know
That said, same concept.
The Subscription will stay in status: active until the Subscription is actually canceled, at which point it moves to status: canceled and the customer.subscription.deleted Event fires.
oh okay
but I have the choice to either do that right away or do it at the and of the period
that is what you configure cancel_at_period_end
for
Yep
Recommend testing all of this stuff out in test mode using Test Clocks: https://docs.stripe.com/billing/testing/test-clocks
Sure
one last question, if you choose to cancel their subscription right away, will they also be billed right away?
or is that still at the end of the period
its a pay as you go subscription btw
Are you using Customer Portal here? Or you are canceling yourself via the API?
customer portal
Gotcha then that depends on what you set for proration_behavior: https://docs.stripe.com/api/customer_portal/configurations/create#create_portal_configuration-features-subscription_cancel-proration_behavior
If you set it to create_prorations then it will create a proration item to be charged on the next Invoice for that Customer.
okay
yeah I just heard they want the system be accessible till the end of the period, then after the period ends they want the customer to be billed one last time and then basically switch the status on our end to "cancelled" and then deal with everything related to that
Hmm that is a bit more complicated.
In that case you would essentially need to charge them using a one-off Invoice after the Subscription cancels.
really
mhm
so won't my meter work if the customer has cancelled their subscription
yeah
basically, they cancel their subscription, which is fine, it waits till the period is over, then gives our webhook the cancelled event (doing stuff in our system) and after that it of course bills them
Okay I think this should still bill them at the cancellation point
But really I haven't tested this in quite a while
So you would want to test
using the test clock right
Yep
but customer.subscription.deleted gets executed at the end of the period?
Yes
Alright and now I just need to find in stripe where I can set that behaviour
because I am guessing the default is to fire that event right away
if I cancel it manually through the API, anything I need to do there?
You update the Subscription to set cancel_at_period_end: true to do this same behavior via the API: https://docs.stripe.com/api/subscriptions/update#update_subscription-cancel_at_period_end