@better-auth/stripe 1.3.17 → 1.3.22

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,17 +1,17 @@
1
1
 
2
- > @better-auth/stripe@1.3.17 build /home/runner/work/better-auth/better-auth/packages/stripe
2
+ > @better-auth/stripe@1.3.22 build /home/runner/work/better-auth/better-auth/packages/stripe
3
3
  > unbuild
4
4
 
5
5
  [info] Automatically detected entries: src/index, src/client [esm] [cjs] [dts]
6
6
  [info] Building stripe
7
7
  [success] Build succeeded for stripe
8
- [log] dist/index.cjs (total size: 44.6 kB, chunk size: 44.6 kB, exports: stripe)
8
+ [log] dist/index.cjs (total size: 45.3 kB, chunk size: 45.3 kB, exports: stripe)
9
9
 
10
10
  [log] dist/client.cjs (total size: 270 B, chunk size: 270 B, exports: stripeClient)
11
11
 
12
- [log] dist/index.mjs (total size: 43.8 kB, chunk size: 43.8 kB, exports: stripe)
12
+ [log] dist/index.mjs (total size: 44.5 kB, chunk size: 44.5 kB, exports: stripe)
13
13
 
14
14
  [log] dist/client.mjs (total size: 243 B, chunk size: 243 B, exports: stripeClient)
15
15
 
16
- Σ Total dist size (byte size): 226 kB
16
+ Σ Total dist size (byte size): 227 kB
17
17
  [log]
package/dist/index.cjs CHANGED
@@ -406,23 +406,31 @@ const stripe = (options) => {
406
406
  /**
407
407
  * The name of the plan to subscribe
408
408
  */
409
- plan: z__namespace.string().describe("The name of the plan to upgrade to"),
409
+ plan: z__namespace.string().meta({
410
+ description: 'The name of the plan to upgrade to. Eg: "pro"'
411
+ }),
410
412
  /**
411
413
  * If annual plan should be applied.
412
414
  */
413
- annual: z__namespace.boolean().describe("Whether to upgrade to an annual plan").optional(),
415
+ annual: z__namespace.boolean().meta({
416
+ description: "Whether to upgrade to an annual plan. Eg: true"
417
+ }).optional(),
414
418
  /**
415
419
  * Reference id of the subscription to upgrade
416
420
  * This is used to identify the subscription to upgrade
417
421
  * If not provided, the user's id will be used
418
422
  */
419
- referenceId: z__namespace.string().describe("Reference id of the subscription to upgrade").optional(),
423
+ referenceId: z__namespace.string().meta({
424
+ description: 'Reference id of the subscription to upgrade. Eg: "123"'
425
+ }).optional(),
420
426
  /**
421
427
  * This is to allow a specific subscription to be upgrade.
422
428
  * If subscription id is provided, and subscription isn't found,
423
429
  * it'll throw an error.
424
430
  */
425
- subscriptionId: z__namespace.string().describe("The id of the subscription to upgrade").optional(),
431
+ subscriptionId: z__namespace.string().meta({
432
+ description: 'The id of the subscription to upgrade. Eg: "sub_123"'
433
+ }).optional(),
426
434
  /**
427
435
  * Any additional data you want to store in your database
428
436
  * subscriptions
@@ -431,29 +439,33 @@ const stripe = (options) => {
431
439
  /**
432
440
  * If a subscription
433
441
  */
434
- seats: z__namespace.number().describe("Number of seats to upgrade to (if applicable)").optional(),
442
+ seats: z__namespace.number().meta({
443
+ description: "Number of seats to upgrade to (if applicable). Eg: 1"
444
+ }).optional(),
435
445
  /**
436
446
  * Success URL to redirect back after successful subscription
437
447
  */
438
- successUrl: z__namespace.string().describe(
439
- "Callback URL to redirect back after successful subscription"
440
- ).default("/"),
448
+ successUrl: z__namespace.string().meta({
449
+ description: 'Callback URL to redirect back after successful subscription. Eg: "https://example.com/success"'
450
+ }).default("/"),
441
451
  /**
442
452
  * Cancel URL
443
453
  */
444
- cancelUrl: z__namespace.string().describe(
445
- "If set, checkout shows a back button and customers will be directed here if they cancel payment"
446
- ).default("/"),
454
+ cancelUrl: z__namespace.string().meta({
455
+ description: 'If set, checkout shows a back button and customers will be directed here if they cancel payment. Eg: "https://example.com/pricing"'
456
+ }).default("/"),
447
457
  /**
448
458
  * Return URL
449
459
  */
450
- returnUrl: z__namespace.string().describe(
451
- "URL to take customers to when they click on the billing portal\u2019s link to return to your website"
452
- ).optional(),
460
+ returnUrl: z__namespace.string().meta({
461
+ description: 'URL to take customers to when they click on the billing portal\u2019s link to return to your website. Eg: "https://example.com/dashboard"'
462
+ }).optional(),
453
463
  /**
454
464
  * Disable Redirect
455
465
  */
456
- disableRedirect: z__namespace.boolean().describe("Disable redirect after successful subscription").default(false)
466
+ disableRedirect: z__namespace.boolean().meta({
467
+ description: "Disable redirect after successful subscription. Eg: true"
468
+ }).default(false)
457
469
  }),
458
470
  use: [
459
471
  api.sessionMiddleware,
@@ -811,11 +823,15 @@ const stripe = (options) => {
811
823
  {
812
824
  method: "POST",
813
825
  body: z__namespace.object({
814
- referenceId: z__namespace.string().describe("Reference id of the subscription to cancel").optional(),
815
- subscriptionId: z__namespace.string().describe("The id of the subscription to cancel").optional(),
816
- returnUrl: z__namespace.string().describe(
817
- "URL to take customers to when they click on the billing portal\u2019s link to return to your website"
818
- )
826
+ referenceId: z__namespace.string().meta({
827
+ description: "Reference id of the subscription to cancel. Eg: '123'"
828
+ }).optional(),
829
+ subscriptionId: z__namespace.string().meta({
830
+ description: "The id of the subscription to cancel. Eg: 'sub_123'"
831
+ }).optional(),
832
+ returnUrl: z__namespace.string().meta({
833
+ description: 'URL to take customers to when they click on the billing portal\u2019s link to return to your website. Eg: "https://example.com/dashboard"'
834
+ })
819
835
  }),
820
836
  use: [
821
837
  api.sessionMiddleware,
@@ -922,8 +938,12 @@ const stripe = (options) => {
922
938
  {
923
939
  method: "POST",
924
940
  body: z__namespace.object({
925
- referenceId: z__namespace.string().describe("Reference id of the subscription to restore").optional(),
926
- subscriptionId: z__namespace.string().describe("The id of the subscription to restore").optional()
941
+ referenceId: z__namespace.string().meta({
942
+ description: "Reference id of the subscription to restore. Eg: '123'"
943
+ }).optional(),
944
+ subscriptionId: z__namespace.string().meta({
945
+ description: "The id of the subscription to restore. Eg: 'sub_123'"
946
+ }).optional()
927
947
  }),
928
948
  use: [api.sessionMiddleware, referenceMiddleware("restore-subscription")]
929
949
  },
@@ -1027,7 +1047,9 @@ const stripe = (options) => {
1027
1047
  method: "GET",
1028
1048
  query: z__namespace.optional(
1029
1049
  z__namespace.object({
1030
- referenceId: z__namespace.string().describe("Reference id of the subscription to list").optional()
1050
+ referenceId: z__namespace.string().meta({
1051
+ description: "Reference id of the subscription to list. Eg: '123'"
1052
+ }).optional()
1031
1053
  })
1032
1054
  ),
1033
1055
  use: [api.sessionMiddleware, referenceMiddleware("list-subscription")]
package/dist/index.mjs CHANGED
@@ -390,23 +390,31 @@ const stripe = (options) => {
390
390
  /**
391
391
  * The name of the plan to subscribe
392
392
  */
393
- plan: z.string().describe("The name of the plan to upgrade to"),
393
+ plan: z.string().meta({
394
+ description: 'The name of the plan to upgrade to. Eg: "pro"'
395
+ }),
394
396
  /**
395
397
  * If annual plan should be applied.
396
398
  */
397
- annual: z.boolean().describe("Whether to upgrade to an annual plan").optional(),
399
+ annual: z.boolean().meta({
400
+ description: "Whether to upgrade to an annual plan. Eg: true"
401
+ }).optional(),
398
402
  /**
399
403
  * Reference id of the subscription to upgrade
400
404
  * This is used to identify the subscription to upgrade
401
405
  * If not provided, the user's id will be used
402
406
  */
403
- referenceId: z.string().describe("Reference id of the subscription to upgrade").optional(),
407
+ referenceId: z.string().meta({
408
+ description: 'Reference id of the subscription to upgrade. Eg: "123"'
409
+ }).optional(),
404
410
  /**
405
411
  * This is to allow a specific subscription to be upgrade.
406
412
  * If subscription id is provided, and subscription isn't found,
407
413
  * it'll throw an error.
408
414
  */
409
- subscriptionId: z.string().describe("The id of the subscription to upgrade").optional(),
415
+ subscriptionId: z.string().meta({
416
+ description: 'The id of the subscription to upgrade. Eg: "sub_123"'
417
+ }).optional(),
410
418
  /**
411
419
  * Any additional data you want to store in your database
412
420
  * subscriptions
@@ -415,29 +423,33 @@ const stripe = (options) => {
415
423
  /**
416
424
  * If a subscription
417
425
  */
418
- seats: z.number().describe("Number of seats to upgrade to (if applicable)").optional(),
426
+ seats: z.number().meta({
427
+ description: "Number of seats to upgrade to (if applicable). Eg: 1"
428
+ }).optional(),
419
429
  /**
420
430
  * Success URL to redirect back after successful subscription
421
431
  */
422
- successUrl: z.string().describe(
423
- "Callback URL to redirect back after successful subscription"
424
- ).default("/"),
432
+ successUrl: z.string().meta({
433
+ description: 'Callback URL to redirect back after successful subscription. Eg: "https://example.com/success"'
434
+ }).default("/"),
425
435
  /**
426
436
  * Cancel URL
427
437
  */
428
- cancelUrl: z.string().describe(
429
- "If set, checkout shows a back button and customers will be directed here if they cancel payment"
430
- ).default("/"),
438
+ cancelUrl: z.string().meta({
439
+ description: 'If set, checkout shows a back button and customers will be directed here if they cancel payment. Eg: "https://example.com/pricing"'
440
+ }).default("/"),
431
441
  /**
432
442
  * Return URL
433
443
  */
434
- returnUrl: z.string().describe(
435
- "URL to take customers to when they click on the billing portal\u2019s link to return to your website"
436
- ).optional(),
444
+ returnUrl: z.string().meta({
445
+ description: 'URL to take customers to when they click on the billing portal\u2019s link to return to your website. Eg: "https://example.com/dashboard"'
446
+ }).optional(),
437
447
  /**
438
448
  * Disable Redirect
439
449
  */
440
- disableRedirect: z.boolean().describe("Disable redirect after successful subscription").default(false)
450
+ disableRedirect: z.boolean().meta({
451
+ description: "Disable redirect after successful subscription. Eg: true"
452
+ }).default(false)
441
453
  }),
442
454
  use: [
443
455
  sessionMiddleware,
@@ -795,11 +807,15 @@ const stripe = (options) => {
795
807
  {
796
808
  method: "POST",
797
809
  body: z.object({
798
- referenceId: z.string().describe("Reference id of the subscription to cancel").optional(),
799
- subscriptionId: z.string().describe("The id of the subscription to cancel").optional(),
800
- returnUrl: z.string().describe(
801
- "URL to take customers to when they click on the billing portal\u2019s link to return to your website"
802
- )
810
+ referenceId: z.string().meta({
811
+ description: "Reference id of the subscription to cancel. Eg: '123'"
812
+ }).optional(),
813
+ subscriptionId: z.string().meta({
814
+ description: "The id of the subscription to cancel. Eg: 'sub_123'"
815
+ }).optional(),
816
+ returnUrl: z.string().meta({
817
+ description: 'URL to take customers to when they click on the billing portal\u2019s link to return to your website. Eg: "https://example.com/dashboard"'
818
+ })
803
819
  }),
804
820
  use: [
805
821
  sessionMiddleware,
@@ -906,8 +922,12 @@ const stripe = (options) => {
906
922
  {
907
923
  method: "POST",
908
924
  body: z.object({
909
- referenceId: z.string().describe("Reference id of the subscription to restore").optional(),
910
- subscriptionId: z.string().describe("The id of the subscription to restore").optional()
925
+ referenceId: z.string().meta({
926
+ description: "Reference id of the subscription to restore. Eg: '123'"
927
+ }).optional(),
928
+ subscriptionId: z.string().meta({
929
+ description: "The id of the subscription to restore. Eg: 'sub_123'"
930
+ }).optional()
911
931
  }),
912
932
  use: [sessionMiddleware, referenceMiddleware("restore-subscription")]
913
933
  },
@@ -1011,7 +1031,9 @@ const stripe = (options) => {
1011
1031
  method: "GET",
1012
1032
  query: z.optional(
1013
1033
  z.object({
1014
- referenceId: z.string().describe("Reference id of the subscription to list").optional()
1034
+ referenceId: z.string().meta({
1035
+ description: "Reference id of the subscription to list. Eg: '123'"
1036
+ }).optional()
1015
1037
  })
1016
1038
  ),
1017
1039
  use: [sessionMiddleware, referenceMiddleware("list-subscription")]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@better-auth/stripe",
3
3
  "author": "Bereket Engida",
4
- "version": "1.3.17",
4
+ "version": "1.3.22",
5
5
  "main": "dist/index.cjs",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -41,13 +41,13 @@
41
41
  },
42
42
  "peerDependencies": {
43
43
  "stripe": "^18",
44
- "better-auth": "1.3.17"
44
+ "better-auth": "1.3.22"
45
45
  },
46
46
  "devDependencies": {
47
47
  "better-call": "1.0.19",
48
48
  "stripe": "^18.5.0",
49
49
  "unbuild": "3.6.1",
50
- "better-auth": "1.3.17"
50
+ "better-auth": "1.3.22"
51
51
  },
52
52
  "scripts": {
53
53
  "test": "vitest",
package/src/index.ts CHANGED
@@ -132,13 +132,17 @@ export const stripe = <O extends StripeOptions>(options: O) => {
132
132
  /**
133
133
  * The name of the plan to subscribe
134
134
  */
135
- plan: z.string().describe("The name of the plan to upgrade to"),
135
+ plan: z.string().meta({
136
+ description: 'The name of the plan to upgrade to. Eg: "pro"',
137
+ }),
136
138
  /**
137
139
  * If annual plan should be applied.
138
140
  */
139
141
  annual: z
140
142
  .boolean()
141
- .describe("Whether to upgrade to an annual plan")
143
+ .meta({
144
+ description: "Whether to upgrade to an annual plan. Eg: true",
145
+ })
142
146
  .optional(),
143
147
  /**
144
148
  * Reference id of the subscription to upgrade
@@ -147,7 +151,10 @@ export const stripe = <O extends StripeOptions>(options: O) => {
147
151
  */
148
152
  referenceId: z
149
153
  .string()
150
- .describe("Reference id of the subscription to upgrade")
154
+ .meta({
155
+ description:
156
+ 'Reference id of the subscription to upgrade. Eg: "123"',
157
+ })
151
158
  .optional(),
152
159
  /**
153
160
  * This is to allow a specific subscription to be upgrade.
@@ -156,7 +163,10 @@ export const stripe = <O extends StripeOptions>(options: O) => {
156
163
  */
157
164
  subscriptionId: z
158
165
  .string()
159
- .describe("The id of the subscription to upgrade")
166
+ .meta({
167
+ description:
168
+ 'The id of the subscription to upgrade. Eg: "sub_123"',
169
+ })
160
170
  .optional(),
161
171
  /**
162
172
  * Any additional data you want to store in your database
@@ -168,41 +178,50 @@ export const stripe = <O extends StripeOptions>(options: O) => {
168
178
  */
169
179
  seats: z
170
180
  .number()
171
- .describe("Number of seats to upgrade to (if applicable)")
181
+ .meta({
182
+ description:
183
+ "Number of seats to upgrade to (if applicable). Eg: 1",
184
+ })
172
185
  .optional(),
173
186
  /**
174
187
  * Success URL to redirect back after successful subscription
175
188
  */
176
189
  successUrl: z
177
190
  .string()
178
- .describe(
179
- "Callback URL to redirect back after successful subscription",
180
- )
191
+ .meta({
192
+ description:
193
+ 'Callback URL to redirect back after successful subscription. Eg: "https://example.com/success"',
194
+ })
181
195
  .default("/"),
182
196
  /**
183
197
  * Cancel URL
184
198
  */
185
199
  cancelUrl: z
186
200
  .string()
187
- .describe(
188
- "If set, checkout shows a back button and customers will be directed here if they cancel payment",
189
- )
201
+ .meta({
202
+ description:
203
+ 'If set, checkout shows a back button and customers will be directed here if they cancel payment. Eg: "https://example.com/pricing"',
204
+ })
190
205
  .default("/"),
191
206
  /**
192
207
  * Return URL
193
208
  */
194
209
  returnUrl: z
195
210
  .string()
196
- .describe(
197
- "URL to take customers to when they click on the billing portal’s link to return to your website",
198
- )
211
+ .meta({
212
+ description:
213
+ 'URL to take customers to when they click on the billing portal’s link to return to your website. Eg: "https://example.com/dashboard"',
214
+ })
199
215
  .optional(),
200
216
  /**
201
217
  * Disable Redirect
202
218
  */
203
219
  disableRedirect: z
204
220
  .boolean()
205
- .describe("Disable redirect after successful subscription")
221
+ .meta({
222
+ description:
223
+ "Disable redirect after successful subscription. Eg: true",
224
+ })
206
225
  .default(false),
207
226
  }),
208
227
  use: [
@@ -635,17 +654,22 @@ export const stripe = <O extends StripeOptions>(options: O) => {
635
654
  body: z.object({
636
655
  referenceId: z
637
656
  .string()
638
- .describe("Reference id of the subscription to cancel")
657
+ .meta({
658
+ description:
659
+ "Reference id of the subscription to cancel. Eg: '123'",
660
+ })
639
661
  .optional(),
640
662
  subscriptionId: z
641
663
  .string()
642
- .describe("The id of the subscription to cancel")
664
+ .meta({
665
+ description:
666
+ "The id of the subscription to cancel. Eg: 'sub_123'",
667
+ })
643
668
  .optional(),
644
- returnUrl: z
645
- .string()
646
- .describe(
647
- "URL to take customers to when they click on the billing portal’s link to return to your website",
648
- ),
669
+ returnUrl: z.string().meta({
670
+ description:
671
+ 'URL to take customers to when they click on the billing portal’s link to return to your website. Eg: "https://example.com/dashboard"',
672
+ }),
649
673
  }),
650
674
  use: [
651
675
  sessionMiddleware,
@@ -774,11 +798,17 @@ export const stripe = <O extends StripeOptions>(options: O) => {
774
798
  body: z.object({
775
799
  referenceId: z
776
800
  .string()
777
- .describe("Reference id of the subscription to restore")
801
+ .meta({
802
+ description:
803
+ "Reference id of the subscription to restore. Eg: '123'",
804
+ })
778
805
  .optional(),
779
806
  subscriptionId: z
780
807
  .string()
781
- .describe("The id of the subscription to restore")
808
+ .meta({
809
+ description:
810
+ "The id of the subscription to restore. Eg: 'sub_123'",
811
+ })
782
812
  .optional(),
783
813
  }),
784
814
  use: [sessionMiddleware, referenceMiddleware("restore-subscription")],
@@ -902,7 +932,10 @@ export const stripe = <O extends StripeOptions>(options: O) => {
902
932
  z.object({
903
933
  referenceId: z
904
934
  .string()
905
- .describe("Reference id of the subscription to list")
935
+ .meta({
936
+ description:
937
+ "Reference id of the subscription to list. Eg: '123'",
938
+ })
906
939
  .optional(),
907
940
  }),
908
941
  ),