Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

control: rework subscription and schedule approach #218

Merged
merged 8 commits into from
Jan 19, 2023
Merged

Conversation

bmizerany
Copy link
Contributor

This changes the scheduling logic to consider the subscription the
source of truth, rather than trying to force the schedule API into being
it. The new approach drastically simplifies the ability to reason about
how Tier converts a single timeline into the complex beast that is
Stripe schedules and subscription schedules because we can now say that:
All schedule reads are done through subscriptions via the active
subscription's current "schedule", and all schedules are created and
updated via schedules.

Create: Schedule API creates subscription.

Updates: The schedule API updates subscription.

Reads: The subscription API shows current state, including current the
current subscription schedule

This also relaxes constraints for cancel phases. Previous to this
commit, cancellations has to go into effect immediately. Now cancel phases
may appear in multi-phase schedules where the canceling happens in the
future. The new restriction is that they are the last phase.

The new "last phase" restriction may be relaxed in the future by
canceling the current schedule as it does now, but then create a new
subscription schedule, scheduled in the future.

This also adds the ability to update default payment information for a
stripe customer via OrgInfo.

This changes the scheduling logic to consider the subscription the
source of truth, rather than trying to force the schedule API into being
it. The new approach drastically simplifies the ability to reason about
how Tier converts a single timeline into the complex beast that is
Stripe schedules and subscription schedules because we can now say that:
All schedule reads are done through subscriptions via the active
subscription's current "schedule", and all schedules are created and
updated via schedules.

Create: Schedule API creates subscription.

Updates: The schedule API updates subscription.

Reads: The subscription API shows current state, including current the
current subscription schedule

This also relaxes constraints for cancel phases. Previous to this
commit, cancellations has to go into effect immediately. Now cancel phases
may appear in multi-phase schedules where the canceling happens in the
future. The new restriction is that they are the last phase.

The new "last phase" restriction may be relaxed in the future by
canceling the current schedule as it does now, but then create a new
subscription schedule, scheduled in the future.

This also adds the ability to update default payment information for a
stripe customer via OrgInfo.

fix static check
@bmizerany bmizerany marked this pull request as ready for review January 19, 2023 21:53
@bmizerany bmizerany merged commit 30d4122 into main Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant