[PR #2794] [CLOSED] feat: added functionality to link a stripe customer to an organization as it's own entity #4489

Closed
opened 2026-03-13 11:48:54 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/2794
Author: @Cmion
Created: 5/26/2025
Status: Closed

Base: mainHead: main


📝 Commits (9)

  • 679f294 chore(wip): adding functionality to link a stripe customer to an organization as it's own entity
  • b8b2912 chore: added checks in endpoints to only use active organization if createOrganizationCustomer is enabled
  • 37283de chore: updated docs to new feature
  • 2d558ae chore: added organization inmemory data to beforeEach block reset
  • 34a04de fix: lint error
  • 1d42bba fix: issue where organization without stripe id was not auto creating an id and defaults to user defined stripe id
  • 281c245 Merge branch 'main' into main
  • 638d898 chore: rebase canary
  • e75b855 Merge branch 'main' into main

📊 Changes

5 files changed (+451 additions, -26 deletions)

View changed files

📝 docs/content/docs/plugins/stripe.mdx (+43 -12)
📝 packages/stripe/src/index.ts (+191 -11)
📝 packages/stripe/src/schema.ts (+13 -0)
📝 packages/stripe/src/stripe.test.ts (+195 -3)
📝 packages/stripe/src/types.ts (+9 -0)

📄 Description

This enables associating a Stripe customer to an organization instead of a user. This is useful for B2B applications where you want to manage subscriptions at the organization level.

This is especially useful for apps, where:

  • Each organization needs its own billing entity.
  • One user might be the admin/payer for Org A, but a member (non-payer) in Org B.
  • Each organization wants its own invoices, card, and tax info (especially if orgs are legal entities).

You can enable this by setting the createOrganizationCustomer option to true and/or implementing the authorizeReference function to check if the user has permission to manage subscriptions for the organization.

stripe({
    // ... other options
    createCustomerOnSignUp: false,
    createOrganizationCustomer: true,
})

This issue is mentioned here: https://github.com/better-auth/better-auth/issues/2079


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/2794 **Author:** [@Cmion](https://github.com/Cmion) **Created:** 5/26/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (9) - [`679f294`](https://github.com/better-auth/better-auth/commit/679f2947a537474dd496fe066e95e6221e8b57a1) chore(wip): adding functionality to link a stripe customer to an organization as it's own entity - [`b8b2912`](https://github.com/better-auth/better-auth/commit/b8b29125bfc404b1cfff63f3c2b0d6ab9b8d791b) chore: added checks in endpoints to only use active organization if createOrganizationCustomer is enabled - [`37283de`](https://github.com/better-auth/better-auth/commit/37283de6114e636736730e7f0ebeaf4e4a060ec3) chore: updated docs to new feature - [`2d558ae`](https://github.com/better-auth/better-auth/commit/2d558aeed197a1eeb2dc98f20cd0594d3072f9ad) chore: added organization inmemory data to beforeEach block reset - [`34a04de`](https://github.com/better-auth/better-auth/commit/34a04de18660fd3aefca681461f91bce70e4a7ec) fix: lint error - [`1d42bba`](https://github.com/better-auth/better-auth/commit/1d42bba402d62250153121ac739220bf687c7a99) fix: issue where organization without stripe id was not auto creating an id and defaults to user defined stripe id - [`281c245`](https://github.com/better-auth/better-auth/commit/281c245e26f158c9c2570bad777953eac5ed590a) Merge branch 'main' into main - [`638d898`](https://github.com/better-auth/better-auth/commit/638d8987b53f3e34098fd3a6442431040b2d2218) chore: rebase canary - [`e75b855`](https://github.com/better-auth/better-auth/commit/e75b855bd01e8ff79276f43fab8b03abbd272f00) Merge branch 'main' into main ### 📊 Changes **5 files changed** (+451 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/stripe.mdx` (+43 -12) 📝 `packages/stripe/src/index.ts` (+191 -11) 📝 `packages/stripe/src/schema.ts` (+13 -0) 📝 `packages/stripe/src/stripe.test.ts` (+195 -3) 📝 `packages/stripe/src/types.ts` (+9 -0) </details> ### 📄 Description This enables associating a Stripe customer to an organization instead of a user. This is useful for B2B applications where you want to manage subscriptions at the organization level. This is especially useful for apps, where: - Each organization needs its own billing entity. - One user might be the admin/payer for Org A, but a member (non-payer) in Org B. - Each organization wants its own invoices, card, and tax info (especially if orgs are legal entities). You can enable this by setting the `createOrganizationCustomer` option to `true` and/or implementing the `authorizeReference` function to check if the user has permission to manage subscriptions for the organization. ```ts title="auth.ts" stripe({ // ... other options createCustomerOnSignUp: false, createOrganizationCustomer: true, }) ``` This issue is mentioned here: https://github.com/better-auth/better-auth/issues/2079 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 11:48:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#4489