#pascal_lin - subscription

1 messages · Page 1 of 1 (latest)

gentle thistle
#

Hi there!

#

Indeed in this case you should either update the subscription schedule directly, or remove the subscription from it's schedule before updating the cancel_at_period_end.

lament summit
#

Is it any other field of subscription could not be updated while having subscription schedule...?😔

gentle thistle
#

There are a lot of fields you can update on the subscription when it's managed on a schedule, but not all of them. I don't know the exact list, that's something that you would need to test.

lament summit
#
params := &stripe.SubscriptionParams{
        CancelAtPeriodEnd: stripe.Bool(false),
        ProrationBehavior: stripe.String(string(stripe.SubscriptionSchedulePhaseProrationBehaviorAlwaysInvoice)), // set always_invoice to charge invoice
        Items: []*stripe.SubscriptionItemsParams{
            {
                ID:    stripe.String(sb.Items.Data[0].ID),
                Price: stripe.String(priceId),
            },
        },
    }
    updated, err := subscription.Update(id, params)
    if err != nil {
        return err
    }
gentle thistle
#

I think upgrading a subscription managed by a schedule is possible. But again I would recommend to test your exact use case in test mode to see if it actually works.

lament summit
#

My situation is that I just want to downgrade subscription in next period, and I got an answer from stripe team to using subscription schedule. But it looks like I have to change all my update subscription interaction if I create a subscription schedule....

#

😔

gentle thistle
#

My situation is that I just want to downgrade subscription in next period
If you want to apply changes to a subscription in the future, then yes you need to use subscription schedule
But it looks like I have to change all my update subscription interaction if I create a subscription schedule....
The error you shared earlier is about cancel_at_period_end, and I gave you two options to solve it. If you see any other specific errors, please let me know so we can see how to solve them.

lament summit
#

okay, fair enough, thanks for helping🙏

gentle thistle
#

Happy to help 🙂

lament summit
#

what if I cancel the scheduler before I update subscription?🤔

summer cloud
#

If you cancel the scheduler, the subscription is canceled too

lament summit
#

so once I create a schedule from subscription, I should always update subscription schedule insead of update subscription?

summer cloud
lament summit
#

okay, I will try release action in my test, it looks much better

#

I am worry about release action does not happen immediately so that I still could not update subscription, but it worth to try😂

summer cloud
lament summit
#

one more question, if I release a subscription schedule, but I need to set up a schedule again, should I update the schedule that I get from subscription or create a schedule from subscription again...?

summer cloud
lament summit
#

@summer cloud thanks a lot, it works fine in my test code using release action👏

summer cloud
#

Great, glade to hear that!