#Rajshree - upgrade and downgrade subscription
1 messages ยท Page 1 of 1 (latest)
Hello, that definitely may be possible depending on your setup. Can you tell me a bit more about how you are updating these subscriptions now? Are you updating them directly with the API or are you using the Stripe hosted Customer Portal?
using API
Awesome. That should be pretty easy to do as long as your code knows which is an upgrade and which is a downgrade.
You can set proration_behavior to none for downgrades and create_prorations or always_invoice for upgrades https://stripe.com/docs/api/subscriptions/update#update_subscription-proration_behavior
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
what happens for double downgrades or double upgrades so we handle that logic at our end too?
UPGRADE -
user['stripe_payment_subscription_id'],
items=[
{'id': current_sub['items']['data'][0].id, 'price': new_price},
],
proration_behavior='always_invoice',
billing_cycle_anchor='now'
)```
DOWNGRADE
upd_sub = stripe.Subscription.modify(
user['stripe_payment_subscription_id'],
items=[
{'id': current_sub['items']['data'][0].id, 'price': new_price},
],
proration_behavior='none',
billing_cycle_anchor='unchanged'
)```
downgrade code above doesnt work as expected. we expect that in downgrade it should start a new future subscription and keep the current subscription until next payment date.
I am not sure I understand what is going wrong in the downgrade situation. Can you explain the behavior that you are seeing there?
its currently overriding the current subscription
As in the actual plan or price that is on the subscription?
price on the subscription
Gotcha. To delay when that happens in our API you will can use a subscription schedule https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases#downgrading-subscriptions
Alternatively, your system doesn't necessarily have to rely what is in the Stripe API. If it is possible, you may find it easier to change the price on the Stripe side but wait to change what product you are giving your user on your side
Thank you, One more question. How can we get all the future price setup for a customer ?
As in how do you check if you have already set up a subscription schedule? Or something else?
Nevermind, how does Subscription differ from Subscription Schedule?
are they interchangeable or completely different objects
A Subscription Schedule manages a Subscription. They are completely different objects
You can create a schedule off of your existing subscription for your downgrade, but updates after that might get a bit more complex. https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases#existing-subscription
so subscription schedule can be used instead of subscriptions?
If we plan to use only subscription schedule for a given product, that would be sufficient for all the payments?
They are connected to a Subscription object. So using a schedule is using both.
Not sure what you mean there, can you explain?
Is subscription schedule superset of subscription ?
No, a subscription schedule is an object that updates a subscription based on the schedule's configuration
Thanks Pompey ๐
@mortal relic is this your thread from before?
Gotcha. https://stripe.com/docs/payments/save-and-reuse is our guide to do this
You would use a SetupIntent to gather card details and validate the card
How about if we setup a $0 recurring subdcription
Would stripe charge us to maintain the $0 payments
Okay so if you create a $0 subscription we will actually automatically create a setup_intent that you can use to collect the PaymentMethod
And no, we don't charge a fee on $0 payments
Thank you @lucid birch !