authgear / authgear/authgear-server
Support downgrading subscription items with schedule
- Dominant language
- Go
- Stars
- 2k
- Forks
- 125
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 32
Description
Related to: https://github.com/authgear/authgear-server/issues/3159
Downgrade the subscription using schedule
https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases#downgrading-subscriptions
- [ ] Create migration to add columns to `_portal_subscription`. (2)
- `stripe_schedule_id: text`
- `scheduled_next_plan_name: text`
- `scheduled_next_plan_at: timestamp`
- [ ] Add a portal mutation `scheduleSubscriptionUpdate(appID string, planName string)` (3)
- [ ] Create a subscription schedule to update the subscription at start of next month. Release the subscription after the schedule ends.
- [ ] Set the plan name and downgrade date into metadata of the schedule.
- [ ] Handle schedule events in webhook. Update `scheduled_next_plan_name` `scheduled_next_plan_at`. (5)
- `subscription_schedule.created`
- `subscription_schedule.updated`
- `subscription_schedule.released`
- [ ] In existing subscription event handlers, update `stripe_schedule_id`. (1)
- [ ] Add a portal mutation `cancelScheduleSubscriptionUpdate(appID string)` (3)
- Release the schedule with `stripe_schedule_id`
- Reset the subscription end date
- [ ] Update portal
- [ ] Update billing screen for downgrading subscription (2)
- [ ] Support cancelling downgrade (2)
- [ ] Update downgrade dialog (1)
Contributor guide
Assessment
This issue has not been assessed yet.