@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
package/dist/client.mjs
CHANGED
|
@@ -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.
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
507
|
+
stripeWebhook: better_call0.StrictEndpoint<"/stripe/webhook", {
|
|
508
|
+
method: "POST";
|
|
509
|
+
metadata: {
|
|
510
|
+
openapi: {
|
|
511
|
+
operationId: string;
|
|
512
|
+
};
|
|
513
|
+
scope: "server";
|
|
510
514
|
};
|
|
511
|
-
|
|
512
|
-
|
|
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.
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
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
|
-
|
|
615
|
-
|
|
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
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
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
|
-
|
|
631
|
-
|
|
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
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
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
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
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
|
-
|
|
673
|
-
|
|
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
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
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
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
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-
|
|
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-
|
|
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";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/stripe",
|
|
3
|
-
"version": "1.6.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": "
|
|
58
|
+
"better-call": "1.3.5",
|
|
59
59
|
"stripe": "^20.4.0",
|
|
60
60
|
"tsdown": "0.21.1",
|
|
61
|
-
"better-auth": "1.6.0
|
|
62
|
-
"
|
|
61
|
+
"@better-auth/core": "1.6.0",
|
|
62
|
+
"better-auth": "1.6.0"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"better-call": "
|
|
65
|
+
"better-call": "1.3.5",
|
|
66
66
|
"stripe": "^18 || ^19 || ^20",
|
|
67
|
-
"@better-auth/core": "^1.6.0
|
|
68
|
-
"better-auth": "^1.6.0
|
|
67
|
+
"@better-auth/core": "^1.6.0",
|
|
68
|
+
"better-auth": "^1.6.0"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"build": "tsdown",
|