Blog
Cancelling a stripe subscription on 'period end'
01.17.2021 | Tutorial Backend | Katy G
Stripe's documentation on cancelling a subscription at the end of a period isn't entirely up to date.
https://stripe.com/docs/billing/subscriptions/cancel
For cancelling at end of period, the docs say to do the following:
Stripe::Subscription.update(
'sub_',
{
cancel_at_period_end: true,
}
)
Easy enough, right?
WRONG.
When actually doing this we were getting the following 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.",
"type": "invalid_request_error"
}
}
After contacting stripe support, if you wish to cancel at the period end you need to do the following:
- Update phases on subscription schedule object to pass only current phase.
- Set end_behavior to 'cancel'
Stripe::SubscriptionSchedule.update(
'sub_sched_',
{end_behavior: 'cancel'},
)
Links:
https://stripe.com/docs/billing/subscriptions/subscription-schedules#updating
https://stripe.com/docs/api/subscription_schedules/update?lang=ruby
Share
Read More
Related Posts
06.30.2021 | Culture | Katy Scott
At Focused Labs, collaboration is key to how we work together; it helps our teams learn from each other, brings us closer and helps us become more efficient...
06.23.2021 | Culture | Austyn
Late-night feedings and diaper changes, the 3-4 month sleep regression, teething, and a growth spurt all mean I'm getting less sleep than...
05.12.2021 | Culture Backend Frontend | Ryan Taylor
Temporarily disrupts "normal" business operations and allow self-organized teams to rapid prototype around their interest areas
04.27.2021 | Culture | Erin Hochstatter
Several years ago, I'd been trying to find an approach to software consulting that made sense for me [...]
01.28.2021 | Backend | Parker Drake
Recently I found myself needing to validate fields in a Spring Boot controller written in Kotlin...
01.22.2021 | Tutorial | Luke Mueller
⌘+⇧+g is the way to go
01.21.2021 | Devops | Katy G
Kube jobs running wild? To delete successful jobs...