improvement(settings): add View Invoices button to subscription billing details#3726
improvement(settings): add View Invoices button to subscription billing details#3726waleedlatif1 merged 3 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Clicking the button opens the Stripe billing portal in a new tab via a synchronous Written by Cursor Bugbot for commit 8cc2fb0. Configure here. |
Greptile SummaryThis PR adds a "View Invoices" button to the billing details card on the subscription settings page, allowing paid users (excluding team members and enterprise non-admins) to open the Stripe billing portal in a new tab. Key changes:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
actor User
participant Button as View Invoices Button
participant Browser as Browser (new tab)
participant Mutation as openBillingPortal
participant API as /api/billing/portal
participant Stripe as Stripe Billing Portal
User->>Button: Click "View Invoices"
Button->>Browser: window.open('', '_blank') — synchronous pre-open
Button->>Mutation: mutate({ context, organizationId, returnUrl })
Mutation->>API: POST /api/billing/portal
API->>Stripe: Create portal session
Stripe-->>API: { url }
API-->>Mutation: { url }
alt Success
Mutation-->>Browser: portalWindow.location.href = url
Browser->>Stripe: Navigate to billing portal
else Error (popup blocked — portalWindow is null)
Mutation-->>Button: data.url available
Button->>Browser: window.location.href = url (current tab)
else Mutation error
Mutation-->>Browser: portalWindow?.close()
Note over Button: logger.error only, no user toast
end
Reviews (1): Last reviewed commit: "lint" | Re-trigger Greptile |
Summary
window.opento avoid popup blockersType of Change
Testing
Tested manually
Checklist