#surajpatidar
1 messages · Page 1 of 1 (latest)
the main way to do that is by using a SubscriptionSchedule, for example https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases#downgrading-subscriptions
stripe.SubscriptionSchedule.create(
customer='cus_GBXV9Q95NFT80k',
start_date='now',
end_behavior='release',
phases=[
{
'items': [
{'price': '{{PRICE_DIGITAL}}', 'quantity': 1},
{'price': '{{PRICE_PRINT}}', 'quantity': 1},
],
'iterations': 1,
},
{
'items': [
{'price': '{{PRICE_PRINT}}', 'quantity': 1},
],
'iterations': 11,
},
],
)
i cant' understand this
how ti work
it set start_date now
I suggest starting at https://stripe.com/docs/billing/subscriptions/subscription-schedules and reading through the full docs first
SubscriptionSchedules are complex and you will have to spend time understanding them before you can use them. If you have specific questions let me know
for upgrade i have use this it right ?
stripe.Subscription.modify(
subscription.id,
cancel_at_period_end=False,
proration_behavior="always_invoice",
items=[
{
"id": subscription["items"]["data"][0].id,
"price": price_id,
}
],
)
that will modify a subscription right now
which is not the same as " downgrade subscription but end of the current subscription period " as you asked. If you want it to be at the end of the period, then you'd need to use a SubscriptionSchedule to set that up.
i want if upgrade immedityly but downgrade after end of the period
cool. Then I think you can use that stripe.Subscription.modify approach for the upgrade and a Schedule for the downgrade.