#horlaarsco_best-practices
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/1342227052107141181
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- horlaarsco_best-practices, 2 hours ago, 12 messages
Hello, how do you have this implemented at the moment? Is this a simple subscription with monthly prices at certain quantities?
Do you have the ID of a subscription on your account that I can take a look at? (sub_123)
My initial thought is that you may just be able to update the quantity of your subscription items and pass proration_behavior: 'none' which would mean that nothing would get charged immediately and we would charge for the updated quantity whenever the subscription cycles.
My thought, too, but my problem is at what point do I do this? I would want to do it as close to when the invoice would be finalised as possible
Can you tell me more about why you want to happen as close as possible to the new invoice? Do you refer to the Stripe object to see the number of current active seats?
One thing that could potentially be useful to you here is our subscription schedules API. Basically you can create an object that manages timed subscription updates, you can use that to tell Stripe to change the quantity when the subscription next cycles
https://docs.stripe.com/billing/subscriptions/subscription-schedules/use-cases#increasing-quantity
So the user doesn't get charged for users that are not active in the last month. But if I update it too early and they want to add another user later, it would mean they would pay for the rest of the current month prorated right?
Ah gotcha, yes prorations can definitely get mixed up with multiple updates in one cycle. We prorate on the latest quantity that the subscription is at rather than what the customer last paid
Actually hold on, taking a step back. Let me make sure I understand what you are working for. So if the user is at 10 seats, and wants to switch down to 9, you don't want to charge or credit anything now, just charge for 9 for the next month. But if they up their quantity to 11, you want to charge them for 1 seat for the rest of the cycle and then for 11 at the start of the next cycle?
Yes correct
Gotcha, so a way to do that could be to just do the update as normal when the quantity is upped, and create a schedule for when the quantity will be lowered. This can get a little tricky because you will want to update your subscription differently based on whether it has a subscription on it already or not, but I think would be one of the more straightfoward ways to do this.
Alternatively you can schedule your own API calls for downgrades on your side.
So basically when you get the new quantity they want, check what the current quantity is and whether the subscription's schedule field is populated. https://docs.stripe.com/api/subscriptions/object#subscription_object-schedule
If the quantity is higher than or equal to the current quantity and you already have a schedule, release the schedule and then update the quantity with proration. https://docs.stripe.com/api/subscription_schedules/release
If the quantity is lower than the current quantity, create a schedule from the current subscription if there is not one already, then update the schedule's second phase to have the quantity that you want. https://docs.stripe.com/api/subscription_schedules/create#create_subscription_schedule-from_subscription
I think there is an upcoming invoice event sent 3 days to expiry, I can schedule the downgrade then?
Yes, you can schedule either in terms of full cycles or to a specific timestamp. So you could calculate the timestamp for three days before the end of your current cycle and set the next phase to begin then. Phases don't start a new cycle by default
But phases can reduce the amount and quantity right?
Exactly, you can schedule whatever kind of update you want.