@better-auth/stripe 1.6.0-beta.0 → 1.6.0

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.
package/dist/client.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as stripe, s as StripePlan } from "./index-8IZIblUa.mjs";
1
+ import { n as stripe, s as StripePlan } from "./index-DCU1841o.mjs";
2
2
  import * as better_auth0 from "better-auth";
3
3
 
4
4
  //#region src/error-codes.d.ts
package/dist/client.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as STRIPE_ERROR_CODES, t as PACKAGE_VERSION } from "./version-2GttfqFB.mjs";
1
+ import { n as STRIPE_ERROR_CODES, t as PACKAGE_VERSION } from "./version-CJkKdVDD.mjs";
2
2
  //#region src/client.ts
3
3
  const stripeClient = (options) => {
4
4
  return {
@@ -1,6 +1,8 @@
1
1
  import * as better_auth0 from "better-auth";
2
2
  import { GenericEndpointContext, InferOptionSchema, Session, User } from "better-auth";
3
+ import * as zod from "zod";
3
4
  import * as better_call0 from "better-call";
5
+ import * as zod_v4_core0 from "zod/v4/core";
4
6
  import { Organization } from "better-auth/plugins/organization";
5
7
  import Stripe from "stripe";
6
8
 
@@ -502,34 +504,77 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
502
504
  id: "stripe";
503
505
  version: string;
504
506
  endpoints: {
505
- stripeWebhook: better_call0.Endpoint<"/stripe/webhook", "POST", undefined, Record<string, any> | undefined, [], {
506
- success: boolean;
507
- }, {
508
- openapi: {
509
- operationId: string;
507
+ stripeWebhook: better_call0.StrictEndpoint<"/stripe/webhook", {
508
+ method: "POST";
509
+ metadata: {
510
+ openapi: {
511
+ operationId: string;
512
+ };
513
+ scope: "server";
510
514
  };
511
- scope: "server";
512
- }, undefined>;
515
+ cloneRequest: true;
516
+ disableBody: true;
517
+ }, {
518
+ success: boolean;
519
+ }>;
513
520
  } & (O["subscription"] extends {
514
521
  enabled: true;
515
522
  } ? {
516
- upgradeSubscription: better_call0.Endpoint<"/subscription/upgrade", "POST", {
517
- plan: string;
518
- annual?: boolean | undefined;
519
- referenceId?: string | undefined;
520
- subscriptionId?: string | undefined;
521
- customerType?: "user" | "organization" | undefined;
522
- metadata?: Record<string, any> | undefined;
523
- seats?: number | undefined;
524
- locale?: Stripe.Checkout.Session.Locale | undefined;
525
- successUrl?: string | undefined;
526
- cancelUrl?: string | undefined;
527
- returnUrl?: string | undefined;
528
- scheduleAtPeriodEnd?: boolean | undefined;
529
- disableRedirect?: boolean | undefined;
530
- }, Record<string, any> | undefined, [better_call0.Middleware<(inputContext: Record<string, any>) => Promise<{
531
- session: StripeCtxSession;
532
- }>>, better_call0.Middleware<(inputContext: Record<string, any>) => Promise<void>>, better_call0.Middleware<(inputContext: Record<string, any>) => Promise<void>>], {
523
+ upgradeSubscription: better_call0.StrictEndpoint<"/subscription/upgrade", {
524
+ method: "POST";
525
+ body: zod.ZodObject<{
526
+ plan: zod.ZodString;
527
+ annual: zod.ZodOptional<zod.ZodBoolean>;
528
+ referenceId: zod.ZodOptional<zod.ZodString>;
529
+ subscriptionId: zod.ZodOptional<zod.ZodString>;
530
+ customerType: zod.ZodOptional<zod.ZodEnum<{
531
+ user: "user";
532
+ organization: "organization";
533
+ }>>;
534
+ metadata: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodAny>>;
535
+ seats: zod.ZodOptional<zod.ZodNumber>;
536
+ locale: zod.ZodOptional<zod.ZodCustom<Stripe.Checkout.Session.Locale, Stripe.Checkout.Session.Locale>>;
537
+ successUrl: zod.ZodDefault<zod.ZodString>;
538
+ cancelUrl: zod.ZodDefault<zod.ZodString>;
539
+ returnUrl: zod.ZodOptional<zod.ZodString>;
540
+ scheduleAtPeriodEnd: zod.ZodDefault<zod.ZodBoolean>;
541
+ disableRedirect: zod.ZodDefault<zod.ZodBoolean>;
542
+ }, zod_v4_core0.$strip>;
543
+ metadata: {
544
+ openapi: {
545
+ operationId: string;
546
+ };
547
+ };
548
+ use: (((inputContext: better_call0.MiddlewareInputContext<{
549
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
550
+ session: {
551
+ session: Record<string, any> & {
552
+ id: string;
553
+ createdAt: Date;
554
+ updatedAt: Date;
555
+ userId: string;
556
+ expiresAt: Date;
557
+ token: string;
558
+ ipAddress?: string | null | undefined;
559
+ userAgent?: string | null | undefined;
560
+ };
561
+ user: Record<string, any> & {
562
+ id: string;
563
+ createdAt: Date;
564
+ updatedAt: Date;
565
+ email: string;
566
+ emailVerified: boolean;
567
+ name: string;
568
+ image /**
569
+ * Sync organization name to Stripe customer
570
+ */?: string | null | undefined;
571
+ };
572
+ };
573
+ }>)[];
574
+ }>) => Promise<{
575
+ session: StripeCtxSession;
576
+ }>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>))[];
577
+ }, {
533
578
  url: string;
534
579
  redirect: boolean;
535
580
  } | {
@@ -610,44 +655,146 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
610
655
  idempotencyKey?: string;
611
656
  stripeAccount?: string;
612
657
  };
613
- }, {
614
- openapi: {
615
- operationId: string;
658
+ }>;
659
+ cancelSubscription: better_call0.StrictEndpoint<"/subscription/cancel", {
660
+ method: "POST";
661
+ body: zod.ZodObject<{
662
+ referenceId: zod.ZodOptional<zod.ZodString>;
663
+ subscriptionId: zod.ZodOptional<zod.ZodString>;
664
+ customerType: zod.ZodOptional<zod.ZodEnum<{
665
+ user: "user";
666
+ organization: "organization";
667
+ }>>;
668
+ returnUrl: zod.ZodString;
669
+ disableRedirect: zod.ZodDefault<zod.ZodBoolean>;
670
+ }, zod_v4_core0.$strip>;
671
+ metadata: {
672
+ openapi: {
673
+ operationId: string;
674
+ };
616
675
  };
617
- }, undefined>;
618
- cancelSubscription: better_call0.Endpoint<"/subscription/cancel", "POST", {
619
- returnUrl: string;
620
- referenceId?: string | undefined;
621
- subscriptionId?: string | undefined;
622
- customerType?: "user" | "organization" | undefined;
623
- disableRedirect?: boolean | undefined;
624
- }, Record<string, any> | undefined, [better_call0.Middleware<(inputContext: Record<string, any>) => Promise<{
625
- session: StripeCtxSession;
626
- }>>, better_call0.Middleware<(inputContext: Record<string, any>) => Promise<void>>, better_call0.Middleware<(inputContext: Record<string, any>) => Promise<void>>], {
676
+ use: (((inputContext: better_call0.MiddlewareInputContext<{
677
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
678
+ session: {
679
+ session: Record<string, any> & {
680
+ id: string;
681
+ createdAt: Date;
682
+ updatedAt: Date;
683
+ userId: string;
684
+ expiresAt: Date;
685
+ token: string;
686
+ ipAddress?: string | null | undefined;
687
+ userAgent?: string | null | undefined;
688
+ };
689
+ user: Record<string, any> & {
690
+ id: string;
691
+ createdAt: Date;
692
+ updatedAt: Date;
693
+ email: string;
694
+ emailVerified: boolean;
695
+ name: string;
696
+ image /**
697
+ * Sync organization name to Stripe customer
698
+ */?: string | null | undefined;
699
+ };
700
+ };
701
+ }>)[];
702
+ }>) => Promise<{
703
+ session: StripeCtxSession;
704
+ }>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>))[];
705
+ }, {
627
706
  url: string;
628
707
  redirect: boolean;
629
- }, {
630
- openapi: {
631
- operationId: string;
708
+ }>;
709
+ restoreSubscription: better_call0.StrictEndpoint<"/subscription/restore", {
710
+ method: "POST";
711
+ body: zod.ZodObject<{
712
+ referenceId: zod.ZodOptional<zod.ZodString>;
713
+ subscriptionId: zod.ZodOptional<zod.ZodString>;
714
+ customerType: zod.ZodOptional<zod.ZodEnum<{
715
+ user: "user";
716
+ organization: "organization";
717
+ }>>;
718
+ }, zod_v4_core0.$strip>;
719
+ metadata: {
720
+ openapi: {
721
+ operationId: string;
722
+ };
632
723
  };
633
- }, undefined>;
634
- restoreSubscription: better_call0.Endpoint<"/subscription/restore", "POST", {
635
- referenceId?: string | undefined;
636
- subscriptionId?: string | undefined;
637
- customerType?: "user" | "organization" | undefined;
638
- }, Record<string, any> | undefined, [better_call0.Middleware<(inputContext: Record<string, any>) => Promise<{
639
- session: StripeCtxSession;
640
- }>>, better_call0.Middleware<(inputContext: Record<string, any>) => Promise<void>>], Stripe.Response<Stripe.Subscription>, {
641
- openapi: {
642
- operationId: string;
724
+ use: (((inputContext: better_call0.MiddlewareInputContext<{
725
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
726
+ session: {
727
+ session: Record<string, any> & {
728
+ id: string;
729
+ createdAt: Date;
730
+ updatedAt: Date;
731
+ userId: string;
732
+ expiresAt: Date;
733
+ token: string;
734
+ ipAddress?: string | null | undefined;
735
+ userAgent?: string | null | undefined;
736
+ };
737
+ user: Record<string, any> & {
738
+ id: string;
739
+ createdAt: Date;
740
+ updatedAt: Date;
741
+ email: string;
742
+ emailVerified: boolean;
743
+ name: string;
744
+ image /**
745
+ * Sync organization name to Stripe customer
746
+ */?: string | null | undefined;
747
+ };
748
+ };
749
+ }>)[];
750
+ }>) => Promise<{
751
+ session: StripeCtxSession;
752
+ }>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>))[];
753
+ }, Stripe.Response<Stripe.Subscription>>;
754
+ listActiveSubscriptions: better_call0.StrictEndpoint<"/subscription/list", {
755
+ method: "GET";
756
+ query: zod.ZodOptional<zod.ZodObject<{
757
+ referenceId: zod.ZodOptional<zod.ZodString>;
758
+ customerType: zod.ZodOptional<zod.ZodEnum<{
759
+ user: "user";
760
+ organization: "organization";
761
+ }>>;
762
+ }, zod_v4_core0.$strip>>;
763
+ metadata: {
764
+ openapi: {
765
+ operationId: string;
766
+ };
643
767
  };
644
- }, undefined>;
645
- listActiveSubscriptions: better_call0.Endpoint<"/subscription/list", "GET", undefined, {
646
- referenceId?: string | undefined;
647
- customerType?: "user" | "organization" | undefined;
648
- } | undefined, [better_call0.Middleware<(inputContext: Record<string, any>) => Promise<{
649
- session: StripeCtxSession;
650
- }>>, better_call0.Middleware<(inputContext: Record<string, any>) => Promise<void>>], {
768
+ use: (((inputContext: better_call0.MiddlewareInputContext<{
769
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
770
+ session: {
771
+ session: Record<string, any> & {
772
+ id: string;
773
+ createdAt: Date;
774
+ updatedAt: Date;
775
+ userId: string;
776
+ expiresAt: Date;
777
+ token: string;
778
+ ipAddress?: string | null | undefined;
779
+ userAgent?: string | null | undefined;
780
+ };
781
+ user: Record<string, any> & {
782
+ id: string;
783
+ createdAt: Date;
784
+ updatedAt: Date;
785
+ email: string;
786
+ emailVerified: boolean;
787
+ name: string;
788
+ image /**
789
+ * Sync organization name to Stripe customer
790
+ */?: string | null | undefined;
791
+ };
792
+ };
793
+ }>)[];
794
+ }>) => Promise<{
795
+ session: StripeCtxSession;
796
+ }>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>))[];
797
+ }, {
651
798
  limits: Record<string, unknown> | undefined;
652
799
  priceId: string | undefined;
653
800
  id: string;
@@ -668,32 +815,67 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
668
815
  seats?: number | undefined;
669
816
  billingInterval?: "day" | "week" | "month" | "year" | undefined;
670
817
  stripeScheduleId?: string | undefined;
671
- }[], {
672
- openapi: {
673
- operationId: string;
818
+ }[]>;
819
+ subscriptionSuccess: better_call0.StrictEndpoint<"/subscription/success", {
820
+ method: "GET";
821
+ query: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodAny>>;
822
+ metadata: {
823
+ openapi: {
824
+ operationId: string;
825
+ };
674
826
  };
675
- }, undefined>;
676
- subscriptionSuccess: better_call0.Endpoint<"/subscription/success", "GET", undefined, Record<string, any> | undefined, [better_call0.Middleware<(inputContext: Record<string, any>) => Promise<void>>], never, {
677
- openapi: {
678
- operationId: string;
827
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>)[];
828
+ }, never>;
829
+ createBillingPortal: better_call0.StrictEndpoint<"/subscription/billing-portal", {
830
+ method: "POST";
831
+ body: zod.ZodObject<{
832
+ locale: zod.ZodOptional<zod.ZodCustom<Stripe.Checkout.Session.Locale, Stripe.Checkout.Session.Locale>>;
833
+ referenceId: zod.ZodOptional<zod.ZodString>;
834
+ customerType: zod.ZodOptional<zod.ZodEnum<{
835
+ user: "user";
836
+ organization: "organization";
837
+ }>>;
838
+ returnUrl: zod.ZodDefault<zod.ZodString>;
839
+ disableRedirect: zod.ZodDefault<zod.ZodBoolean>;
840
+ }, zod_v4_core0.$strip>;
841
+ metadata: {
842
+ openapi: {
843
+ operationId: string;
844
+ };
679
845
  };
680
- }, undefined>;
681
- createBillingPortal: better_call0.Endpoint<"/subscription/billing-portal", "POST", {
682
- locale?: Stripe.Checkout.Session.Locale | undefined;
683
- referenceId?: string | undefined;
684
- customerType?: "user" | "organization" | undefined;
685
- returnUrl?: string | undefined;
686
- disableRedirect?: boolean | undefined;
687
- }, Record<string, any> | undefined, [better_call0.Middleware<(inputContext: Record<string, any>) => Promise<{
688
- session: StripeCtxSession;
689
- }>>, better_call0.Middleware<(inputContext: Record<string, any>) => Promise<void>>, better_call0.Middleware<(inputContext: Record<string, any>) => Promise<void>>], {
846
+ use: (((inputContext: better_call0.MiddlewareInputContext<{
847
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
848
+ session: {
849
+ session: Record<string, any> & {
850
+ id: string;
851
+ createdAt: Date;
852
+ updatedAt: Date;
853
+ userId: string;
854
+ expiresAt: Date;
855
+ token: string;
856
+ ipAddress?: string | null | undefined;
857
+ userAgent?: string | null | undefined;
858
+ };
859
+ user: Record<string, any> & {
860
+ id: string;
861
+ createdAt: Date;
862
+ updatedAt: Date;
863
+ email: string;
864
+ emailVerified: boolean;
865
+ name: string;
866
+ image /**
867
+ * Sync organization name to Stripe customer
868
+ */?: string | null | undefined;
869
+ };
870
+ };
871
+ }>)[];
872
+ }>) => Promise<{
873
+ session: StripeCtxSession;
874
+ }>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>))[];
875
+ }, {
690
876
  url: string;
691
877
  redirect: boolean;
692
- }, {
693
- openapi: {
694
- operationId: string;
695
- };
696
- }, undefined>;
878
+ }>;
697
879
  } : {});
698
880
  init(ctx: better_auth0.AuthContext): {
699
881
  options: {
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as StripeCtxSession, c as Subscription, d as WithStripeCustomerId, i as CustomerType, l as SubscriptionOptions, n as stripe, o as StripeOptions, r as AuthorizeReferenceAction, s as StripePlan, t as StripePlugin, u as WithActiveOrganizationId } from "./index-8IZIblUa.mjs";
1
+ import { a as StripeCtxSession, c as Subscription, d as WithStripeCustomerId, i as CustomerType, l as SubscriptionOptions, n as stripe, o as StripeOptions, r as AuthorizeReferenceAction, s as StripePlan, t as StripePlugin, u as WithActiveOrganizationId } from "./index-DCU1841o.mjs";
2
2
  export { AuthorizeReferenceAction, CustomerType, StripeCtxSession, StripeOptions, StripePlan, StripePlugin, Subscription, SubscriptionOptions, WithActiveOrganizationId, WithStripeCustomerId, stripe };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as STRIPE_ERROR_CODES, t as PACKAGE_VERSION } from "./version-2GttfqFB.mjs";
1
+ import { n as STRIPE_ERROR_CODES, t as PACKAGE_VERSION } from "./version-CJkKdVDD.mjs";
2
2
  import { APIError, HIDE_METADATA } from "better-auth";
3
3
  import { defu } from "defu";
4
4
  import { createAuthEndpoint, createAuthMiddleware } from "@better-auth/core/api";
@@ -27,6 +27,6 @@ const STRIPE_ERROR_CODES = defineErrorCodes({
27
27
  });
28
28
  //#endregion
29
29
  //#region src/version.ts
30
- const PACKAGE_VERSION = "1.6.0-beta.0";
30
+ const PACKAGE_VERSION = "1.6.0";
31
31
  //#endregion
32
32
  export { STRIPE_ERROR_CODES as n, PACKAGE_VERSION as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/stripe",
3
- "version": "1.6.0-beta.0",
3
+ "version": "1.6.0",
4
4
  "description": "Stripe plugin for Better Auth",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -55,17 +55,17 @@
55
55
  "zod": "^4.3.6"
56
56
  },
57
57
  "devDependencies": {
58
- "better-call": "2.0.3",
58
+ "better-call": "1.3.5",
59
59
  "stripe": "^20.4.0",
60
60
  "tsdown": "0.21.1",
61
- "better-auth": "1.6.0-beta.0",
62
- "@better-auth/core": "1.6.0-beta.0"
61
+ "@better-auth/core": "1.6.0",
62
+ "better-auth": "1.6.0"
63
63
  },
64
64
  "peerDependencies": {
65
- "better-call": "2.0.3",
65
+ "better-call": "1.3.5",
66
66
  "stripe": "^18 || ^19 || ^20",
67
- "@better-auth/core": "^1.6.0-beta.0",
68
- "better-auth": "^1.6.0-beta.0"
67
+ "@better-auth/core": "^1.6.0",
68
+ "better-auth": "^1.6.0"
69
69
  },
70
70
  "scripts": {
71
71
  "build": "tsdown",