@better-auth/stripe 1.5.0-beta.1 → 1.5.0-beta.10
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/.turbo/turbo-build.log +15 -10
- package/LICENSE.md +15 -12
- package/dist/client.d.mts +47 -66
- package/dist/client.mjs +7 -3
- package/dist/client.mjs.map +1 -0
- package/dist/error-codes-CMowBCzF.mjs +30 -0
- package/dist/error-codes-CMowBCzF.mjs.map +1 -0
- package/dist/{index-DpiQGYLJ.d.mts → index-D9Pr9jIc.d.mts} +371 -188
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +720 -293
- package/dist/index.mjs.map +1 -0
- package/package.json +10 -10
- package/src/client.ts +2 -1
- package/src/error-codes.ts +17 -1
- package/src/hooks.ts +238 -57
- package/src/index.ts +149 -49
- package/src/metadata.ts +94 -0
- package/src/middleware.ts +91 -45
- package/src/routes.ts +699 -368
- package/src/schema.ts +40 -4
- package/src/types.ts +105 -20
- package/src/utils.ts +36 -1
- package/test/stripe-organization.test.ts +1993 -0
- package/{src → test}/stripe.test.ts +3775 -1393
- package/tsdown.config.ts +1 -0
- package/CHANGELOG.md +0 -22
- package/dist/error-codes-qqooUh6R.mjs +0 -16
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/stripe@1.5.0-beta.
|
|
2
|
+
> @better-auth/stripe@1.5.0-beta.10 build /home/runner/work/better-auth/better-auth/packages/stripe
|
|
3
3
|
> tsdown
|
|
4
4
|
|
|
5
|
-
[34mℹ[39m tsdown [2mv0.
|
|
5
|
+
[34mℹ[39m tsdown [2mv0.20.1[22m powered by rolldown [2mv1.0.0-rc.1[22m
|
|
6
6
|
[34mℹ[39m config file: [4m/home/runner/work/better-auth/better-auth/packages/stripe/tsdown.config.ts[24m
|
|
7
7
|
[34mℹ[39m entry: [34msrc/index.ts, src/client.ts[39m
|
|
8
8
|
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
9
|
[34mℹ[39m Build start
|
|
10
|
-
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m
|
|
11
|
-
[34mℹ[39m [2mdist/[22m[1mclient.mjs[22m
|
|
12
|
-
[34mℹ[39m [2mdist/[
|
|
13
|
-
[
|
|
14
|
-
[34mℹ[39m [2mdist/[
|
|
15
|
-
[34mℹ[39m [2mdist/[
|
|
16
|
-
|
|
17
|
-
[
|
|
10
|
+
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m 57.14 kB[22m [2m│ gzip: 10.38 kB[22m
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1mclient.mjs[22m [2m 0.43 kB[22m [2m│ gzip: 0.29 kB[22m
|
|
12
|
+
[34mℹ[39m [2mdist/[22mindex.mjs.map [2m122.18 kB[22m [2m│ gzip: 22.93 kB[22m
|
|
13
|
+
[33m[PLUGIN_TIMINGS] Warning:[0m Your build spent significant time in plugin `rolldown-plugin-dts:generate`. See https://rolldown.rs/options/checks#plugintimings for more details.
|
|
14
|
+
[34mℹ[39m [2mdist/[22merror-codes-CMowBCzF.mjs.map [2m 2.09 kB[22m [2m│ gzip: 0.96 kB[22m
|
|
15
|
+
[34mℹ[39m [2mdist/[22merror-codes-CMowBCzF.mjs [2m 1.67 kB[22m [2m│ gzip: 0.78 kB[22m
|
|
16
|
+
|
|
17
|
+
[34mℹ[39m [2mdist/[22mclient.mjs.map [2m 1.25 kB[22m [2m│ gzip: 0.59 kB[22m
|
|
18
|
+
[34mℹ[39m [2mdist/[22m[32m[1mclient.d.mts[22m[39m [2m 4.43 kB[22m [2m│ gzip: 0.88 kB[22m
|
|
19
|
+
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 0.21 kB[22m [2m│ gzip: 0.14 kB[22m
|
|
20
|
+
[34mℹ[39m [2mdist/[22m[32mindex-D9Pr9jIc.d.mts[39m [2m 30.70 kB[22m [2m│ gzip: 5.11 kB[22m
|
|
21
|
+
[34mℹ[39m 9 files, total: 220.11 kB
|
|
22
|
+
[32m✔[39m Build complete in [32m33060ms[39m
|
package/LICENSE.md
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
Copyright (c) 2024 - present, Bereket Engida
|
|
3
3
|
|
|
4
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
-
and associated documentation files (the
|
|
6
|
-
including without limitation the rights to
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
+
this software and associated documentation files (the “Software”), to deal in
|
|
6
|
+
the Software without restriction, including without limitation the rights to
|
|
7
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
8
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
9
|
+
subject to the following conditions:
|
|
9
10
|
|
|
10
|
-
The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
substantial portions of the Software.
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
12
13
|
|
|
13
|
-
THE SOFTWARE IS PROVIDED
|
|
14
|
-
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
16
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
18
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
19
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
20
|
+
DEALINGS IN THE SOFTWARE.
|
package/dist/client.d.mts
CHANGED
|
@@ -1,39 +1,29 @@
|
|
|
1
|
-
import { n as stripe } from "./index-
|
|
1
|
+
import { n as stripe } from "./index-D9Pr9jIc.mjs";
|
|
2
|
+
import * as better_auth49 from "better-auth";
|
|
2
3
|
|
|
3
4
|
//#region src/error-codes.d.ts
|
|
4
5
|
declare const STRIPE_ERROR_CODES: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
code: "EMAIL_VERIFICATION_REQUIRED";
|
|
27
|
-
message: "Email verification is required before you can subscribe to a plan";
|
|
28
|
-
};
|
|
29
|
-
readonly SUBSCRIPTION_NOT_ACTIVE: {
|
|
30
|
-
code: "SUBSCRIPTION_NOT_ACTIVE";
|
|
31
|
-
message: "Subscription is not active";
|
|
32
|
-
};
|
|
33
|
-
readonly SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION: {
|
|
34
|
-
code: "SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION";
|
|
35
|
-
message: "Subscription is not scheduled for cancellation";
|
|
36
|
-
};
|
|
6
|
+
UNAUTHORIZED: better_auth49.RawError<"UNAUTHORIZED">;
|
|
7
|
+
INVALID_REQUEST_BODY: better_auth49.RawError<"INVALID_REQUEST_BODY">;
|
|
8
|
+
SUBSCRIPTION_NOT_FOUND: better_auth49.RawError<"SUBSCRIPTION_NOT_FOUND">;
|
|
9
|
+
SUBSCRIPTION_PLAN_NOT_FOUND: better_auth49.RawError<"SUBSCRIPTION_PLAN_NOT_FOUND">;
|
|
10
|
+
ALREADY_SUBSCRIBED_PLAN: better_auth49.RawError<"ALREADY_SUBSCRIBED_PLAN">;
|
|
11
|
+
REFERENCE_ID_NOT_ALLOWED: better_auth49.RawError<"REFERENCE_ID_NOT_ALLOWED">;
|
|
12
|
+
CUSTOMER_NOT_FOUND: better_auth49.RawError<"CUSTOMER_NOT_FOUND">;
|
|
13
|
+
UNABLE_TO_CREATE_CUSTOMER: better_auth49.RawError<"UNABLE_TO_CREATE_CUSTOMER">;
|
|
14
|
+
UNABLE_TO_CREATE_BILLING_PORTAL: better_auth49.RawError<"UNABLE_TO_CREATE_BILLING_PORTAL">;
|
|
15
|
+
STRIPE_SIGNATURE_NOT_FOUND: better_auth49.RawError<"STRIPE_SIGNATURE_NOT_FOUND">;
|
|
16
|
+
STRIPE_WEBHOOK_SECRET_NOT_FOUND: better_auth49.RawError<"STRIPE_WEBHOOK_SECRET_NOT_FOUND">;
|
|
17
|
+
STRIPE_WEBHOOK_ERROR: better_auth49.RawError<"STRIPE_WEBHOOK_ERROR">;
|
|
18
|
+
FAILED_TO_CONSTRUCT_STRIPE_EVENT: better_auth49.RawError<"FAILED_TO_CONSTRUCT_STRIPE_EVENT">;
|
|
19
|
+
FAILED_TO_FETCH_PLANS: better_auth49.RawError<"FAILED_TO_FETCH_PLANS">;
|
|
20
|
+
EMAIL_VERIFICATION_REQUIRED: better_auth49.RawError<"EMAIL_VERIFICATION_REQUIRED">;
|
|
21
|
+
SUBSCRIPTION_NOT_ACTIVE: better_auth49.RawError<"SUBSCRIPTION_NOT_ACTIVE">;
|
|
22
|
+
SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION: better_auth49.RawError<"SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION">;
|
|
23
|
+
ORGANIZATION_NOT_FOUND: better_auth49.RawError<"ORGANIZATION_NOT_FOUND">;
|
|
24
|
+
ORGANIZATION_SUBSCRIPTION_NOT_ENABLED: better_auth49.RawError<"ORGANIZATION_SUBSCRIPTION_NOT_ENABLED">;
|
|
25
|
+
ORGANIZATION_HAS_ACTIVE_SUBSCRIPTION: better_auth49.RawError<"ORGANIZATION_HAS_ACTIVE_SUBSCRIPTION">;
|
|
26
|
+
ORGANIZATION_REFERENCE_ID_REQUIRED: better_auth49.RawError<"ORGANIZATION_REFERENCE_ID_REQUIRED">;
|
|
37
27
|
};
|
|
38
28
|
//#endregion
|
|
39
29
|
//#region src/client.d.ts
|
|
@@ -54,41 +44,32 @@ declare const stripeClient: <O extends {
|
|
|
54
44
|
}>>;
|
|
55
45
|
pathMethods: {
|
|
56
46
|
"/subscription/billing-portal": "POST";
|
|
47
|
+
"/subscription/restore": "POST";
|
|
57
48
|
};
|
|
58
49
|
$ERROR_CODES: {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
code: "EMAIL_VERIFICATION_REQUIRED";
|
|
81
|
-
message: "Email verification is required before you can subscribe to a plan";
|
|
82
|
-
};
|
|
83
|
-
readonly SUBSCRIPTION_NOT_ACTIVE: {
|
|
84
|
-
code: "SUBSCRIPTION_NOT_ACTIVE";
|
|
85
|
-
message: "Subscription is not active";
|
|
86
|
-
};
|
|
87
|
-
readonly SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION: {
|
|
88
|
-
code: "SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION";
|
|
89
|
-
message: "Subscription is not scheduled for cancellation";
|
|
90
|
-
};
|
|
50
|
+
UNAUTHORIZED: better_auth49.RawError<"UNAUTHORIZED">;
|
|
51
|
+
INVALID_REQUEST_BODY: better_auth49.RawError<"INVALID_REQUEST_BODY">;
|
|
52
|
+
SUBSCRIPTION_NOT_FOUND: better_auth49.RawError<"SUBSCRIPTION_NOT_FOUND">;
|
|
53
|
+
SUBSCRIPTION_PLAN_NOT_FOUND: better_auth49.RawError<"SUBSCRIPTION_PLAN_NOT_FOUND">;
|
|
54
|
+
ALREADY_SUBSCRIBED_PLAN: better_auth49.RawError<"ALREADY_SUBSCRIBED_PLAN">;
|
|
55
|
+
REFERENCE_ID_NOT_ALLOWED: better_auth49.RawError<"REFERENCE_ID_NOT_ALLOWED">;
|
|
56
|
+
CUSTOMER_NOT_FOUND: better_auth49.RawError<"CUSTOMER_NOT_FOUND">;
|
|
57
|
+
UNABLE_TO_CREATE_CUSTOMER: better_auth49.RawError<"UNABLE_TO_CREATE_CUSTOMER">;
|
|
58
|
+
UNABLE_TO_CREATE_BILLING_PORTAL: better_auth49.RawError<"UNABLE_TO_CREATE_BILLING_PORTAL">;
|
|
59
|
+
STRIPE_SIGNATURE_NOT_FOUND: better_auth49.RawError<"STRIPE_SIGNATURE_NOT_FOUND">;
|
|
60
|
+
STRIPE_WEBHOOK_SECRET_NOT_FOUND: better_auth49.RawError<"STRIPE_WEBHOOK_SECRET_NOT_FOUND">;
|
|
61
|
+
STRIPE_WEBHOOK_ERROR: better_auth49.RawError<"STRIPE_WEBHOOK_ERROR">;
|
|
62
|
+
FAILED_TO_CONSTRUCT_STRIPE_EVENT: better_auth49.RawError<"FAILED_TO_CONSTRUCT_STRIPE_EVENT">;
|
|
63
|
+
FAILED_TO_FETCH_PLANS: better_auth49.RawError<"FAILED_TO_FETCH_PLANS">;
|
|
64
|
+
EMAIL_VERIFICATION_REQUIRED: better_auth49.RawError<"EMAIL_VERIFICATION_REQUIRED">;
|
|
65
|
+
SUBSCRIPTION_NOT_ACTIVE: better_auth49.RawError<"SUBSCRIPTION_NOT_ACTIVE">;
|
|
66
|
+
SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION: better_auth49.RawError<"SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION">;
|
|
67
|
+
ORGANIZATION_NOT_FOUND: better_auth49.RawError<"ORGANIZATION_NOT_FOUND">;
|
|
68
|
+
ORGANIZATION_SUBSCRIPTION_NOT_ENABLED: better_auth49.RawError<"ORGANIZATION_SUBSCRIPTION_NOT_ENABLED">;
|
|
69
|
+
ORGANIZATION_HAS_ACTIVE_SUBSCRIPTION: better_auth49.RawError<"ORGANIZATION_HAS_ACTIVE_SUBSCRIPTION">;
|
|
70
|
+
ORGANIZATION_REFERENCE_ID_REQUIRED: better_auth49.RawError<"ORGANIZATION_REFERENCE_ID_REQUIRED">;
|
|
91
71
|
};
|
|
92
72
|
};
|
|
93
73
|
//#endregion
|
|
94
|
-
export { STRIPE_ERROR_CODES, stripeClient };
|
|
74
|
+
export { STRIPE_ERROR_CODES, stripeClient };
|
|
75
|
+
//# sourceMappingURL=client.d.mts.map
|
package/dist/client.mjs
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { t as STRIPE_ERROR_CODES } from "./error-codes-
|
|
1
|
+
import { t as STRIPE_ERROR_CODES } from "./error-codes-CMowBCzF.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/client.ts
|
|
4
4
|
const stripeClient = (options) => {
|
|
5
5
|
return {
|
|
6
6
|
id: "stripe-client",
|
|
7
7
|
$InferServerPlugin: {},
|
|
8
|
-
pathMethods: {
|
|
8
|
+
pathMethods: {
|
|
9
|
+
"/subscription/billing-portal": "POST",
|
|
10
|
+
"/subscription/restore": "POST"
|
|
11
|
+
},
|
|
9
12
|
$ERROR_CODES: STRIPE_ERROR_CODES
|
|
10
13
|
};
|
|
11
14
|
};
|
|
12
15
|
|
|
13
16
|
//#endregion
|
|
14
|
-
export { STRIPE_ERROR_CODES, stripeClient };
|
|
17
|
+
export { STRIPE_ERROR_CODES, stripeClient };
|
|
18
|
+
//# sourceMappingURL=client.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.mjs","names":[],"sources":["../src/client.ts"],"sourcesContent":["import type { BetterAuthClientPlugin } from \"better-auth/client\";\nimport { STRIPE_ERROR_CODES } from \"./error-codes\";\nimport type { stripe } from \"./index\";\n\nexport const stripeClient = <\n\tO extends {\n\t\tsubscription: boolean;\n\t},\n>(\n\toptions?: O | undefined,\n) => {\n\treturn {\n\t\tid: \"stripe-client\",\n\t\t$InferServerPlugin: {} as ReturnType<\n\t\t\ttypeof stripe<\n\t\t\t\tO[\"subscription\"] extends true\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tstripeClient: any;\n\t\t\t\t\t\t\tstripeWebhookSecret: string;\n\t\t\t\t\t\t\tsubscription: {\n\t\t\t\t\t\t\t\tenabled: true;\n\t\t\t\t\t\t\t\tplans: [];\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tstripeClient: any;\n\t\t\t\t\t\t\tstripeWebhookSecret: string;\n\t\t\t\t\t\t}\n\t\t\t>\n\t\t>,\n\t\tpathMethods: {\n\t\t\t\"/subscription/billing-portal\": \"POST\",\n\t\t\t\"/subscription/restore\": \"POST\",\n\t\t},\n\t\t$ERROR_CODES: STRIPE_ERROR_CODES,\n\t} satisfies BetterAuthClientPlugin;\n};\nexport * from \"./error-codes\";\n"],"mappings":";;;AAIA,MAAa,gBAKZ,YACI;AACJ,QAAO;EACN,IAAI;EACJ,oBAAoB,EAAE;EAiBtB,aAAa;GACZ,gCAAgC;GAChC,yBAAyB;GACzB;EACD,cAAc;EACd"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineErrorCodes } from "@better-auth/core/utils/error-codes";
|
|
2
|
+
|
|
3
|
+
//#region src/error-codes.ts
|
|
4
|
+
const STRIPE_ERROR_CODES = defineErrorCodes({
|
|
5
|
+
UNAUTHORIZED: "Unauthorized access",
|
|
6
|
+
INVALID_REQUEST_BODY: "Invalid request body",
|
|
7
|
+
SUBSCRIPTION_NOT_FOUND: "Subscription not found",
|
|
8
|
+
SUBSCRIPTION_PLAN_NOT_FOUND: "Subscription plan not found",
|
|
9
|
+
ALREADY_SUBSCRIBED_PLAN: "You're already subscribed to this plan",
|
|
10
|
+
REFERENCE_ID_NOT_ALLOWED: "Reference id is not allowed",
|
|
11
|
+
CUSTOMER_NOT_FOUND: "Stripe customer not found for this user",
|
|
12
|
+
UNABLE_TO_CREATE_CUSTOMER: "Unable to create customer",
|
|
13
|
+
UNABLE_TO_CREATE_BILLING_PORTAL: "Unable to create billing portal session",
|
|
14
|
+
STRIPE_SIGNATURE_NOT_FOUND: "Stripe signature not found",
|
|
15
|
+
STRIPE_WEBHOOK_SECRET_NOT_FOUND: "Stripe webhook secret not found",
|
|
16
|
+
STRIPE_WEBHOOK_ERROR: "Stripe webhook error",
|
|
17
|
+
FAILED_TO_CONSTRUCT_STRIPE_EVENT: "Failed to construct Stripe event",
|
|
18
|
+
FAILED_TO_FETCH_PLANS: "Failed to fetch plans",
|
|
19
|
+
EMAIL_VERIFICATION_REQUIRED: "Email verification is required before you can subscribe to a plan",
|
|
20
|
+
SUBSCRIPTION_NOT_ACTIVE: "Subscription is not active",
|
|
21
|
+
SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION: "Subscription is not scheduled for cancellation",
|
|
22
|
+
ORGANIZATION_NOT_FOUND: "Organization not found",
|
|
23
|
+
ORGANIZATION_SUBSCRIPTION_NOT_ENABLED: "Organization subscription is not enabled",
|
|
24
|
+
ORGANIZATION_HAS_ACTIVE_SUBSCRIPTION: "Cannot delete organization with active subscription",
|
|
25
|
+
ORGANIZATION_REFERENCE_ID_REQUIRED: "Reference ID is required. Provide referenceId or set activeOrganizationId in session"
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { STRIPE_ERROR_CODES as t };
|
|
30
|
+
//# sourceMappingURL=error-codes-CMowBCzF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-codes-CMowBCzF.mjs","names":[],"sources":["../src/error-codes.ts"],"sourcesContent":["import { defineErrorCodes } from \"@better-auth/core/utils/error-codes\";\n\nexport const STRIPE_ERROR_CODES = defineErrorCodes({\n\tUNAUTHORIZED: \"Unauthorized access\",\n\tINVALID_REQUEST_BODY: \"Invalid request body\",\n\tSUBSCRIPTION_NOT_FOUND: \"Subscription not found\",\n\tSUBSCRIPTION_PLAN_NOT_FOUND: \"Subscription plan not found\",\n\tALREADY_SUBSCRIBED_PLAN: \"You're already subscribed to this plan\",\n\tREFERENCE_ID_NOT_ALLOWED: \"Reference id is not allowed\",\n\tCUSTOMER_NOT_FOUND: \"Stripe customer not found for this user\",\n\tUNABLE_TO_CREATE_CUSTOMER: \"Unable to create customer\",\n\tUNABLE_TO_CREATE_BILLING_PORTAL: \"Unable to create billing portal session\",\n\tSTRIPE_SIGNATURE_NOT_FOUND: \"Stripe signature not found\",\n\tSTRIPE_WEBHOOK_SECRET_NOT_FOUND: \"Stripe webhook secret not found\",\n\tSTRIPE_WEBHOOK_ERROR: \"Stripe webhook error\",\n\tFAILED_TO_CONSTRUCT_STRIPE_EVENT: \"Failed to construct Stripe event\",\n\tFAILED_TO_FETCH_PLANS: \"Failed to fetch plans\",\n\tEMAIL_VERIFICATION_REQUIRED:\n\t\t\"Email verification is required before you can subscribe to a plan\",\n\tSUBSCRIPTION_NOT_ACTIVE: \"Subscription is not active\",\n\tSUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION:\n\t\t\"Subscription is not scheduled for cancellation\",\n\tORGANIZATION_NOT_FOUND: \"Organization not found\",\n\tORGANIZATION_SUBSCRIPTION_NOT_ENABLED:\n\t\t\"Organization subscription is not enabled\",\n\tORGANIZATION_HAS_ACTIVE_SUBSCRIPTION:\n\t\t\"Cannot delete organization with active subscription\",\n\tORGANIZATION_REFERENCE_ID_REQUIRED:\n\t\t\"Reference ID is required. Provide referenceId or set activeOrganizationId in session\",\n});\n"],"mappings":";;;AAEA,MAAa,qBAAqB,iBAAiB;CAClD,cAAc;CACd,sBAAsB;CACtB,wBAAwB;CACxB,6BAA6B;CAC7B,yBAAyB;CACzB,0BAA0B;CAC1B,oBAAoB;CACpB,2BAA2B;CAC3B,iCAAiC;CACjC,4BAA4B;CAC5B,iCAAiC;CACjC,sBAAsB;CACtB,kCAAkC;CAClC,uBAAuB;CACvB,6BACC;CACD,yBAAyB;CACzB,6CACC;CACD,wBAAwB;CACxB,uCACC;CACD,sCACC;CACD,oCACC;CACD,CAAC"}
|