Skip to content

feat(billing): Add shared space subscriptions - #17

Merged
nfebe merged 8 commits into
mainfrom
feat/shared-budgeting
Nov 5, 2026
Merged

nfebe merged 8 commits into
mainfrom
feat/shared-budgeting

Conversation

@nfebe

@nfebe nfebe commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Add subscriptions for shared spaces, billed separately from personal plans. Access follows confirmed payments and the space’s member allowance.

@sourceant

sourceant Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Code Review Summary

Adds 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

  • Quote is hashed server-side so a changed price is rejected rather than silently charged.
  • Capacity is enforced on invite acceptance and on downgrade, so members cannot be stranded or evicted.
  • Deletion guard keeps subscriptions and pending checkouts from being orphaned.
  • Billing notice and redirect logic are shared between personal and workspace billing UI.

💡 Minor Suggestions

  • 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.
  • 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.
  • Review coverage is incomplete. Inspect the execution details before approving.

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

$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',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
config(['entitlements-cashier.success_url' => $url.'?checkout=success',
config(['entitlements-cashier.success_url' => $url.'?checkout=success',
'entitlements-cashier.cancel_url' => $url.'?checkout=cancelled']);

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

const money = (amount: number, currency: string) => formatCents(amount, currency, locale.value);

const notice = computed(() => {
const failure = actionError.value ?? quoteError.value;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
if (await go('cancel', `${base.value}/cancel-checkout`)) await load();
if (await go('cancel', `${base.value}/cancel-checkout`)) {
pending.value = false;
await load();
}

@nfebe
nfebe merged commit 60f692e into main Nov 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant