Repository navigation
feat(billing): Add shared space subscriptions - #17
Conversation
Code Review SummaryAdds shared-space subscriptions priced as a base amount plus per-additional-member, with workspace owners getting quote, checkout, cancel and portal endpoints. Access to shared spaces, invitations and bank connections now depends on an active paid workspace subscription and its member capacity, and a workspace cannot be deleted while billing is live. A new WorkspaceBilling UI, shared notice and redirect composable let owners choose capacity and confirm before redirecting to Stripe. 🚀 Key Improvements
💡 Minor Suggestions
|
| $previous = ['entitlements-cashier.success_url' => config('entitlements-cashier.success_url'), | ||
| 'entitlements-cashier.cancel_url' => config('entitlements-cashier.cancel_url')]; | ||
| $url = rtrim(config('workspace-billing.return_url'), '/').'/workspaces/'.$owner->slug; | ||
| config(['entitlements-cashier.success_url' => $url.'?checkout=success', |
There was a problem hiding this comment.
The cancel return emits ?checkout=cancel, but the shared checkoutNotice helper and BillingSettings only recognise success/cancelled, and WorkspaceBilling.vue handles only success. A user who abandons workspace checkout therefore gets no confirmation that nothing changed. Emit cancelled here and surface it via checkoutNotice in WorkspaceBilling.vue.
| config(['entitlements-cashier.success_url' => $url.'?checkout=success', | |
| config(['entitlements-cashier.success_url' => $url.'?checkout=success', | |
| 'entitlements-cashier.cancel_url' => $url.'?checkout=cancelled']); |
| const money = (amount: number, currency: string) => formatCents(amount, currency, locale.value); | ||
|
|
||
| const notice = computed(() => { | ||
| const failure = actionError.value ?? quoteError.value; |
There was a problem hiding this comment.
Refresh failures are silently dropped: loadError is only rendered when status is null, and this notice ignores it, so the pending notice's "Refresh status" button appears to do nothing when the request fails. Include loadError.value in the failure chain and clear it in dismiss so the error notice can be closed.
| } | ||
|
|
||
| async function cancelCheckout() { | ||
| if (await go('cancel', `${base.value}/cancel-checkout`)) await load(); |
There was a problem hiding this comment.
pending is set by checkout() and cleared only when a reload finds the space active, which a cancelled checkout never is. After cancelling, the page still claims payment confirmation is pending, so clear pending when the cancel succeeds.
| if (await go('cancel', `${base.value}/cancel-checkout`)) await load(); | |
| if (await go('cancel', `${base.value}/cancel-checkout`)) { | |
| pending.value = false; | |
| await load(); | |
| } |
Add subscriptions for shared spaces, billed separately from personal plans. Access follows confirmed payments and the space’s member allowance.