#nerder
1 messages · Page 1 of 1 (latest)
Can you share more details of what you want to achieve? can you share a screenshot from the dashboard ?
I think that's a dashboard feature only, there is no public field for that.
No that's the Subscription Schedule attached to the Subscriptionif there any
yes, but I think that if the schedule is not null i can safely say that there is an update scheduled?
from the webhook i receive this schdule: 'sub_sched_1NByjLLAVB3C1lDIhvQzABIg'
I'm not sure about that honestly. You can do some test using test clock and advance time to see if after the update happens the schedule will be detached or not from the Subscription :
https://stripe.com/docs/billing/testing/test-clocks
no you need to create a new simulation
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Ok understood, the webhook is fired
Hi! I'm taking over from my colleague. Please, give me a moment to catch up.
Please, let me know if you have any other questions.
no worries
i'm still completing the test they tasked me to do
ok i've tested it but no luck
even if the schedule is complete, is not detached form the subscription 😦
Ok i really don't know how to do it actually
What's the issue you're facing?
No issue, I'm trying to add a badge similar as the one you have on the dashboard for when there is a scheduled update
But I don't know where to find that property
Sorry, I'm not following. What badge?
You have access to the thread? Please read above
Just to double check, you want to know if a Subscription has a Schedule attached?
I want to present the same information as you do to the user, "update scheduled"
My guess was to use the schedule, but after some testing, the schedule is not released when completed
what about pending_update ?
No, that's related to the next billing cycle.
yep i see, it should have been schedule, feels like a bug is not removed when completed
You can set the end_behaviour: "release": https://stripe.com/docs/api/subscription_schedules/object#subscription_schedule_object-end_behavior
And check if there's a schedule and if the Schedule have phases left.
i'm doing it like this in my integration
await this.stripe.subscriptionSchedules.update(
schedule.id,
{
end_behavior: 'release',
proration_behavior: 'none',
phases: [
{
start_date: subscription.currentPeriodStart,
end_date: subscription.currentPeriodEnd,
items: [
{
price: schedule.phases[0].items[0].price as string,
},
],
},
{
start_date: subscription.currentPeriodEnd,
items: [
{
price: newPriceId,
},
],
},
],
},
{
stripeAccount: gym.accountId.value,
},
);
but i'm not sure how can i set an end_behaviour from the dashboard
release is the default so, is probably not working as you expect it too
because even when the schedule is complete, the next subscription.updated has still schedule
You mean "release" is not set by default, when creating a Schedule from the Dashboard?
no I mean that when creating a schedule from the dashboard end_behaviour is always release
you can't set it to cancel
which is fine
but still is not "released"
check this simulation: https://dashboard.stripe.com/acct_1FuM5ALAVB3C1lDI/test/customers/cus_NxvW7NpsZiBTFG
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
you will see what I mean
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
this event has been triggered by the scheduled update, but still you can find schedule set (and not null as expected)
Hi! I'm taking over this thread.
hey
Is your goal to know if an existing subscription schedule has upcoming updates, like a new phase that will start?
not exactly, my goal is to achieve this
and then remove that badge update scheduled badge when the update has been completed
You want to remove the badge update scheduled from the Stripe dashboard?
nope, I want to present it and remove it in my app
mimicking how you are doing it in the dashboard
Can you share a subscription ID, and clarify exactly what you would like to show in your own app?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
in my app i'm allowing users to downgrade their own subscriptions, but instead of letting them to do that immediately, i schedule the downgrade at the end of their current period
this is all working fine, now as a last touch I want to present them a badge in their membership page (in my app) that the update is scheduled to happen and what will happen then (exactly as you are doing here in the dashboard)
the problem is that i'm not able to find any parameter to use to achieve such behaviour
because even if the end_behaviour is set to release when the scheduled update is completed, and the scheduled update apparently has no more phases is still attached to the subscription object.
so I can't reliably use schedule to check if a subscription has still a pending scheduled update
You could check the phases of the subscription schedule to see if there are upcoming phases or not.
because from my tests using test clock schedule doesn't return to null when the phases have completed, so by checking that field i will wrongly present the user a scheduled updated which is non existent
But you can check the start_date of the phase to know if there are any upcoming phases or if they all finished
please check the phases of this sub_sched_1NBzhJLAVB3C1lDIIkdCEnB9
they should be all compelted
I see two phases, which all have a start_date in the past. So it means there will be no upcoming changes.
Oh wait, there is one phase with a start date in June.
So there will be one upcoming change in this case.
nono i think is in the past as well
I see what you mean tho, but is very inconvenient to do so, because it means that i need to perform an API call since in the webhook the schedule is not expanded
so every time for every user just to present a little badge i need to perform an API call, compare the time and all. I bet you are not doing it like this in the dashboard
I have no idea how it's done in the Stripe dashboard, but we probably need to do at least an API call to check.
another option might be to use some webhook event and save the scheduled update on the customer then fetch it later
but I don't see any
Well you created the subscription schedule, so you know when the schedule will end. And then you could save that date directly in the metadata of the subscription or the customer object.
And there's the subscription_schedule.created event
yes, the date is not the issue, I know when it will end but there is no difference between a subscription that has a schedule (still active) and one that has one completed
I feel like in the end_behaviour is missing something in between release and cancel
because with release the sub schedule is still there, but with cancel it will also cancel my subscription right?
actually! There is a status in the subscription schedule
Hi there 👋 jumping in as my teammate needs to step away. Please bear with me a moment while I catch up on the context here.
Ok, I think we have some options, but are all a bit inconvenient. Maybe you can help me figure out the best option I have here.
Sorry, there is more context here than I realized, could you summarize what you're trying to accomplish here for me?
in my app, I'm allowing users to downgrade their own subscriptions, but instead of letting them do that immediately, I schedule the downgrade at the end of their current period.
This is all working fine, now as a last touch I want to present them a badge on their membership page (in my app) that the update is scheduled to happen and what will happen then (exactly as you are doing here in the dashboard). The problem is that I'm not able to find any parameter to use to achieve such behavior because even if the end_behaviour is set to release when the scheduled update is completed, and the scheduled update apparently has no more phases is still attached to the subscription object.
So I can't reliably use schedule to check if a subscription has still a pending scheduled update.
pretty much this
I want to achieve this in the UI of my app
and remove that badge once done with the update
My options are:
- perform an API call to retrieve the status of the subscription_schedule
- listen for
subscription_schedule.updated, store it in my DB and keep track of the status
Do you have an example of a Subscription from your testing where the Subscription Schedule completed with an end_behavior or release but it was still referenced on the associated Subscription. I may be mistaken but I thought the Schedule was unassociated from the Subscription with release.
yes give me a sec
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
this one
the sub_schedule is this one: sub_sched_1NBzhJLAVB3C1lDIIkdCEnB9
but it makes actual sense that doesn't ever come back to null, because the sub_schedule keeps track of it with a status so there is no need to clean it up in the sub
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
so I guess it will be in released, but since from the subscription, I can only check for null to understand if there is a sub_schedule or not I need to store it somehow 😦
It looks like the test clock for that simulation is still in the last phase of the subscription schedule, if you advance the time another billing period does the schedule get removed from the Subscription?
let me try
I guess that still probably isn't what you want though, since the Subscription Schedule is already in a state where it won't make any more changes to the Subscription unless it is updated.
yes exactly
in fact in the dashboard the badge is gone
but for sure that badge is presented doing along the lines of:
if(sub_schedule.status == 'active') return ScheduledUpdateBadge()
this is my only feasible option then
- listen for
subscription_schedule.updatedfrom the webhook, store inside my customer object the sub_schedule and keep track of the status
If i understand how is designed, once a sub_schedule is created and attached to a subscription it wont ever being "detached"
Agreed, I do think it would be a smoother process to track this state on your end.
yes, even if it will be cool to have the sub_schedule status attached to the sub object
i need to do a quite long integration to support this little feature just because I have no way to keep track of that sub_schedule status from the subscription
it's ok tho, I will prioritize accordingly. Thank you so much for helping me out here
Any time! Feel free to reach out if you run into any hurdles with that, we're always happy to help.
yep
there is a way to report this feedback tho?
it's a bit of a friction and I know you guys are tracking this kind of things
also, there should be some more documentation around this because both you and @dense smelt thought it would be as I expected to (to detach from the sub)
Yup, I can definitely take down your feedback and relay it to our teams.
It was detached once you advanced the test clock
ah ok, It actually was at some point!
Yup, at the end of the schedule's last phase.
than to me it's even more weird :S
Definitely agree from the perspective we're looking at it here.
that's fine
thank you so much @half dagger i wont bother you anymore
have a good rest of the day and good weekend
Thank you, I hope you do the same!