Skip to content

payouts tab#1065

Merged
BilalG1 merged 8 commits intodevfrom
payouts-tab
Jan 9, 2026
Merged

payouts tab#1065
BilalG1 merged 8 commits intodevfrom
payouts-tab

Conversation

@BilalG1
Copy link
Contributor

@BilalG1 BilalG1 commented Dec 13, 2025

Screenshot 2025-12-12 at 5 26 23 PM

Summary by CodeRabbit

  • New Features

    • Added a "Payouts" section to the Payments dashboard with a dedicated page, navigation link, and Stripe Connect payouts UI (supports instant/standard payouts, schedule editing, external account collection).
    • New subscription management endpoints and client methods to grant and cancel customer subscriptions (user and team flows).
  • Tests

    • Expanded end-to-end and integration tests covering granting, listing, and canceling subscriptions, plus access/control scenarios.
  • Chores

    • Internal import/path adjustments (no user-facing behavior changes).

✏️ Tip: You can customize this high-level summary in your review settings.

@cmux-agent
Copy link

cmux-agent bot commented Dec 13, 2025

Older cmux preview screenshots (latest comment is below)

Preview Screenshots

Open Diff Heatmap

Preview screenshots are being captured...

Workspace and dev browser links will appear here once the preview environment is ready.


Generated by cmux preview system

@vercel
Copy link

vercel bot commented Dec 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
stack-backend Ready Ready Preview, Comment Jan 9, 2026 7:46pm
stack-dashboard Ready Ready Preview, Comment Jan 9, 2026 7:46pm
stack-demo Ready Ready Preview, Comment Jan 9, 2026 7:46pm
stack-docs Ready Ready Preview, Comment Jan 9, 2026 7:46pm
test-sandbox Error Error Jan 9, 2026 7:46pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 13, 2025

📝 Walkthrough

Walkthrough

Adds Stripe payouts config to account-session payload, introduces dashboard Payouts pages and navigation, implements subscription cancellation endpoints and client APIs, adds grant-product POST, updates imports, and expands end-to-end tests for product granting and cancellation.

Changes

Cohort / File(s) Summary
Backend Stripe Configuration
apps/backend/src/app/api/latest/internal/payments/stripe-widgets/account-session/route.ts
Added components.payouts to the Stripe account session creation payload enabling payout features (instant_payouts, standard_payouts, edit_payout_schedule, external_account_collection).
Payments Product APIs
apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/[product_id]/route.ts, apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/route.ts
Added DELETE handler to cancel a customer subscription product and POST handler to grant a product to a customer; include authorization, product validation, Stripe cancellation when applicable, and detailed error handling.
Dashboard Pages & Layout
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/layout.tsx, apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page-client.tsx, apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page.tsx
Adjusted import paths in layout; added client-side Payouts page wrapper and PageClient which renders PageLayout → StripeConnectProvider → ConnectPayouts.
Frontend Navigation
apps/dashboard/src/lib/apps-frontend.tsx
Added payments navigation item: { displayName: "Payouts", href: "./payouts" }.
Client API surface (shared)
packages/stack-shared/src/interface/client-interface.ts
Added cancelSubscription(...) method signature to StackClientInterface (note: duplicated definition appears twice in file).
Client App Implementation & Interface
packages/template/src/lib/stack-app/apps/implementations/client-app-impl.ts, packages/template/src/lib/stack-app/apps/interfaces/client-app.ts
Added cancelSubscription implementation in client app impl and corresponding method to StackClientApp interface; enforces auth, resolves customer (user/team), calls interface, and invalidates caches.
End-to-end tests (backend)
apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts
Expanded test suite with numerous tests for cancelling subscriptions, granting products (including stackable/inline scenarios), permission checks (client vs server, team admin), and many error cases; imported Team helper.
End-to-end tests (js)
apps/e2e/tests/js/payments.test.ts
Added two subscription-cancellation e2e tests (user and team flows); duplicate occurrences present in file.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Browser as Browser (Dashboard)
  participant Frontend as Dashboard Frontend
  participant Backend as Backend API
  participant Stripe as Stripe API

  Browser->>Frontend: navigate to /projects/:id/payments/payouts
  Frontend->>Frontend: render PageClient -> StripeConnectProvider -> ConnectPayouts
  ConnectPayouts->>Backend: request account session (POST /internal/.../account-session)
  Backend->>Stripe: create account session (payload includes components.payouts)
  Stripe-->>Backend: account session response
  Backend-->>Frontend: return session data
  Frontend-->>Browser: initialize Stripe widget with session
  Browser->>Stripe: Stripe widget interactions (connect/confirm payouts)
  Stripe-->>Backend: webhook/events (optional) — payout and account updates
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐇 I hopped through code to carve a lane,
Payouts show up, shiny and plain,
End-to-end tests chase every hop,
Subscriptions stop when admins drop,
Carrots rung—deploy, and then I nap.

🚥 Pre-merge checks | ❌ 3
❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely incomplete, containing only a screenshot and a template reminder without any textual explanation of the code changes, objectives, or implementation details. Add a comprehensive description explaining the changes made, including backend API endpoints, frontend UI components, subscription cancellation logic, and any relevant testing updates.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'payouts tab' is vague and generic, lacking specificity about the actual implementation changes (backend configuration, UI components, API routes, and client methods). Improve the title to clearly convey the main changes, such as 'Add payouts feature with Stripe Connect UI and subscription cancellation' or 'Implement payouts dashboard and subscription cancellation API'.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@BilalG1 BilalG1 requested a review from N2D4 December 13, 2025 01:28
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 13, 2025

Greptile Overview

Greptile Summary

Added payouts management tab to the payments dashboard that displays Stripe's embedded payouts widget for viewing and managing payment disbursements.

Key Changes

  • Enabled payouts component in Stripe account session with instant payouts, standard payouts, schedule editing, and external account collection features
  • Created new payouts page following the existing patterns from products/customers/transactions pages
  • Moved payments layout up one directory level to apply to all payment sections
  • Added "Payouts" navigation item to payments app configuration

Issues Found

  • page.tsx incorrectly includes "use client" directive when it should be a server component (other payment pages follow this pattern)

Confidence Score: 4/5

  • This PR is safe to merge with one minor style fix needed
  • The implementation follows established patterns in the codebase and correctly integrates Stripe's embedded payouts widget. Backend changes properly use createSmartRouteHandler. The only issue is a non-critical style inconsistency where page.tsx has an unnecessary "use client" directive.
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page.tsx needs the "use client" directive removed

Important Files Changed

File Analysis

Filename Score Overview
apps/backend/src/app/api/latest/internal/payments/stripe-widgets/account-session/route.ts 5/5 Added payouts component configuration to Stripe account session with all required features enabled
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page-client.tsx 5/5 Client component that renders Stripe ConnectPayouts widget within StripeConnectProvider
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page.tsx 3/5 Server component wrapper for payouts page, but incorrectly includes 'use client' directive

Sequence Diagram

sequenceDiagram
    participant User as User/Browser
    participant Page as Payouts Page
    participant Provider as StripeConnectProvider
    participant AdminApp as StackAdminApp
    participant API as Backend API
    participant Stripe as Stripe API
    participant Widget as ConnectPayouts Widget

    User->>Page: Navigate to /payments/payouts
    Page->>Provider: Render with StripeConnectProvider
    Provider->>AdminApp: getStripeConnectInstance()
    Provider->>API: createStripeWidgetAccountSession()
    API->>Stripe: accountSessions.create()
    Note over API,Stripe: Components: payments, notification_banner, payouts
    Stripe-->>API: Return client_secret
    API-->>Provider: Return client_secret
    Provider->>Stripe: loadConnectAndInitialize(client_secret)
    Stripe-->>Provider: ConnectInstance
    Provider->>Widget: Render ConnectPayouts
    Widget->>Stripe: Fetch payout data
    Stripe-->>Widget: Return payout information
    Widget-->>User: Display payouts interface
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

5 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page.tsx (1)

1-9: Drop "use client" here; keep page.tsx as a server wrapper like the other Payments pages.
This avoids widening the client boundary for the entire route when the wrapper itself has no client-only logic.

-"use client";
-
 import PageClient from "./page-client";
 
 export default function Page() {
   return (
     <PageClient />
   );
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a917c8b and 9272bc2.

📒 Files selected for processing (5)
  • apps/backend/src/app/api/latest/internal/payments/stripe-widgets/account-session/route.ts (1 hunks)
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/layout.tsx (1 hunks)
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page-client.tsx (1 hunks)
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page.tsx (1 hunks)
  • apps/dashboard/src/lib/apps-frontend.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Always add new E2E tests when changing the API or SDK interface
For blocking alerts and errors, never use toast; use alerts instead as they are less easily missed by the user
NEVER try-catch-all, NEVER void a promise, and NEVER .catch(console.error); use loading indicators and async callbacks instead, or use runAsynchronously/runAsynchronouslyWithAlert for error handling
Use ES6 maps instead of records wherever you can

Files:

  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page-client.tsx
  • apps/backend/src/app/api/latest/internal/payments/stripe-widgets/account-session/route.ts
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/layout.tsx
  • apps/dashboard/src/lib/apps-frontend.tsx
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page.tsx
**/*.{ts,tsx,css}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,css}: Keep hover/click transitions snappy and fast; avoid fade-in delays on hover. Apply transitions after action completion instead, like smooth fade-out when hover ends
Use hover-exit transitions instead of hover-enter transitions; for example, use 'transition-colors hover:transition-none' instead of fade-in on hover

Files:

  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page-client.tsx
  • apps/backend/src/app/api/latest/internal/payments/stripe-widgets/account-session/route.ts
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/layout.tsx
  • apps/dashboard/src/lib/apps-frontend.tsx
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page.tsx
apps/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

NEVER use Next.js dynamic functions if you can avoid them; prefer using client components and hooks like usePathname instead of await params to keep pages static

Files:

  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page-client.tsx
  • apps/backend/src/app/api/latest/internal/payments/stripe-widgets/account-session/route.ts
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/layout.tsx
  • apps/dashboard/src/lib/apps-frontend.tsx
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page.tsx
{.env*,**/*.{ts,tsx,js}}

📄 CodeRabbit inference engine (AGENTS.md)

Prefix environment variables with STACK_ (or NEXT_PUBLIC_STACK_ if public) so changes are picked up by Turborepo and improves readability

Files:

  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page-client.tsx
  • apps/backend/src/app/api/latest/internal/payments/stripe-widgets/account-session/route.ts
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/layout.tsx
  • apps/dashboard/src/lib/apps-frontend.tsx
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page.tsx
apps/dashboard/**/*

📄 CodeRabbit inference engine (AGENTS.md)

When making changes in the dashboard, provide the user with a deep link to the dashboard page changed, usually in the form of http://localhost:<NEXT_PUBLIC_STACK_PORT_PREFIX>01/projects/-selector-/... or using a.localhost, b.localhost, c.localhost for port prefixes 91, 92, 93

Files:

  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page-client.tsx
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/layout.tsx
  • apps/dashboard/src/lib/apps-frontend.tsx
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page.tsx
apps/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Check existing apps for inspiration when implementing new apps or pages; update apps-frontend.tsx and apps-config.ts to add new apps

Files:

  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page-client.tsx
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/layout.tsx
  • apps/dashboard/src/lib/apps-frontend.tsx
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page.tsx
🧠 Learnings (2)
📚 Learning: 2025-12-04T18:03:49.984Z
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-04T18:03:49.984Z
Learning: Applies to apps/**/*.tsx : Check existing apps for inspiration when implementing new apps or pages; update apps-frontend.tsx and apps-config.ts to add new apps

Applied to files:

  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/layout.tsx
  • apps/dashboard/src/lib/apps-frontend.tsx
📚 Learning: 2025-12-04T18:03:49.984Z
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-04T18:03:49.984Z
Learning: Applies to apps/**/*.{ts,tsx} : NEVER use Next.js dynamic functions if you can avoid them; prefer using client components and hooks like usePathname instead of await params to keep pages static

Applied to files:

  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page.tsx
🧬 Code graph analysis (2)
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page-client.tsx (1)
apps/dashboard/src/components/payments/stripe-connect-provider.tsx (1)
  • StripeConnectProvider (33-52)
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page.tsx (3)
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page-client.tsx (1)
  • PageClient (7-16)
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/transactions/page.tsx (1)
  • Page (3-5)
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/customers/page.tsx (1)
  • Page (7-9)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: Vercel Agent Review
  • GitHub Check: build (22.x)
  • GitHub Check: restart-dev-and-test-with-custom-base-port
  • GitHub Check: docker
  • GitHub Check: build (22.x)
  • GitHub Check: lint_and_build (latest)
  • GitHub Check: E2E Tests (Node 22.x, Freestyle prod)
  • GitHub Check: E2E Tests (Node 22.x, Freestyle mock)
  • GitHub Check: all-good
  • GitHub Check: check_prisma_migrations (22.x)
  • GitHub Check: restart-dev-and-test
  • GitHub Check: setup-tests
🔇 Additional comments (3)
apps/dashboard/src/lib/apps-frontend.tsx (1)

138-143: Navigation entry is consistent with existing Payments items (./...) and should route correctly.

apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/layout.tsx (1)

14-15: Import paths resolve correctly; no action needed.

Both imports reference existing files with the correct exports:

  • ../app-enabled-guardAppEnabledGuard function (line 11 of app-enabled-guard.tsx) ✓
  • ../use-admin-appuseAdminApp function (line 29 of use-admin-app.tsx) ✓
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/payouts/page-client.tsx (1)

1-16: Code follows Stripe's documented pattern for ConnectPayouts.

The ConnectPayouts component is correctly used without props and is properly nested within StripeConnectProvider, which handles the required ConnectInstance initialization. No modifications needed.

@cmux-agent
Copy link

cmux-agent bot commented Jan 6, 2026

Older cmux preview screenshots (latest comment is below)

Preview Screenshots

Open Diff Heatmap

Preview screenshots are being captured...

Workspace and dev browser links will appear here once the preview environment is ready.


Generated by cmux preview system

@cmux-agent
Copy link

cmux-agent bot commented Jan 9, 2026

Older cmux preview screenshots (latest comment is below)

Preview Screenshots

Open Diff Heatmap

Preview screenshots are being captured...

Workspace and dev browser links will appear here once the preview environment is ready.


Generated by cmux preview system

@cmux-agent
Copy link

cmux-agent bot commented Jan 9, 2026

Older cmux preview screenshots (latest comment is below)

Preview Screenshots

Open Diff Heatmap

Preview screenshots are being captured...

Workspace and dev browser links will appear here once the preview environment is ready.


Generated by cmux preview system

@cmux-agent
Copy link

cmux-agent bot commented Jan 9, 2026

Older cmux preview screenshots (latest comment is below)

Preview Screenshots

Open Diff Heatmap

Preview screenshots are being captured...

Workspace and dev browser links will appear here once the preview environment is ready.


Generated by cmux preview system

@BilalG1 BilalG1 enabled auto-merge (squash) January 9, 2026 19:02
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/route.ts (1)

86-155: Avoid passing undefined into ProductCustomerTypeDoesNotMatch for inline-product grants.

When granting via product_inline, body.product_id is undefined, but you pass it into KnownErrors.ProductCustomerTypeDoesNotMatch(...) (Line 126-131). This risks confusing error payloads (or a runtime/type mismatch depending on constructor expectations).

Proposed fix
-      throw new KnownErrors.ProductCustomerTypeDoesNotMatch(
-        body.product_id,
+      throw new KnownErrors.ProductCustomerTypeDoesNotMatch(
+        body.product_id ?? null,
         params.customer_id,
         product.customerType,
         params.customer_type,
       );
🤖 Fix all issues with AI agents
In
@apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/[product_id]/route.ts:
- Around line 12-138: The Stripe cancellation path in the DELETE route handler
is cancelling immediately (stripe.subscriptions.cancel in the handler) while the
local update sets cancelAtPeriodEnd: true and status: canceled, causing
inconsistent semantics; update the Stripe call in the DELETE handler to pass
cancel_at_period_end: true when intending period-end cancellation (or explicitly
document and implement immediate cancellation for both paths), and ensure the
local prisma.subscription.update (status/currentPeriodEnd/cancelAtPeriodEnd) is
aligned with the chosen Stripe behavior so Stripe and local state remain
consistent.
🧹 Nitpick comments (3)
apps/e2e/tests/js/payments.test.ts (1)

209-265: Potential flake: assert cancellation with polling/retry instead of immediate re-list.

Immediately re-calling listProducts() after cancellation (Line 233-234, 262-263) can be flaky if cancellation propagates asynchronously (Stripe/webhooks/background jobs). Consider polling until the product disappears.

Example adjustment
-  const after = await user.listProducts();
-  expect(after.some((p) => p.id === "pro-sub")).toBe(false);
+  await expect.poll(async () => {
+    const after = await user.listProducts();
+    return after.some((p) => p.id === "pro-sub");
+  }).toBe(false);
packages/template/src/lib/stack-app/apps/implementations/client-app-impl.ts (1)

1651-1670: Implementation is solid; minor ergonomics: reuse getUser({ or: "throw" }) to avoid double fetch paths.

Today you call await this._getSession() and then await this.getUser() (Line 1652-1654). If you want to tighten this up, using getUser({ or: "throw" }) can simplify control flow (and keep auth semantics uniform).

apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts (1)

3-437: Great E2E coverage for critical payments flows; consider tightening any in configureProduct (test-only).

The expanded matrix around grant/cancel/list (including forbidden and one-time cases) is exactly what we want for this surface. The only nit: configureProduct(config: any) (Line 5) could be a typed helper to catch shape regressions earlier.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e8aa3f7 and 1bbb395.

📒 Files selected for processing (7)
  • apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/[product_id]/route.ts
  • apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/route.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts
  • apps/e2e/tests/js/payments.test.ts
  • packages/stack-shared/src/interface/client-interface.ts
  • packages/template/src/lib/stack-app/apps/implementations/client-app-impl.ts
  • packages/template/src/lib/stack-app/apps/interfaces/client-app.ts
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{tsx,ts,jsx,js}

📄 CodeRabbit inference engine (AGENTS.md)

For blocking alerts and errors, never use toast; instead, use alerts as toasts are easily missed by the user

Files:

  • packages/template/src/lib/stack-app/apps/interfaces/client-app.ts
  • apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/[product_id]/route.ts
  • apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/route.ts
  • packages/template/src/lib/stack-app/apps/implementations/client-app-impl.ts
  • apps/e2e/tests/js/payments.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts
  • packages/stack-shared/src/interface/client-interface.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (AGENTS.md)

NEVER use Next.js dynamic functions if avoidable; prefer using client components instead to keep pages static (e.g., use usePathname instead of await params)

Files:

  • packages/template/src/lib/stack-app/apps/interfaces/client-app.ts
  • apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/[product_id]/route.ts
  • apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/route.ts
  • packages/template/src/lib/stack-app/apps/implementations/client-app-impl.ts
  • apps/e2e/tests/js/payments.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts
  • packages/stack-shared/src/interface/client-interface.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx}: NEVER try-catch-all, NEVER void a promise, and NEVER use .catch(console.error) or similar; use loading indicators instead; if asynchronous handling is necessary, use runAsynchronously or runAsynchronouslyWithAlert instead
Use ES6 maps instead of records wherever possible

Files:

  • packages/template/src/lib/stack-app/apps/interfaces/client-app.ts
  • apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/[product_id]/route.ts
  • apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/route.ts
  • packages/template/src/lib/stack-app/apps/implementations/client-app-impl.ts
  • apps/e2e/tests/js/payments.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts
  • packages/stack-shared/src/interface/client-interface.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Code defensively; prefer ?? throwErr(...) over non-null assertions with good error messages explicitly stating violated assumptions
Avoid the any type; when necessary, leave a comment explaining why it's used, why the type system fails, and how errors would be caught at compile-, test-, or runtime

Files:

  • packages/template/src/lib/stack-app/apps/interfaces/client-app.ts
  • apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/[product_id]/route.ts
  • apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/route.ts
  • packages/template/src/lib/stack-app/apps/implementations/client-app-impl.ts
  • apps/e2e/tests/js/payments.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts
  • packages/stack-shared/src/interface/client-interface.ts
**/e2e/**/*.{test,spec}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

ALWAYS add new E2E tests when changing the API or SDK interface; err on the side of creating too many tests due to the critical nature of the authentication industry

Files:

  • apps/e2e/tests/js/payments.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts
**/*.{test,spec}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

When writing tests, prefer .toMatchInlineSnapshot() over other selectors if possible; check snapshot-serializer.ts to understand how snapshots are formatted and how non-deterministic values are handled

Files:

  • apps/e2e/tests/js/payments.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts
🧠 Learnings (1)
📚 Learning: 2026-01-07T00:55:19.871Z
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T00:55:19.871Z
Learning: Applies to **/e2e/**/*.{test,spec}.{ts,tsx,js,jsx} : ALWAYS add new E2E tests when changing the API or SDK interface; err on the side of creating too many tests due to the critical nature of the authentication industry

Applied to files:

  • apps/e2e/tests/js/payments.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts
🧬 Code graph analysis (4)
apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/[product_id]/route.ts (6)
packages/stack-shared/src/utils/errors.tsx (3)
  • StatusError (152-261)
  • StackAssertionError (69-85)
  • throwErr (10-19)
apps/backend/src/prisma-client.tsx (1)
  • getPrismaClientForTenancy (67-69)
apps/backend/src/lib/request-checks.tsx (1)
  • ensureUserTeamPermissionExists (82-115)
apps/backend/src/lib/payments.tsx (1)
  • ensureProductIdOrInlineProduct (22-75)
packages/stack-shared/src/utils/strings.tsx (1)
  • typedToUppercase (30-33)
apps/backend/src/lib/stripe.tsx (1)
  • getStripeForAccount (29-54)
packages/template/src/lib/stack-app/apps/implementations/client-app-impl.ts (1)
packages/stack-shared/src/known-errors.tsx (2)
  • KnownErrors (1650-1652)
  • KnownErrors (1654-1781)
apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts (2)
apps/e2e/tests/helpers.ts (1)
  • it (12-12)
apps/e2e/tests/backend/backend-helpers.ts (1)
  • niceBackendFetch (109-173)
packages/stack-shared/src/interface/client-interface.ts (2)
packages/stack-shared/src/sessions.ts (1)
  • InternalSession (81-288)
packages/stack-shared/src/utils/urls.tsx (1)
  • urlString (314-316)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: Vercel Agent Review
  • GitHub Check: restart-dev-and-test-with-custom-base-port
  • GitHub Check: setup-tests-with-custom-base-port
  • GitHub Check: setup-tests
  • GitHub Check: build (22.x)
  • GitHub Check: build (22.x)
  • GitHub Check: lint_and_build (latest)
  • GitHub Check: docker
  • GitHub Check: check_prisma_migrations (22.x)
  • GitHub Check: restart-dev-and-test
  • GitHub Check: all-good
  • GitHub Check: E2E Tests (Node 22.x, Freestyle mock)
  • GitHub Check: E2E Tests (Node 22.x, Freestyle prod)
🔇 Additional comments (2)
packages/template/src/lib/stack-app/apps/interfaces/client-app.ts (1)

79-80: Public SDK surface addition looks consistent with intended user/team split.
Signature is clear and matches the usage pattern in tests/impl.

packages/stack-shared/src/interface/client-interface.ts (1)

1809-1825: LGTM: correct URL construction + correct HTTP verb for cancellation.

@cmux-agent
Copy link

cmux-agent bot commented Jan 9, 2026

Older cmux preview screenshots (latest comment is below)

Preview Screenshots

Open Diff Heatmap

Preview screenshots are being captured...

Workspace and dev browser links will appear here once the preview environment is ready.


Generated by cmux preview system

@cmux-agent
Copy link

cmux-agent bot commented Jan 9, 2026

Older cmux preview screenshots (latest comment is below)

Preview Screenshots

Open Diff Heatmap

Preview screenshots are being captured...

Workspace and dev browser links will appear here once the preview environment is ready.


Generated by cmux preview system

@cmux-agent
Copy link

cmux-agent bot commented Jan 9, 2026

Preview Screenshots

Open Diff Heatmap

Preview screenshots are being captured...

Workspace and dev browser links will appear here once the preview environment is ready.


Generated by cmux preview system

@BilalG1 BilalG1 merged commit 502963b into dev Jan 9, 2026
22 of 24 checks passed
@BilalG1 BilalG1 deleted the payouts-tab branch January 9, 2026 20:04
@coderabbitai coderabbitai bot mentioned this pull request Jan 13, 2026
@coderabbitai coderabbitai bot mentioned this pull request Jan 26, 2026
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.

2 participants