#Temitope-schedules
1 messages · Page 1 of 1 (latest)
Hello! Can you show me an example of a subscription schedule you were not able to cancel?
What do you mean by that? I just want to see an example request/object ID of what you've tried so far so I can take a closer look
It's a wrong reply.
I have a schedule that releases a subscription every month. I want the to customer to cancel at anytime. So I've tried to cancel and it says the schedule must be active or not started
Same thing happens when I tried to release it before canceling it
Gotcha, so do you have an example request/object ID of one that you tried to cancel?
So from what we have gathered, Stripe prevents the cancelation of a subscription schedule unless the subscription is in the Active state. Why does the state of a subscription change? What is the trigger? How do we place it back into active when it changes so that the end user can cancel their pass through the api?
A schedule can be cancelled as long as it's status (the stat of the schedule) is not_started or active this is because it doesn't make sense to cancel the schedule in any of it's other statuses (https://stripe.com/docs/api/subscription_schedules/object#subscription_schedule_object-status):
completedandreleased-> at this point, the schedule is no longer actively modifying/affecting a subscription, so there isn't really anything to cancelcanceled-> the schedule is already canceled
If the Schedule is no longer active that means it's not tied to a Subscription, so you'd need to cancel the Subscription itself (and not the schedule)
I have an ongoing s7bscription with a subscription schedule, what would cause the subscription to go into released status?
It is not being released by our code.
All subscriptions should remain active until they are canceled. So why are they being modified by Stripe to a released status?
This is preventing our end-users from being able to cancel their subscriptions.
Schedules get automatically released once the last phase is over - have you checked this schedule to see whether it's last phase is over?
Can you elaborate on the phase aspect. How can we tell what the phases are? Where would we look to see this info?
Sorry, backing up for a minute - if you aren't aware of what phases are, why are you using Subscription Schedules?
I am not the developer. I am working with temitope on this project. Please explain this to me.
SubscriptionSchedule::create([
'customer' => $customer->id,
'start_date' => $startDate,
'end_behavior' => 'release',
'phases' => [
[
'items' => [
[
'quantity' => 1,
'price' => $price->id,
]
],
'proration_behavior' => 'none',
],
],
'metadata' => [
'pass_id' => $passId,
'customer_id' => $customerId
]
]);
That's our current code for creating the schedule
We need subscription schedule because we are subject to certain date requirements for payments and certain parameters that need decide whether the subscription will be immediately canceled or if their will be one last payment required before the cancelation occurs.
Just leaving some reading material for your earlier question: https://stripe.com/docs/billing/subscriptions/subscription-schedules#subscription-schedule-phases - each Subscription schedule has a set of phases, that defines what the state of the associated Subscription should be while the schedule is in a certain phase. Once all those phases are over, the schedules ends and either releases the subscription from the schedule or it cancels the subscription (based on the code it looks like you're just releasing the schedule since it has end_behavior: release).
An easy solution here is that you change your code so that if the schedule has not started yet then you cancel the schedule itself, but in all other cases you cancel the Subscription (which will cancel the assocaited schedule as well)
Can we leave the subscription schedule in active mode until a customer decides to cancel through the API?
How can we achieve " but in all other cases you cancel the Subscription (which will cancel the assocaited schedule as well)"
You'd just use the Subscription ID and make an API request to cancel the subscription (https://stripe.com/docs/api/subscriptions/cancel?event_types-payment_intent.payment_failed)
How would we change the code to maintain the subscriptions in Active status indefinitely, or until customer cancels?
Maybe I should provide some more detail.
- When a customer signs up, depending on the date, they can select to pay for the full current month, the 2nd half of the month the following month.
- If they choose the half month option, they will be billed for half month fee.
The first payment happens at the time of sign-up. Following payment will be on the 25th of the current month or of the next month, again this depends on the date of the signup
I think you're mixing up Subscriptions and Schedules - Subscriptions will stay active until they are cancelled. The Schedule is what will be released (and no longer active), but the underlying Subscription will still be active
The schedule are not always in release mode. If this happens, the release subscription is the current active subscription. If we cancel the released subscription will this cancel the parent schedule?
When a cancelation happens, we also have some parameters to abide by.
- If cancelation takes place between the 1st and 24th day of the month, the last payment will be taken on the 25th day of that current month. However, if cancelation takes place between the 25th and 31st of the month, the last payment would have already been taken on the 25th day of the current month.
When a subscription has been released it isn't tied to any schedule at all - so there isn't any schedule to cancel
Ok. So how do we keep the schedule in a state that allows cancelation at anytime?
Sorry let's back up, because you keep using schedule and subscription interchangeably in the wrong places
Yeah, sorry about that.
(Give me a few minutes to type a bunch of stuff out and try and clarify)
The schedule is created to serve the requirements I previously mentioned. Namely the customer must provide 1 months notice to cancel.
And the customer can choose to pay for a full or half month at the start of the subscription depending on the date of same.
A Subscription Schedule is primarily used to schedule future changes to a Subscription. It's not meant to be a persistant, long-lived object unless you're constantly making changes to your Subscriptions. Once a Schedule has released its associated Subscription there is no tie between the Schedule and the Subscription - they are complete separate objects that have no affect on each other. If a Subscription has already been released and you need to schedule a new upcoming change, you can create a NEW subscription schedule and tie it the subscription (see https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases#existing-subscription).
If you have a Subscription Schedule there are two ways to cancel it immediately
- if the schedule is active or not_started you can cancel the SCHEDULE itself
- if the subscription is not already cancelled, you can cancel the SUBSCRIPTION Itself
Does that make sense?
Ok. So if we create a subscription, and we use the schedule to prorated the first month to half payment. We would have 1 iterations. What should our end behaviour be after the schedule is released?
After the schedule is released the subscription will just continue on in the state it was in after it was released
In this scenario, would a customer be able to cancel the subscription?
So I think our issue is that we are creating a schedule every month.
And it is being released every month.
Yes, a released Subscription (that isn't already canceled) can be canceled through the API
You're creating a NEW schedule for a single customer every month?
Stripenis not maintaining one subscription, it is creating a schedule every month
Right now, maybe because of the schedule end_behavour as release
we have stripe scheduling a subscription every month
if we update the schedule end_behavour, will it stop scheduling every month?
If a schedule is released, we already know a subscription is currently in active phase, if it's canceled. a new one is released next month by stripe.
which we do not want. we only want a one-time schedule and an active subscription. whereby when the subscription is canceled, the schedule is canceled as well
What do you mean by "scheduling a subscrition every month" - are you just talking about the natural renewal behavior, or are you talking about actually creating a new Subscription Schedule every month
Again, please try and be really crisp about the how you're phrasing things because you're saying schedule eveywhere and it's hard to pinpoint whatyou want
Can you describe the natural renewal behaviour?
Let me send you a screenshot.
When you create a Subscription in stripe, it'll automatically renew based on the price you've selected. So if you create it with a monthly price it'll generate a new Invoice and charge for it every month
Let me be really clear:
We want an ongoing subscription.
We want end users to be able to cancel through API
There are some requirements at start and at cancelation of subscription which based on what you sent would be when we would create a subscription schedule to address these. But when the subscription is in the normal ongoing mode, we want enusers to be able to cancel.
No matter what, you can immediately cancel a Subscription through the API. It's not your end users who are cancelling it themselves (unless you've enabled this behavior through something like the customer portal) - it's you making the API request to stripe to cancel the Subscription. And yes, you can make this request as long as the Subscription has not been already cancelled
if we canceled the active subscription, does it cancel the undelying schedule?
So the question becomes, how do we end the initial subscription schedule in a way that will put the subscription in the normal ongoing mode?
What would that code look like?
If you cancel an active subscription, it will cancel it's underlying Schedule it if has one (but not all subscriptions will have an underlying schedule)
And you already have the code needed to get the schedule in it's normal ongoing mode - once it's been released the subscription will continue with it's natural renewals. If you want to release it from the schedule early, you can do so through the API (https://stripe.com/docs/api/subscription_schedules/release)
Yup, go ahead - I may have to go soon, but if I'm not able to answer them all someone else will hop in to help