@better-auth/stripe 1.4.10 → 1.4.11-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
 
2
- > @better-auth/stripe@1.4.10 build /home/runner/work/better-auth/better-auth/packages/stripe
2
+ > @better-auth/stripe@1.4.11-beta.2 build /home/runner/work/better-auth/better-auth/packages/stripe
3
3
  > tsdown
4
4
 
5
5
  ℹ tsdown v0.17.2 powered by rolldown v1.0.0-beta.53
@@ -7,10 +7,10 @@
7
7
  ℹ entry: src/index.ts, src/client.ts
8
8
  ℹ tsconfig: tsconfig.json
9
9
  ℹ Build start
10
- ℹ dist/index.mjs 46.78 kB │ gzip: 8.45 kB
11
- ℹ dist/client.mjs  0.26 kB │ gzip: 0.20 kB
12
- ℹ dist/client.d.mts  0.62 kB │ gzip: 0.34 kB
13
- ℹ dist/index.d.mts  0.21 kB │ gzip: 0.14 kB
14
- ℹ dist/index-DtwvPnmn.d.mts 26.30 kB │ gzip: 5.07 kB
15
- ℹ 5 files, total: 74.17 kB
16
- ✔ Build complete in 16656ms
10
+ ℹ dist/index.mjs 57.71 kB │ gzip: 10.47 kB
11
+ ℹ dist/client.mjs  0.26 kB │ gzip: 0.20 kB
12
+ ℹ dist/client.d.mts  0.62 kB │ gzip: 0.35 kB
13
+ ℹ dist/index.d.mts  0.21 kB │ gzip: 0.14 kB
14
+ ℹ dist/index-CkO4CTbB.d.mts 28.52 kB │ gzip: 5.03 kB
15
+ ℹ 5 files, total: 87.33 kB
16
+ ✔ Build complete in 19292ms
package/dist/client.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as stripe } from "./index-DtwvPnmn.mjs";
1
+ import { n as stripe } from "./index-CkO4CTbB.mjs";
2
2
 
3
3
  //#region src/client.d.ts
4
4
  declare const stripeClient: <O extends {
@@ -2,6 +2,7 @@ import * as better_auth0 from "better-auth";
2
2
  import { GenericEndpointContext, InferOptionSchema, Session, User } from "better-auth";
3
3
  import * as better_call0 from "better-call";
4
4
  import * as zod0 from "zod";
5
+ import { Organization } from "better-auth/plugins/organization";
5
6
  import Stripe from "stripe";
6
7
 
7
8
  //#region src/schema.d.ts
@@ -78,8 +79,29 @@ declare const user: {
78
79
  };
79
80
  };
80
81
  };
82
+ declare const organization: {
83
+ organization: {
84
+ fields: {
85
+ stripeCustomerId: {
86
+ type: "string";
87
+ required: false;
88
+ };
89
+ };
90
+ };
91
+ };
81
92
  //#endregion
82
93
  //#region src/types.d.ts
94
+ type AuthorizeReferenceAction = "upgrade-subscription" | "list-subscription" | "cancel-subscription" | "restore-subscription" | "billing-portal";
95
+ type WithStripeCustomerId = {
96
+ stripeCustomerId?: string;
97
+ };
98
+ type WithActiveOrganizationId = {
99
+ activeOrganizationId?: string;
100
+ };
101
+ type StripeCtxSession = {
102
+ session: Session & WithActiveOrganizationId;
103
+ user: User & WithStripeCustomerId;
104
+ };
83
105
  type StripePlan = {
84
106
  /**
85
107
  * Monthly price id
@@ -297,7 +319,7 @@ type SubscriptionOptions = {
297
319
  user: User & Record<string, any>;
298
320
  session: Session & Record<string, any>;
299
321
  referenceId: string;
300
- action: "upgrade-subscription" | "list-subscription" | "cancel-subscription" | "restore-subscription" | "billing-portal";
322
+ action: AuthorizeReferenceAction;
301
323
  }, ctx: GenericEndpointContext) => Promise<boolean>) | undefined;
302
324
  /**
303
325
  * A callback to run after a user has deleted their subscription
@@ -337,12 +359,6 @@ type SubscriptionOptions = {
337
359
  params?: Stripe.Checkout.SessionCreateParams;
338
360
  options?: Stripe.RequestOptions;
339
361
  }) | undefined;
340
- /**
341
- * Enable organization subscription
342
- */
343
- organization?: {
344
- enabled: boolean;
345
- } | undefined;
346
362
  };
347
363
  interface StripeOptions {
348
364
  /**
@@ -367,9 +383,7 @@ interface StripeOptions {
367
383
  */
368
384
  onCustomerCreate?: ((data: {
369
385
  stripeCustomer: Stripe.Customer;
370
- user: User & {
371
- stripeCustomerId: string;
372
- };
386
+ user: User & WithStripeCustomerId;
373
387
  }, ctx: GenericEndpointContext) => Promise<void>) | undefined;
374
388
  /**
375
389
  * A custom function to get the customer create
@@ -386,6 +400,37 @@ interface StripeOptions {
386
400
  } | ({
387
401
  enabled: true;
388
402
  } & SubscriptionOptions)) | undefined;
403
+ /**
404
+ * Organization Stripe integration
405
+ *
406
+ * Enable organizations to have their own Stripe customer ID
407
+ */
408
+ organization?: {
409
+ /**
410
+ * Enable organization Stripe customer
411
+ */
412
+ enabled: true;
413
+ /**
414
+ * A custom function to get the customer create params
415
+ * for organization customers.
416
+ *
417
+ * @param organization - the organization
418
+ * @param ctx - the context object
419
+ * @returns
420
+ */
421
+ getCustomerCreateParams?: ((organization: Organization, ctx: GenericEndpointContext) => Promise<Partial<Stripe.CustomerCreateParams>>) | undefined;
422
+ /**
423
+ * A callback to run after an organization customer has been created
424
+ *
425
+ * @param data - data containing stripeCustomer and organization
426
+ * @param ctx - the context object
427
+ * @returns
428
+ */
429
+ onCustomerCreate?: ((data: {
430
+ stripeCustomer: Stripe.Customer;
431
+ organization: Organization & WithStripeCustomerId;
432
+ }, ctx: GenericEndpointContext) => Promise<void>) | undefined;
433
+ } | undefined;
389
434
  /**
390
435
  * A callback to run after a stripe event is received
391
436
  * @param event - Stripe Event
@@ -395,7 +440,7 @@ interface StripeOptions {
395
440
  /**
396
441
  * Schema for the stripe plugin
397
442
  */
398
- schema?: InferOptionSchema<typeof subscriptions & typeof user> | undefined;
443
+ schema?: InferOptionSchema<typeof subscriptions & typeof user & typeof organization> | undefined;
399
444
  }
400
445
  //#endregion
401
446
  //#region src/index.d.ts
@@ -425,6 +470,10 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
425
470
  annual: zod0.ZodOptional<zod0.ZodBoolean>;
426
471
  referenceId: zod0.ZodOptional<zod0.ZodString>;
427
472
  subscriptionId: zod0.ZodOptional<zod0.ZodString>;
473
+ customerType: zod0.ZodOptional<zod0.ZodEnum<{
474
+ user: "user";
475
+ organization: "organization";
476
+ }>>;
428
477
  metadata: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodAny>>;
429
478
  seats: zod0.ZodOptional<zod0.ZodNumber>;
430
479
  successUrl: zod0.ZodDefault<zod0.ZodString>;
@@ -437,29 +486,33 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
437
486
  operationId: string;
438
487
  };
439
488
  };
440
- use: (((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
441
- session: {
442
- session: Record<string, any> & {
443
- id: string;
444
- createdAt: Date;
445
- updatedAt: Date;
446
- userId: string;
447
- expiresAt: Date;
448
- token: string;
449
- ipAddress?: string | null | undefined;
450
- userAgent?: string | null | undefined;
451
- };
452
- user: Record<string, any> & {
453
- id: string;
454
- createdAt: Date;
455
- updatedAt: Date;
456
- email: string;
457
- emailVerified: boolean;
458
- name: string;
459
- image?: string | null | undefined;
489
+ use: (((inputContext: better_call0.MiddlewareInputContext<{
490
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
491
+ session: {
492
+ session: Record<string, any> & {
493
+ id: string;
494
+ createdAt: Date;
495
+ updatedAt: Date;
496
+ userId: string;
497
+ expiresAt: Date;
498
+ token: string;
499
+ ipAddress?: string | null | undefined;
500
+ userAgent?: string | null | undefined;
501
+ };
502
+ user: Record<string, any> & {
503
+ id: string;
504
+ createdAt: Date;
505
+ updatedAt: Date;
506
+ email: string;
507
+ emailVerified: boolean;
508
+ name: string;
509
+ image?: string | null | undefined;
510
+ };
460
511
  };
461
- };
462
- }>))[];
512
+ }>)[];
513
+ }>) => Promise<{
514
+ session: StripeCtxSession;
515
+ }>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>))[];
463
516
  }, {
464
517
  url: string;
465
518
  redirect: boolean;
@@ -556,6 +609,10 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
556
609
  body: zod0.ZodObject<{
557
610
  referenceId: zod0.ZodOptional<zod0.ZodString>;
558
611
  subscriptionId: zod0.ZodOptional<zod0.ZodString>;
612
+ customerType: zod0.ZodOptional<zod0.ZodEnum<{
613
+ user: "user";
614
+ organization: "organization";
615
+ }>>;
559
616
  returnUrl: zod0.ZodString;
560
617
  disableRedirect: zod0.ZodDefault<zod0.ZodBoolean>;
561
618
  }, better_auth0.$strip>;
@@ -564,29 +621,33 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
564
621
  operationId: string;
565
622
  };
566
623
  };
567
- use: (((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
568
- session: {
569
- session: Record<string, any> & {
570
- id: string;
571
- createdAt: Date;
572
- updatedAt: Date;
573
- userId: string;
574
- expiresAt: Date;
575
- token: string;
576
- ipAddress?: string | null | undefined;
577
- userAgent?: string | null | undefined;
578
- };
579
- user: Record<string, any> & {
580
- id: string;
581
- createdAt: Date;
582
- updatedAt: Date;
583
- email: string;
584
- emailVerified: boolean;
585
- name: string;
586
- image?: string | null | undefined;
624
+ use: (((inputContext: better_call0.MiddlewareInputContext<{
625
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
626
+ session: {
627
+ session: Record<string, any> & {
628
+ id: string;
629
+ createdAt: Date;
630
+ updatedAt: Date;
631
+ userId: string;
632
+ expiresAt: Date;
633
+ token: string;
634
+ ipAddress?: string | null | undefined;
635
+ userAgent?: string | null | undefined;
636
+ };
637
+ user: Record<string, any> & {
638
+ id: string;
639
+ createdAt: Date;
640
+ updatedAt: Date;
641
+ email: string;
642
+ emailVerified: boolean;
643
+ name: string;
644
+ image?: string | null | undefined;
645
+ };
587
646
  };
588
- };
589
- }>))[];
647
+ }>)[];
648
+ }>) => Promise<{
649
+ session: StripeCtxSession;
650
+ }>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>))[];
590
651
  }, {
591
652
  url: string;
592
653
  redirect: boolean;
@@ -596,69 +657,85 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
596
657
  body: zod0.ZodObject<{
597
658
  referenceId: zod0.ZodOptional<zod0.ZodString>;
598
659
  subscriptionId: zod0.ZodOptional<zod0.ZodString>;
660
+ customerType: zod0.ZodOptional<zod0.ZodEnum<{
661
+ user: "user";
662
+ organization: "organization";
663
+ }>>;
599
664
  }, better_auth0.$strip>;
600
665
  metadata: {
601
666
  openapi: {
602
667
  operationId: string;
603
668
  };
604
669
  };
605
- use: (((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
606
- session: {
607
- session: Record<string, any> & {
608
- id: string;
609
- createdAt: Date;
610
- updatedAt: Date;
611
- userId: string;
612
- expiresAt: Date;
613
- token: string;
614
- ipAddress?: string | null | undefined;
615
- userAgent?: string | null | undefined;
616
- };
617
- user: Record<string, any> & {
618
- id: string;
619
- createdAt: Date;
620
- updatedAt: Date;
621
- email: string;
622
- emailVerified: boolean;
623
- name: string;
624
- image?: string | null | undefined;
670
+ use: (((inputContext: better_call0.MiddlewareInputContext<{
671
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
672
+ session: {
673
+ session: Record<string, any> & {
674
+ id: string;
675
+ createdAt: Date;
676
+ updatedAt: Date;
677
+ userId: string;
678
+ expiresAt: Date;
679
+ token: string;
680
+ ipAddress?: string | null | undefined;
681
+ userAgent?: string | null | undefined;
682
+ };
683
+ user: Record<string, any> & {
684
+ id: string;
685
+ createdAt: Date;
686
+ updatedAt: Date;
687
+ email: string;
688
+ emailVerified: boolean;
689
+ name: string;
690
+ image?: string | null | undefined;
691
+ };
625
692
  };
626
- };
627
- }>))[];
693
+ }>)[];
694
+ }>) => Promise<{
695
+ session: StripeCtxSession;
696
+ }>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>))[];
628
697
  }, Stripe.Response<Stripe.Subscription>>;
629
698
  listActiveSubscriptions: better_call0.StrictEndpoint<"/subscription/list", {
630
699
  method: "GET";
631
700
  query: zod0.ZodOptional<zod0.ZodObject<{
632
701
  referenceId: zod0.ZodOptional<zod0.ZodString>;
702
+ customerType: zod0.ZodOptional<zod0.ZodEnum<{
703
+ user: "user";
704
+ organization: "organization";
705
+ }>>;
633
706
  }, better_auth0.$strip>>;
634
707
  metadata: {
635
708
  openapi: {
636
709
  operationId: string;
637
710
  };
638
711
  };
639
- use: (((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
640
- session: {
641
- session: Record<string, any> & {
642
- id: string;
643
- createdAt: Date;
644
- updatedAt: Date;
645
- userId: string;
646
- expiresAt: Date;
647
- token: string;
648
- ipAddress?: string | null | undefined;
649
- userAgent?: string | null | undefined;
650
- };
651
- user: Record<string, any> & {
652
- id: string;
653
- createdAt: Date;
654
- updatedAt: Date;
655
- email: string;
656
- emailVerified: boolean;
657
- name: string;
658
- image?: string | null | undefined;
712
+ use: (((inputContext: better_call0.MiddlewareInputContext<{
713
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
714
+ session: {
715
+ session: Record<string, any> & {
716
+ id: string;
717
+ createdAt: Date;
718
+ updatedAt: Date;
719
+ userId: string;
720
+ expiresAt: Date;
721
+ token: string;
722
+ ipAddress?: string | null | undefined;
723
+ userAgent?: string | null | undefined;
724
+ };
725
+ user: Record<string, any> & {
726
+ id: string;
727
+ createdAt: Date;
728
+ updatedAt: Date;
729
+ email: string;
730
+ emailVerified: boolean;
731
+ name: string;
732
+ image?: string | null | undefined;
733
+ };
659
734
  };
660
- };
661
- }>))[];
735
+ }>)[];
736
+ }>) => Promise<{
737
+ session: StripeCtxSession;
738
+ }>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>))[];
662
739
  }, {
663
740
  limits: Record<string, unknown> | undefined;
664
741
  priceId: string | undefined;
@@ -688,25 +765,16 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
688
765
  };
689
766
  };
690
767
  use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>)[];
691
- }, {
692
- status: ("OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | better_call0.Status;
693
- body: ({
694
- message?: string;
695
- code?: string;
696
- cause?: unknown;
697
- } & Record<string, any>) | undefined;
698
- headers: HeadersInit;
699
- statusCode: number;
700
- name: string;
701
- message: string;
702
- stack?: string;
703
- cause?: unknown;
704
- }>;
768
+ }, never>;
705
769
  createBillingPortal: better_call0.StrictEndpoint<"/subscription/billing-portal", {
706
770
  method: "POST";
707
771
  body: zod0.ZodObject<{
708
772
  locale: zod0.ZodOptional<zod0.ZodCustom<Stripe.Checkout.Session.Locale, Stripe.Checkout.Session.Locale>>;
709
773
  referenceId: zod0.ZodOptional<zod0.ZodString>;
774
+ customerType: zod0.ZodOptional<zod0.ZodEnum<{
775
+ user: "user";
776
+ organization: "organization";
777
+ }>>;
710
778
  returnUrl: zod0.ZodDefault<zod0.ZodString>;
711
779
  disableRedirect: zod0.ZodDefault<zod0.ZodBoolean>;
712
780
  }, better_auth0.$strip>;
@@ -715,29 +783,33 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
715
783
  operationId: string;
716
784
  };
717
785
  };
718
- use: (((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
719
- session: {
720
- session: Record<string, any> & {
721
- id: string;
722
- createdAt: Date;
723
- updatedAt: Date;
724
- userId: string;
725
- expiresAt: Date;
726
- token: string;
727
- ipAddress?: string | null | undefined;
728
- userAgent?: string | null | undefined;
729
- };
730
- user: Record<string, any> & {
731
- id: string;
732
- createdAt: Date;
733
- updatedAt: Date;
734
- email: string;
735
- emailVerified: boolean;
736
- name: string;
737
- image?: string | null | undefined;
786
+ use: (((inputContext: better_call0.MiddlewareInputContext<{
787
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
788
+ session: {
789
+ session: Record<string, any> & {
790
+ id: string;
791
+ createdAt: Date;
792
+ updatedAt: Date;
793
+ userId: string;
794
+ expiresAt: Date;
795
+ token: string;
796
+ ipAddress?: string | null | undefined;
797
+ userAgent?: string | null | undefined;
798
+ };
799
+ user: Record<string, any> & {
800
+ id: string;
801
+ createdAt: Date;
802
+ updatedAt: Date;
803
+ email: string;
804
+ emailVerified: boolean;
805
+ name: string;
806
+ image?: string | null | undefined;
807
+ };
738
808
  };
739
- };
740
- }>))[];
809
+ }>)[];
810
+ }>) => Promise<{
811
+ session: StripeCtxSession;
812
+ }>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>))[];
741
813
  }, {
742
814
  url: string;
743
815
  redirect: boolean;
@@ -748,42 +820,39 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
748
820
  databaseHooks: {
749
821
  user: {
750
822
  create: {
751
- after(user: {
752
- id: string;
753
- createdAt: Date;
754
- updatedAt: Date;
755
- email: string;
756
- emailVerified: boolean;
757
- name: string;
758
- image?: string | null | undefined;
759
- } & Record<string, unknown>, ctx: better_auth0.GenericEndpointContext | null): Promise<void>;
823
+ after(user: User & WithStripeCustomerId, ctx: better_auth0.GenericEndpointContext | null): Promise<void>;
760
824
  };
761
825
  update: {
762
- after(user: {
763
- id: string;
764
- createdAt: Date;
765
- updatedAt: Date;
766
- email: string;
767
- emailVerified: boolean;
768
- name: string;
769
- image?: string | null | undefined;
770
- } & Record<string, unknown>, ctx: better_auth0.GenericEndpointContext | null): Promise<void>;
826
+ after(user: User & WithStripeCustomerId, ctx: better_auth0.GenericEndpointContext | null): Promise<void>;
771
827
  };
772
828
  };
773
829
  };
774
830
  };
775
- };
831
+ } | undefined;
776
832
  schema: {};
777
833
  options: NoInfer<O>;
778
834
  $ERROR_CODES: {
835
+ readonly UNAUTHORIZED: "Unauthorized access";
836
+ readonly INVALID_REQUEST_BODY: "Invalid request body";
779
837
  readonly SUBSCRIPTION_NOT_FOUND: "Subscription not found";
780
838
  readonly SUBSCRIPTION_PLAN_NOT_FOUND: "Subscription plan not found";
781
839
  readonly ALREADY_SUBSCRIBED_PLAN: "You're already subscribed to this plan";
840
+ readonly REFERENCE_ID_NOT_ALLOWED: "Reference id is not allowed";
841
+ readonly CUSTOMER_NOT_FOUND: "Stripe customer not found for this user";
782
842
  readonly UNABLE_TO_CREATE_CUSTOMER: "Unable to create customer";
843
+ readonly UNABLE_TO_CREATE_BILLING_PORTAL: "Unable to create billing portal session";
844
+ readonly STRIPE_SIGNATURE_NOT_FOUND: "Stripe signature not found";
845
+ readonly STRIPE_WEBHOOK_SECRET_NOT_FOUND: "Stripe webhook secret not found";
846
+ readonly STRIPE_WEBHOOK_ERROR: "Stripe webhook error";
847
+ readonly FAILED_TO_CONSTRUCT_STRIPE_EVENT: "Failed to construct Stripe event";
783
848
  readonly FAILED_TO_FETCH_PLANS: "Failed to fetch plans";
784
849
  readonly EMAIL_VERIFICATION_REQUIRED: "Email verification is required before you can subscribe to a plan";
785
850
  readonly SUBSCRIPTION_NOT_ACTIVE: "Subscription is not active";
786
851
  readonly SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION: "Subscription is not scheduled for cancellation";
852
+ readonly ORGANIZATION_NOT_FOUND: "Organization not found";
853
+ readonly ORGANIZATION_SUBSCRIPTION_NOT_ENABLED: "Organization subscription is not enabled";
854
+ readonly ORGANIZATION_HAS_ACTIVE_SUBSCRIPTION: "Cannot delete organization with active subscription";
855
+ readonly ORGANIZATION_REFERENCE_ID_REQUIRED: "Reference ID is required. Provide referenceId or set activeOrganizationId in session";
787
856
  };
788
857
  };
789
858
  type StripePlugin<O extends StripeOptions> = ReturnType<typeof stripe<O>>;
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as SubscriptionOptions, i as Subscription, n as stripe, r as StripePlan, t as StripePlugin } from "./index-DtwvPnmn.mjs";
1
+ import { a as SubscriptionOptions, i as Subscription, n as stripe, r as StripePlan, t as StripePlugin } from "./index-CkO4CTbB.mjs";
2
2
  export { StripePlan, StripePlugin, Subscription, SubscriptionOptions, stripe };