Skip to content

Conversation

mauricioabreu
Copy link
Contributor

@mauricioabreu mauricioabreu commented Sep 9, 2025

Description

We are dropping the experimental Clerk.organization.getSubscriptions() and Clerk.billing.getSubscriptions() methods. A replacement is already in place Clerk.billing.getSubscription().

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • Refactor
    • Removed experimental Billing Beta subscriptions listing APIs: subscriptions can no longer be fetched via Billing or Organization resources, and useOrganization no longer exposes subscriptions. Migrate subscription-related flows to useSubscription(); other billing features (plans, statements, payment attempts, checkout) remain unchanged.
  • Chores
    • Bumped minor versions of affected Clerk packages.

`organization.getSubscriptions()` and `billing.getSubscriptions()`
Copy link

vercel bot commented Sep 9, 2025

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

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Sep 9, 2025 4:39pm

Copy link

changeset-bot bot commented Sep 9, 2025

🦋 Changeset detected

Latest commit: 84b3675

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 22 packages
Name Type
@clerk/clerk-js Minor
@clerk/types Minor
@clerk/shared Minor
@clerk/astro Minor
@clerk/chrome-extension Minor
@clerk/clerk-expo Minor
@clerk/nextjs Minor
@clerk/clerk-react Minor
@clerk/react-router Minor
@clerk/remix Minor
@clerk/tanstack-react-start Minor
@clerk/agent-toolkit Patch
@clerk/backend Patch
@clerk/elements Patch
@clerk/expo-passkeys Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/localizations Patch
@clerk/nuxt Patch
@clerk/testing Patch
@clerk/themes Patch
@clerk/vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

coderabbitai bot commented Sep 9, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • .typedoc/__tests__/__snapshots__/file-structure.test.ts.snap is excluded by !**/*.snap

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Removes experimental billing subscriptions listing across runtime, hooks, and public types: deletes getSubscriptions from CommerceBilling and Organization, removes subscriptions support from useOrganization types/returns, drops related commerce types, and adds changesets documenting minor bumps and Billing Beta removals.

Changes

Cohort / File(s) Summary of Changes
Billing runtime: remove subscriptions listing
packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts, packages/clerk-js/src/core/resources/Organization.ts
Deleted getSubscriptions methods, their pagination and mapping logic, and removed CommerceSubscriptionItem-related types/imports. Other billing methods remain unchanged.
React hook: remove subscriptions surface
packages/shared/src/react/hooks/useOrganization.tsx
Removed subscriptions param support, pages/infinite fetching logic, safe-value handling, and removed subscriptions from hook return types and imports; hook signature retained with narrowed params/returns.
Public types: remove subscriptions APIs
packages/types/src/commerce.ts, packages/types/src/organization.ts
Removed CommerceBillingNamespace.getSubscriptions signature, GetSubscriptionsParams type, and OrganizationResource.getSubscriptions declaration (and its experimental docblock); related imports removed.
Release metadata
.changeset/chilly-dots-heal.md, .changeset/upset-masks-ask.md
Added changesets marking minor releases and documenting removal of billing getSubscriptions APIs and the subscriptions param from useOrganization under Billing Beta.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as useOrganization (hook)
  participant Org as Organization resource
  participant Billing as CommerceBilling
  participant API as /commerce/subscriptions

  rect rgba(200,230,201,0.45)
    Note left of UI: Before — subscription listing flow
    UI->>Org: getSubscriptions(params)
    Org->>Billing: getSubscriptions(params)
    Billing->>API: GET /organizations/{id}/commerce/subscriptions
    API-->>Billing: 200 paginated JSON
    Billing-->>Org: mapped CommerceSubscriptionItems
    Org-->>UI: paginated subscriptions
  end

  rect rgba(255,224,178,0.35)
    Note left of UI: After — flow removed
    UI-xOrg: no getSubscriptions call
    Org-xBilling: no getSubscriptions call
    Billing-xAPI: endpoint no longer used
    Org-->>UI: subscriptions field removed from return
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I nibble logs and hop with glee,
Subscriptions trimmed — lighter I be.
Hooks redesigned, types tucked away,
Billing’s garden pruned today.
Carrot-capers—release and see! 🐇

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed The description succinctly identifies the removal of the experimental getSubscriptions methods on both Clerk.organization and Clerk.billing and mentions the available replacement Clerk.billing.getSubscription(), directly reflecting the changes made across the codebase.
Title Check ✅ Passed The title “chore(clerk-js,shared): Removal of experimental getSubscriptions” succinctly identifies the core change—the removal of the experimental getSubscriptions methods—from the relevant packages, and it avoids extraneous details or noise. It clearly reflects the main intent of the PR and will be immediately understandable to reviewers scanning the commit history.
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch mauricio-antunes/remove-get-subscriptions

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

@panteliselef panteliselef changed the title chore(billing): removal of billing experimental methods chore(billing): Removal of billing experimental methods Sep 9, 2025
@panteliselef panteliselef changed the title chore(billing): Removal of billing experimental methods chore(billing): Removal of experimental getSubscriptions Sep 9, 2025
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

Caution

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

⚠️ Outside diff range comments (1)
.changeset/chilly-dots-heal.md (1)

7-7: Remove stray trailing character.

There is a solitary 7 at EOF. It will render in the changelog. Please delete it.

-7
🧹 Nitpick comments (4)
.changeset/chilly-dots-heal.md (1)

6-6: Strengthen the changeset with migration notes and deprecation context.

Add a short migration blurb (replacement or “no replacement”) and note the prior experimental status to reduce churn for consumers scanning the changelog.

-[Billing Beta] Removal of Billing experimental methods: `organization.getSubscriptions()` and `billing.getSubscriptions()`
+[Billing Beta] BREAKING: Removed experimental methods `organization.getSubscriptions()` and `billing.getSubscriptions()`.
+
+- These methods were part of the Billing Beta/experimental surface and are now removed.
+- There is currently no direct replacement. If you need subscription data, please use <your recommended path here> or contact support.
+- This removal only affects Beta surfaces and does not impact stable billing APIs.
packages/types/src/organization.ts (1)

31-37: Docs touch-up (optional): annotate Beta removal in JSDoc for discoverability.

Consider adding a one-line note in the interface doc that Billing Beta subscription listing has been removed, pointing to the changelog.

packages/clerk-js/src/core/resources/Organization.ts (2)

41-45: Type nullability for slug (optional correctness).

slug!: string; but the types define slug: string | null and fromJSON assigns data.slug which can be null. Consider widening to avoid a latent null-at-runtime mismatch.

-  slug!: string;
+  slug!: string | null;

161-177: Naming nit: “suggestions” → “memberships”.

Local variable and mapping names refer to “suggestions”, which is misleading in a memberships endpoint. Rename for clarity (no behavior change).

-      const { data: suggestions, total_count } =
+      const { data: memberships, total_count } =
         res?.response as unknown as ClerkPaginatedResponse<OrganizationMembershipJSON>;

       return {
         total_count,
-        data: suggestions.map(suggestion => new OrganizationMembership(suggestion)),
+        data: memberships.map(m => new OrganizationMembership(m)),
       };
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f0fe516 and 91c8609.

📒 Files selected for processing (6)
  • .changeset/chilly-dots-heal.md (1 hunks)
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts (0 hunks)
  • packages/clerk-js/src/core/resources/Organization.ts (1 hunks)
  • packages/shared/src/react/hooks/useOrganization.tsx (0 hunks)
  • packages/types/src/commerce.ts (0 hunks)
  • packages/types/src/organization.ts (1 hunks)
💤 Files with no reviewable changes (3)
  • packages/shared/src/react/hooks/useOrganization.tsx
  • packages/types/src/commerce.ts
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
🧰 Additional context used
📓 Path-based instructions (7)
.changeset/**

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/chilly-dots-heal.md
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels

Files:

  • packages/types/src/organization.ts
  • packages/clerk-js/src/core/resources/Organization.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/types/src/organization.ts
  • packages/clerk-js/src/core/resources/Organization.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/types/src/organization.ts
  • packages/clerk-js/src/core/resources/Organization.ts
packages/**/*.{ts,tsx,d.ts}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Packages should export TypeScript types alongside runtime code

Files:

  • packages/types/src/organization.ts
  • packages/clerk-js/src/core/resources/Organization.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Use const assertions for literal types: as const
Use satisfies operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports: import type { ... } from ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)

Files:

  • packages/types/src/organization.ts
  • packages/clerk-js/src/core/resources/Organization.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.

Files:

  • packages/types/src/organization.ts
  • packages/clerk-js/src/core/resources/Organization.ts
⏰ 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). (8)
  • GitHub Check: pr-title-lint
  • GitHub Check: pr-title-lint
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Build Packages
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (5)
.changeset/chilly-dots-heal.md (1)

1-4: Semver level: confirm whether this should be a major bump (API removal), even if “Billing Beta”.

Removing public methods (even experimental) from @clerk/clerk-js and @clerk/types is a breaking change for consumers compiling against these types. If your policy allows removals of clearly-marked Beta/experimental APIs under minor, keep as-is; otherwise, bump to major for safety.

Suggested diff if you decide to mark as major:

---
-'@clerk/clerk-js': minor
-'@clerk/types': minor
+'@clerk/clerk-js': major
+'@clerk/types': major
---
packages/types/src/organization.ts (2)

38-69: Removal from OrganizationResource: looks consistent with the PR intent.

getSubscriptions is gone from the public interface; dependent commerce subscription types are also absent. This aligns with the stated objective.


1-1: No dangling references to removed APIs/types
Verified that organization.getSubscriptions is no longer called and no residual references to the removed types exist outside of their intended definitions and changelogs.

packages/clerk-js/src/core/resources/Organization.ts (2)

32-32: Import cleanup aligns with removal.

Subscription-related imports are gone; only BaseResource, OrganizationInvitation, and OrganizationMembership remain. Matches the types change.


1-27: Remove irrelevant guardrail for getSubscriptions in Organization.ts – this file doesn’t reference billing.getSubscriptions or any CommerceSubscriptionItem* types; there are no callsites to remove.

Likely an incorrect or invalid review comment.

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)
.changeset/upset-masks-ask.md (1)

13-13: Tighten wording and make docs guidance framework-agnostic.

Say “params object” and avoid a Next.js-specific link since multiple packages are bumped.

Apply:

-[Billing Beta] Drop experimental `subscriptions` property from params of `useOrganization()`. Use [`useSubscription()`](https://clerk.com/docs/nextjs/hooks/use-subscription) instead.
+[Billing Beta] Drop experimental `subscriptions` property from the params object of `useOrganization()`. Migrate to `useSubscription()` instead (see framework-specific docs).
+
+Migration:
+
+Before:
+```ts
+useOrganization({ subscriptions: { /* ... */ } })
+```
+After:
+```ts
+const subscription = useSubscription();
+const org = useOrganization();
+```
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 91c8609 and 5134632.

📒 Files selected for processing (1)
  • .changeset/upset-masks-ask.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/**

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/upset-masks-ask.md
⏰ 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). (4)
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (2)
.changeset/upset-masks-ask.md (2)

1-11: Frontmatter looks valid for a multi-package minor bump.

Packages list and Changesets format are correct.


1-13: Semver and changesets coverage is complete
Companion changeset .changeset/chilly-dots-heal.md covers the experimental removals, no getSubscriptions references remain, and both @clerk/types and @clerk/clerk-js are versioned.

Copy link

pkg-pr-new bot commented Sep 9, 2025

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6738

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6738

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6738

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6738

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6738

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6738

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6738

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6738

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6738

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6738

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6738

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6738

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6738

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6738

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6738

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6738

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6738

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6738

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6738

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6738

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6738

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6738

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6738

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6738

commit: 84b3675

@panteliselef panteliselef changed the title chore(billing): Removal of experimental getSubscriptions chore(clerk-js,shared): Removal of experimental getSubscriptions Sep 9, 2025
@mauricioabreu mauricioabreu merged commit 23948dc into main Sep 9, 2025
41 of 42 checks passed
@mauricioabreu mauricioabreu deleted the mauricio-antunes/remove-get-subscriptions branch September 9, 2025 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants