#manuSW

1 messages ยท Page 1 of 1 (latest)

empty hareBOT
paper lotus
#

What's the error

#
{ "error": { "message": "The subscription is managed by the subscription schedule sub_sched, and updating any cancelation behavior directly is not allowed. Please update the schedule instead.", "request_logurl": "https://dashboard.stripe.com/logs/req", "type": "invalid_request_error" } }```
quiet void
#

ok, thansk!!!

#

but when i should releas the subscription from the schedule? when subscription.getSchedule() != null ??

paper lotus
#

Well you can't perform direct updates to a Subscription (like cancel it) when it's controlled by a schedule

quiet void
#

but i can control that when stripe throws me the exception

paper lotus
#

If that field is set, then call the release endpoint and then cancel. Otherwise just cancel

quiet void
#

super!

#

my code

#

Subscription subscription = Subscription.retrieve(stripeSubscriptionId);//--new codeif (subscription.getSchedule() !=null) { SubscriptionSchedule subscriptionSchedule = SubscriptionSchedule.retrieve( subscription.getSchedule() ); SubscriptionSchedule updatedSubscriptionSchedule = subscriptionSchedule.release();}SubscriptionUpdateParams params = SubscriptionUpdateParams.builder() .setCancelAtPeriodEnd(true) .build();subscription.update(params);

paper lotus
#

Did you try it?

quiet void
#

i just tried! and it works!

#

Thanks ynnoj!!

paper lotus
#

np

quiet void
#

i am new in the community

#

some rating points i can give you hehe or something similar?

paper lotus
#

Your kind words here are more than enough ๐Ÿ™‚

quiet void
#

Thanks a lot!! and have a nice day!