Commit d6b2084
committed
feat(billing): add monthly billing cycle option for Team and Enterprise seats
Implement monthly billing alongside existing annual billing per the
spec changelog 2026-03-26. Users now select monthly or annual billing
at checkout, with cycle-specific Stripe prices resolved from env vars.
Backend:
- Add pricing constants for both cycles (Teams /, Enterprise /)
- Add BillingCycle type with DB/API/Stripe boundary mapping
- Replace product.default_price lookup with explicit getPriceIdForPlanAndCycle
- Populate billing_cycle column from Stripe subscription interval
- Add changeBillingCycle/cancelBillingCycleChange endpoints via Stripe
subscription schedules (takes effect at renewal, no proration)
- Expand schedule on subscription retrieval for pending change detection
Frontend:
- Add Monthly/Annual pill toggle with Save 17% badge to UpgradeTrialDialog
- Dynamic PlanCard billing label (Billed monthly/Billed annually)
- Switch to Monthly/Annual button in SubscriptionQuickActions
- BillingCycleChangeDialog with cost comparison and effective date
- Pending cycle change banner in SubscriptionOverviewCard with cancel
Tests:
- 3 tests for billing_cycle tracking (monthly, yearly, null fallback)
- 2 tests for billingCycle schema validation on checkout endpoint1 parent afdbc8a commit d6b2084
File tree
17 files changed
+1219
-41
lines changed- .plans
- plans
- src
- app/api/organizations
- components/organizations
- subscription
- lib
- organizations
- routers/organizations
17 files changed
+1219
-41
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
166 | 193 | | |
167 | 194 | | |
168 | 195 | | |
| |||
219 | 246 | | |
220 | 247 | | |
221 | 248 | | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
226 | 260 | | |
227 | 261 | | |
228 | 262 | | |
| |||
282 | 316 | | |
283 | 317 | | |
284 | 318 | | |
285 | | - | |
| 319 | + | |
286 | 320 | | |
287 | 321 | | |
288 | 322 | | |
| |||
304 | 338 | | |
305 | 339 | | |
306 | 340 | | |
307 | | - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
308 | 351 | | |
309 | 352 | | |
310 | 353 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
393 | 413 | | |
394 | 414 | | |
395 | 415 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
| 58 | + | |
56 | 59 | | |
57 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
58 | 70 | | |
59 | 71 | | |
60 | 72 | | |
| |||
70 | 82 | | |
71 | 83 | | |
72 | 84 | | |
| 85 | + | |
73 | 86 | | |
74 | 87 | | |
75 | 88 | | |
| |||
79 | 92 | | |
80 | 93 | | |
81 | 94 | | |
| 95 | + | |
82 | 96 | | |
83 | 97 | | |
84 | 98 | | |
| |||
106 | 120 | | |
107 | 121 | | |
108 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
109 | 158 | | |
110 | 159 | | |
111 | 160 | | |
112 | 161 | | |
113 | | - | |
| 162 | + | |
| 163 | + | |
114 | 164 | | |
115 | 165 | | |
116 | 166 | | |
| |||
119 | 169 | | |
120 | 170 | | |
121 | 171 | | |
122 | | - | |
| 172 | + | |
| 173 | + | |
123 | 174 | | |
124 | 175 | | |
125 | 176 | | |
| |||
0 commit comments