#blackbearftw_subscription-cancel

1 messages ยท Page 1 of 1 (latest)

mighty lionBOT
shy surgeBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

mighty lionBOT
#

๐Ÿ‘‹ 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/1237898600877523037

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

tulip kelp
#

I just sat thinking there like okay what happens when a user cancels, won't the status go to cancelled right away?

#

so I looked it up and that is correct

#

but I want the customer to be able to still use their subscription for the remaining paid period, this isn't possible if the subscription updated event is fired right away

#

setting the status to cancelled

#

so I read the documentation

#

but I am using a checkout session so I cannot set that property

crystal dawn
#

Why would you create a Subscription with cancel_at_period_end set to true?

#

That....isn't a subscription at that point

tulip kelp
#

no I mean

#

in my application I am using the subscription status to see if the user can do the premium actions

#

as long as its active, they can

#

but when they cancel mid period

#

I want them to still be able to use the subscription till the end of the payed period

crystal dawn
#

How are your customer canceling?

tulip kelp
#

through the customer portal

#

provided by stripe

crystal dawn
#

How are you configuring the Customer Portal?

tulip kelp
crystal dawn
#

You can set the features.subscription_cancel.mode to at_period_ned

tulip kelp
#

just used the tutorial

tulip kelp
#

okay

#

but to what event should I then listen?

#

to know that the status is cancel

#

after the period has ended

#

or does stripe refire the subscription updated event for that?

crystal dawn
tulip kelp
#

yeah currently I am doing this

 else if (stripeEvent.Type == Events.CustomerSubscriptionUpdated)
        {
            var sub = stripeEvent.Data.Object as Subscription;
            
            var tenant = dbContext.Tenants.FirstOrDefault(t => t.SubscriptionId == sub.Id);
            //
            if (tenant is not null)
            {
                tenant.SubscriptionStatus = sub.Status;
                await dbContext.SaveChangesAsync();
            }
#

then later I will just be like isSubscriptionActive which just checks that column for having the value active

#

so I only want to change that column to represent canceled, at the end of the period

#

otherwise the whole system will take that into effect instantly

#

so customer.subscription.deleted fires at the end of the subscription, when the period ends and the subscription was cancelled?

crystal dawn
#

That would let you simulate a customer going through this whole process and you could use the Stripe CLI and stripe listen to forward all the webhook events to your local dev machine. I would start there to examine all the events that fire, just to be certain there isn't another event that would work better for your integration

tulip kelp
#

Cool

#

you are right!

crystal dawn
#

Sorry I should have mentioned, when you use Test clocks it stacks up A LOT of actions that can take a little while to process

tulip kelp
#

yeah alright

nova spruce
#

Sorry about that!, will do

tulip kelp
#

it works tho

#

cool

crystal dawn
#

๐ŸŽ‰ Happy to hear it ๐Ÿ™‚