@better-auth/stripe 1.4.13 → 1.4.14

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.13 build /home/runner/work/better-auth/better-auth/packages/stripe
2
+ > @better-auth/stripe@1.4.14 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 57.71 kB │ gzip: 10.47 kB
10
+ ℹ dist/index.mjs 58.15 kB │ gzip: 10.60 kB
11
11
  ℹ dist/client.mjs  0.26 kB │ gzip: 0.20 kB
12
- ℹ dist/client.d.mts  0.62 kB │ gzip: 0.35 kB
12
+ ℹ dist/client.d.mts  0.62 kB │ gzip: 0.34 kB
13
13
  ℹ dist/index.d.mts  0.21 kB │ gzip: 0.14 kB
14
- ℹ dist/index-CLon-5Wv.d.mts 30.22 kB │ gzip: 5.17 kB
15
- ℹ 5 files, total: 89.02 kB
16
- ✔ Build complete in 20381ms
14
+ ℹ dist/index-BTvn0abC.d.mts 30.34 kB │ gzip: 5.18 kB
15
+ ℹ 5 files, total: 89.58 kB
16
+ ✔ Build complete in 23099ms
package/dist/client.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as stripe } from "./index-CLon-5Wv.mjs";
1
+ import { n as stripe } from "./index-BTvn0abC.mjs";
2
2
 
3
3
  //#region src/client.d.ts
4
4
  declare const stripeClient: <O extends {
@@ -476,6 +476,7 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
476
476
  }>>;
477
477
  metadata: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodAny>>;
478
478
  seats: zod0.ZodOptional<zod0.ZodNumber>;
479
+ locale: zod0.ZodOptional<zod0.ZodCustom<Stripe.Checkout.Session.Locale, Stripe.Checkout.Session.Locale>>;
479
480
  successUrl: zod0.ZodDefault<zod0.ZodString>;
480
481
  cancelUrl: zod0.ZodDefault<zod0.ZodString>;
481
482
  returnUrl: zod0.ZodOptional<zod0.ZodString>;
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-CLon-5Wv.mjs";
1
+ import { a as SubscriptionOptions, i as Subscription, n as stripe, r as StripePlan, t as StripePlugin } from "./index-BTvn0abC.mjs";
2
2
  export { StripePlan, StripePlugin, Subscription, SubscriptionOptions, stripe };
package/dist/index.mjs CHANGED
@@ -449,6 +449,9 @@ const upgradeSubscriptionBodySchema = z.object({
449
449
  customerType: z.enum(["user", "organization"]).meta({ description: "Customer type for the subscription. Eg: \"user\" or \"organization\"" }).optional(),
450
450
  metadata: z.record(z.string(), z.any()).optional(),
451
451
  seats: z.number().meta({ description: "Number of seats to upgrade to (if applicable). Eg: 1" }).optional(),
452
+ locale: z.custom((localization) => {
453
+ return typeof localization === "string";
454
+ }).meta({ description: "The locale to display Checkout in. Eg: 'en', 'ko'. If not provided or set to `auto`, the browser's locale is used." }).optional(),
452
455
  successUrl: z.string().meta({ description: "Callback URL to redirect back after successful subscription. Eg: \"https://example.com/success\"" }).default("/"),
453
456
  cancelUrl: z.string().meta({ description: "If set, checkout shows a back button and customers will be directed here if they cancel payment. Eg: \"https://example.com/pricing\"" }).default("/"),
454
457
  returnUrl: z.string().meta({ description: "URL to take customers to when they click on the billing portal’s link to return to your website. Eg: \"https://example.com/dashboard\"" }).optional(),
@@ -720,6 +723,7 @@ const upgradeSubscription = (options) => {
720
723
  address: "auto"
721
724
  }
722
725
  } : { customer_email: user$1.email },
726
+ locale: ctx.body.locale,
723
727
  success_url: getUrl(ctx, `${ctx.context.baseURL}/subscription/success?callbackURL=${encodeURIComponent(ctx.body.successUrl)}&subscriptionId=${encodeURIComponent(subscription.id)}`),
724
728
  cancel_url: getUrl(ctx, ctx.body.cancelUrl),
725
729
  line_items: [{
@@ -1105,7 +1109,7 @@ const subscriptionSuccess = (options) => {
1105
1109
  const createBillingPortalBodySchema = z.object({
1106
1110
  locale: z.custom((localization) => {
1107
1111
  return typeof localization === "string";
1108
- }).optional(),
1112
+ }).meta({ description: "The IETF language tag of the locale Customer Portal is displayed in. Eg: 'en', 'ko'. If not provided or set to `auto`, the browser's locale is used." }).optional(),
1109
1113
  referenceId: z.string().optional(),
1110
1114
  customerType: z.enum(["user", "organization"]).meta({ description: "Customer type for the subscription. Eg: \"user\" or \"organization\"" }).optional(),
1111
1115
  returnUrl: z.string().default("/"),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@better-auth/stripe",
3
3
  "author": "Bereket Engida",
4
- "version": "1.4.13",
4
+ "version": "1.4.14",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
7
7
  "types": "dist/index.d.mts",
@@ -50,15 +50,15 @@
50
50
  },
51
51
  "peerDependencies": {
52
52
  "stripe": "^18 || ^19 || ^20",
53
- "@better-auth/core": "1.4.13",
54
- "better-auth": "1.4.13"
53
+ "@better-auth/core": "1.4.14",
54
+ "better-auth": "1.4.14"
55
55
  },
56
56
  "devDependencies": {
57
- "better-call": "1.1.7",
57
+ "better-call": "1.1.8",
58
58
  "stripe": "^20.0.0",
59
59
  "tsdown": "^0.17.2",
60
- "@better-auth/core": "1.4.13",
61
- "better-auth": "1.4.13"
60
+ "@better-auth/core": "1.4.14",
61
+ "better-auth": "1.4.14"
62
62
  },
63
63
  "scripts": {
64
64
  "test": "vitest",
package/src/routes.ts CHANGED
@@ -158,6 +158,19 @@ const upgradeSubscriptionBodySchema = z.object({
158
158
  description: "Number of seats to upgrade to (if applicable). Eg: 1",
159
159
  })
160
160
  .optional(),
161
+ /**
162
+ * The IETF language tag of the locale Checkout is displayed in.
163
+ * If not provided or set to `auto`, the browser's locale is used.
164
+ */
165
+ locale: z
166
+ .custom<StripeType.Checkout.Session.Locale>((localization) => {
167
+ return typeof localization === "string";
168
+ })
169
+ .meta({
170
+ description:
171
+ "The locale to display Checkout in. Eg: 'en', 'ko'. If not provided or set to `auto`, the browser's locale is used.",
172
+ })
173
+ .optional(),
161
174
  /**
162
175
  * The URL to which Stripe should send customers when payment or setup is complete.
163
176
  */
@@ -691,6 +704,7 @@ export const upgradeSubscription = (options: StripeOptions) => {
691
704
  : {
692
705
  customer_email: user.email,
693
706
  }),
707
+ locale: ctx.body.locale,
694
708
  success_url: getUrl(
695
709
  ctx,
696
710
  `${
@@ -1412,10 +1426,18 @@ export const subscriptionSuccess = (options: StripeOptions) => {
1412
1426
  };
1413
1427
 
1414
1428
  const createBillingPortalBodySchema = z.object({
1429
+ /**
1430
+ * The IETF language tag of the locale Customer Portal is displayed in.
1431
+ * If not provided or set to `auto`, the browser's locale is used.
1432
+ */
1415
1433
  locale: z
1416
1434
  .custom<StripeType.Checkout.Session.Locale>((localization) => {
1417
1435
  return typeof localization === "string";
1418
1436
  })
1437
+ .meta({
1438
+ description:
1439
+ "The IETF language tag of the locale Customer Portal is displayed in. Eg: 'en', 'ko'. If not provided or set to `auto`, the browser's locale is used.",
1440
+ })
1419
1441
  .optional(),
1420
1442
  referenceId: z.string().optional(),
1421
1443
  /**