@dodopayments/better-auth 0.1.1

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.
@@ -0,0 +1,1162 @@
1
+ import * as better_auth from 'better-auth';
2
+ import * as dodopayments_resources_payments_mjs from 'dodopayments/resources/payments.mjs';
3
+ import * as dodopayments_resources_subscriptions_mjs from 'dodopayments/resources/subscriptions.mjs';
4
+ import * as better_call from 'better-call';
5
+ import * as zod from 'zod';
6
+ import { z } from 'zod';
7
+ import DodoPayments, { DodoPayments as DodoPayments$1 } from 'dodopayments';
8
+ import { WebhookHandlerConfig } from '@dodopayments/core/webhook';
9
+
10
+ interface CheckoutOptions {
11
+ /**
12
+ * Optional list of slug -> productId mappings for easy slug checkouts
13
+ */
14
+ products?: Product[] | (() => Promise<Product[]>);
15
+ /**
16
+ * Checkout Success URL
17
+ */
18
+ successUrl?: string;
19
+ /**
20
+ * Only allow authenticated customers to checkout
21
+ */
22
+ authenticatedUsersOnly?: boolean;
23
+ }
24
+ declare const checkout: (checkoutOptions?: CheckoutOptions) => (dodopayments: DodoPayments) => {
25
+ checkout: {
26
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
27
+ body: z.objectInputType<{
28
+ product_id: z.ZodOptional<z.ZodString>;
29
+ quantity: z.ZodOptional<z.ZodNumber>;
30
+ product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
31
+ product_id: z.ZodString;
32
+ quantity: z.ZodNumber;
33
+ }, "strip", z.ZodTypeAny, {
34
+ quantity: number;
35
+ product_id: string;
36
+ }, {
37
+ quantity: number;
38
+ product_id: string;
39
+ }>, "many">>;
40
+ billing: z.ZodObject<{
41
+ city: z.ZodString;
42
+ country: z.ZodString;
43
+ state: z.ZodString;
44
+ street: z.ZodString;
45
+ zipcode: z.ZodString;
46
+ }, "strip", z.ZodTypeAny, {
47
+ country: string;
48
+ city: string;
49
+ state: string;
50
+ street: string;
51
+ zipcode: string;
52
+ }, {
53
+ country: string;
54
+ city: string;
55
+ state: string;
56
+ street: string;
57
+ zipcode: string;
58
+ }>;
59
+ customer: z.ZodObject<{
60
+ customer_id: z.ZodOptional<z.ZodString>;
61
+ email: z.ZodOptional<z.ZodString>;
62
+ name: z.ZodOptional<z.ZodString>;
63
+ }, "strip", z.ZodTypeAny, {
64
+ email?: string | undefined;
65
+ customer_id?: string | undefined;
66
+ name?: string | undefined;
67
+ }, {
68
+ email?: string | undefined;
69
+ customer_id?: string | undefined;
70
+ name?: string | undefined;
71
+ }>;
72
+ discount_id: z.ZodOptional<z.ZodString>;
73
+ addons: z.ZodOptional<z.ZodArray<z.ZodObject<{
74
+ addon_id: z.ZodString;
75
+ quantity: z.ZodNumber;
76
+ }, "strip", z.ZodTypeAny, {
77
+ quantity: number;
78
+ addon_id: string;
79
+ }, {
80
+ quantity: number;
81
+ addon_id: string;
82
+ }>, "many">>;
83
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
84
+ currency: z.ZodOptional<z.ZodString>;
85
+ } & {
86
+ slug: z.ZodOptional<z.ZodString>;
87
+ referenceId: z.ZodOptional<z.ZodString>;
88
+ }, z.ZodUnknown, "strip">;
89
+ } & {
90
+ method?: "POST" | undefined;
91
+ } & {
92
+ query?: Record<string, any> | undefined;
93
+ } & {
94
+ params?: Record<string, any>;
95
+ } & {
96
+ request: Request;
97
+ } & {
98
+ headers?: HeadersInit;
99
+ } & {
100
+ asResponse?: boolean;
101
+ returnHeaders?: boolean;
102
+ use?: better_call.Middleware[];
103
+ path?: string;
104
+ } & {
105
+ asResponse?: AsResponse | undefined;
106
+ returnHeaders?: ReturnHeaders | undefined;
107
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
108
+ headers: Headers;
109
+ response: {
110
+ url: string;
111
+ redirect: boolean;
112
+ };
113
+ } : {
114
+ url: string;
115
+ redirect: boolean;
116
+ }>;
117
+ options: {
118
+ method: "POST";
119
+ body: z.ZodObject<{
120
+ product_id: z.ZodOptional<z.ZodString>;
121
+ quantity: z.ZodOptional<z.ZodNumber>;
122
+ product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
123
+ product_id: z.ZodString;
124
+ quantity: z.ZodNumber;
125
+ }, "strip", z.ZodTypeAny, {
126
+ quantity: number;
127
+ product_id: string;
128
+ }, {
129
+ quantity: number;
130
+ product_id: string;
131
+ }>, "many">>;
132
+ billing: z.ZodObject<{
133
+ city: z.ZodString;
134
+ country: z.ZodString;
135
+ state: z.ZodString;
136
+ street: z.ZodString;
137
+ zipcode: z.ZodString;
138
+ }, "strip", z.ZodTypeAny, {
139
+ country: string;
140
+ city: string;
141
+ state: string;
142
+ street: string;
143
+ zipcode: string;
144
+ }, {
145
+ country: string;
146
+ city: string;
147
+ state: string;
148
+ street: string;
149
+ zipcode: string;
150
+ }>;
151
+ customer: z.ZodObject<{
152
+ customer_id: z.ZodOptional<z.ZodString>;
153
+ email: z.ZodOptional<z.ZodString>;
154
+ name: z.ZodOptional<z.ZodString>;
155
+ }, "strip", z.ZodTypeAny, {
156
+ email?: string | undefined;
157
+ customer_id?: string | undefined;
158
+ name?: string | undefined;
159
+ }, {
160
+ email?: string | undefined;
161
+ customer_id?: string | undefined;
162
+ name?: string | undefined;
163
+ }>;
164
+ discount_id: z.ZodOptional<z.ZodString>;
165
+ addons: z.ZodOptional<z.ZodArray<z.ZodObject<{
166
+ addon_id: z.ZodString;
167
+ quantity: z.ZodNumber;
168
+ }, "strip", z.ZodTypeAny, {
169
+ quantity: number;
170
+ addon_id: string;
171
+ }, {
172
+ quantity: number;
173
+ addon_id: string;
174
+ }>, "many">>;
175
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
176
+ currency: z.ZodOptional<z.ZodString>;
177
+ } & {
178
+ slug: z.ZodOptional<z.ZodString>;
179
+ referenceId: z.ZodOptional<z.ZodString>;
180
+ }, "strip", z.ZodUnknown, z.objectOutputType<{
181
+ product_id: z.ZodOptional<z.ZodString>;
182
+ quantity: z.ZodOptional<z.ZodNumber>;
183
+ product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
184
+ product_id: z.ZodString;
185
+ quantity: z.ZodNumber;
186
+ }, "strip", z.ZodTypeAny, {
187
+ quantity: number;
188
+ product_id: string;
189
+ }, {
190
+ quantity: number;
191
+ product_id: string;
192
+ }>, "many">>;
193
+ billing: z.ZodObject<{
194
+ city: z.ZodString;
195
+ country: z.ZodString;
196
+ state: z.ZodString;
197
+ street: z.ZodString;
198
+ zipcode: z.ZodString;
199
+ }, "strip", z.ZodTypeAny, {
200
+ country: string;
201
+ city: string;
202
+ state: string;
203
+ street: string;
204
+ zipcode: string;
205
+ }, {
206
+ country: string;
207
+ city: string;
208
+ state: string;
209
+ street: string;
210
+ zipcode: string;
211
+ }>;
212
+ customer: z.ZodObject<{
213
+ customer_id: z.ZodOptional<z.ZodString>;
214
+ email: z.ZodOptional<z.ZodString>;
215
+ name: z.ZodOptional<z.ZodString>;
216
+ }, "strip", z.ZodTypeAny, {
217
+ email?: string | undefined;
218
+ customer_id?: string | undefined;
219
+ name?: string | undefined;
220
+ }, {
221
+ email?: string | undefined;
222
+ customer_id?: string | undefined;
223
+ name?: string | undefined;
224
+ }>;
225
+ discount_id: z.ZodOptional<z.ZodString>;
226
+ addons: z.ZodOptional<z.ZodArray<z.ZodObject<{
227
+ addon_id: z.ZodString;
228
+ quantity: z.ZodNumber;
229
+ }, "strip", z.ZodTypeAny, {
230
+ quantity: number;
231
+ addon_id: string;
232
+ }, {
233
+ quantity: number;
234
+ addon_id: string;
235
+ }>, "many">>;
236
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
237
+ currency: z.ZodOptional<z.ZodString>;
238
+ } & {
239
+ slug: z.ZodOptional<z.ZodString>;
240
+ referenceId: z.ZodOptional<z.ZodString>;
241
+ }, z.ZodUnknown, "strip">, z.objectInputType<{
242
+ product_id: z.ZodOptional<z.ZodString>;
243
+ quantity: z.ZodOptional<z.ZodNumber>;
244
+ product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
245
+ product_id: z.ZodString;
246
+ quantity: z.ZodNumber;
247
+ }, "strip", z.ZodTypeAny, {
248
+ quantity: number;
249
+ product_id: string;
250
+ }, {
251
+ quantity: number;
252
+ product_id: string;
253
+ }>, "many">>;
254
+ billing: z.ZodObject<{
255
+ city: z.ZodString;
256
+ country: z.ZodString;
257
+ state: z.ZodString;
258
+ street: z.ZodString;
259
+ zipcode: z.ZodString;
260
+ }, "strip", z.ZodTypeAny, {
261
+ country: string;
262
+ city: string;
263
+ state: string;
264
+ street: string;
265
+ zipcode: string;
266
+ }, {
267
+ country: string;
268
+ city: string;
269
+ state: string;
270
+ street: string;
271
+ zipcode: string;
272
+ }>;
273
+ customer: z.ZodObject<{
274
+ customer_id: z.ZodOptional<z.ZodString>;
275
+ email: z.ZodOptional<z.ZodString>;
276
+ name: z.ZodOptional<z.ZodString>;
277
+ }, "strip", z.ZodTypeAny, {
278
+ email?: string | undefined;
279
+ customer_id?: string | undefined;
280
+ name?: string | undefined;
281
+ }, {
282
+ email?: string | undefined;
283
+ customer_id?: string | undefined;
284
+ name?: string | undefined;
285
+ }>;
286
+ discount_id: z.ZodOptional<z.ZodString>;
287
+ addons: z.ZodOptional<z.ZodArray<z.ZodObject<{
288
+ addon_id: z.ZodString;
289
+ quantity: z.ZodNumber;
290
+ }, "strip", z.ZodTypeAny, {
291
+ quantity: number;
292
+ addon_id: string;
293
+ }, {
294
+ quantity: number;
295
+ addon_id: string;
296
+ }>, "many">>;
297
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
298
+ currency: z.ZodOptional<z.ZodString>;
299
+ } & {
300
+ slug: z.ZodOptional<z.ZodString>;
301
+ referenceId: z.ZodOptional<z.ZodString>;
302
+ }, z.ZodUnknown, "strip">>;
303
+ requireRequest: true;
304
+ } & {
305
+ use: any[];
306
+ };
307
+ path: "/checkout";
308
+ };
309
+ };
310
+
311
+ declare const portal: () => (dodopayments: DodoPayments$1) => {
312
+ portal: {
313
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
314
+ body?: undefined;
315
+ } & {
316
+ method?: "GET" | undefined;
317
+ } & {
318
+ query?: Record<string, any> | undefined;
319
+ } & {
320
+ params?: Record<string, any>;
321
+ } & {
322
+ request?: Request;
323
+ } & {
324
+ headers?: HeadersInit;
325
+ } & {
326
+ asResponse?: boolean;
327
+ returnHeaders?: boolean;
328
+ use?: better_call.Middleware[];
329
+ path?: string;
330
+ } & {
331
+ asResponse?: AsResponse | undefined;
332
+ returnHeaders?: ReturnHeaders | undefined;
333
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
334
+ headers: Headers;
335
+ response: {
336
+ url: string;
337
+ redirect: boolean;
338
+ };
339
+ } : {
340
+ url: string;
341
+ redirect: boolean;
342
+ }>;
343
+ options: {
344
+ method: "GET";
345
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
346
+ session: {
347
+ session: Record<string, any> & {
348
+ id: string;
349
+ token: string;
350
+ userId: string;
351
+ expiresAt: Date;
352
+ createdAt: Date;
353
+ updatedAt: Date;
354
+ ipAddress?: string | null | undefined;
355
+ userAgent?: string | null | undefined;
356
+ };
357
+ user: Record<string, any> & {
358
+ id: string;
359
+ name: string;
360
+ emailVerified: boolean;
361
+ email: string;
362
+ createdAt: Date;
363
+ updatedAt: Date;
364
+ image?: string | null | undefined;
365
+ };
366
+ };
367
+ }>)[];
368
+ } & {
369
+ use: any[];
370
+ };
371
+ path: "/customer/portal";
372
+ };
373
+ subscriptions: {
374
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
375
+ body?: undefined;
376
+ } & {
377
+ method?: "GET" | undefined;
378
+ } & {
379
+ query?: {
380
+ status?: "active" | "cancelled" | "on_hold" | "pending" | "paused" | "failed" | "expired" | undefined;
381
+ page?: number | undefined;
382
+ limit?: number | undefined;
383
+ } | undefined;
384
+ } & {
385
+ params?: Record<string, any>;
386
+ } & {
387
+ request?: Request;
388
+ } & {
389
+ headers?: HeadersInit;
390
+ } & {
391
+ asResponse?: boolean;
392
+ returnHeaders?: boolean;
393
+ use?: better_call.Middleware[];
394
+ path?: string;
395
+ } & {
396
+ asResponse?: AsResponse | undefined;
397
+ returnHeaders?: ReturnHeaders | undefined;
398
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
399
+ headers: Headers;
400
+ response: {
401
+ items: DodoPayments$1.Subscriptions.SubscriptionListResponse[];
402
+ };
403
+ } : {
404
+ items: DodoPayments$1.Subscriptions.SubscriptionListResponse[];
405
+ }>;
406
+ options: {
407
+ method: "GET";
408
+ query: z.ZodOptional<z.ZodObject<{
409
+ page: z.ZodOptional<z.ZodNumber>;
410
+ limit: z.ZodOptional<z.ZodNumber>;
411
+ status: z.ZodOptional<z.ZodEnum<["active", "cancelled", "on_hold", "pending", "paused", "failed", "expired"]>>;
412
+ }, "strip", z.ZodTypeAny, {
413
+ status?: "active" | "cancelled" | "on_hold" | "pending" | "paused" | "failed" | "expired" | undefined;
414
+ page?: number | undefined;
415
+ limit?: number | undefined;
416
+ }, {
417
+ status?: "active" | "cancelled" | "on_hold" | "pending" | "paused" | "failed" | "expired" | undefined;
418
+ page?: number | undefined;
419
+ limit?: number | undefined;
420
+ }>>;
421
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
422
+ session: {
423
+ session: Record<string, any> & {
424
+ id: string;
425
+ token: string;
426
+ userId: string;
427
+ expiresAt: Date;
428
+ createdAt: Date;
429
+ updatedAt: Date;
430
+ ipAddress?: string | null | undefined;
431
+ userAgent?: string | null | undefined;
432
+ };
433
+ user: Record<string, any> & {
434
+ id: string;
435
+ name: string;
436
+ emailVerified: boolean;
437
+ email: string;
438
+ createdAt: Date;
439
+ updatedAt: Date;
440
+ image?: string | null | undefined;
441
+ };
442
+ };
443
+ }>)[];
444
+ } & {
445
+ use: any[];
446
+ };
447
+ path: "/customer/subscriptions/list";
448
+ };
449
+ payments: {
450
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
451
+ body?: undefined;
452
+ } & {
453
+ method?: "GET" | undefined;
454
+ } & {
455
+ query?: {
456
+ status?: "cancelled" | "failed" | "succeeded" | "processing" | "requires_customer_action" | "requires_merchant_action" | "requires_payment_method" | "requires_confirmation" | "requires_capture" | "partially_captured" | "partially_captured_and_capturable" | undefined;
457
+ page?: number | undefined;
458
+ limit?: number | undefined;
459
+ } | undefined;
460
+ } & {
461
+ params?: Record<string, any>;
462
+ } & {
463
+ request?: Request;
464
+ } & {
465
+ headers?: HeadersInit;
466
+ } & {
467
+ asResponse?: boolean;
468
+ returnHeaders?: boolean;
469
+ use?: better_call.Middleware[];
470
+ path?: string;
471
+ } & {
472
+ asResponse?: AsResponse | undefined;
473
+ returnHeaders?: ReturnHeaders | undefined;
474
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
475
+ headers: Headers;
476
+ response: {
477
+ items: DodoPayments$1.Payments.PaymentListResponse[];
478
+ };
479
+ } : {
480
+ items: DodoPayments$1.Payments.PaymentListResponse[];
481
+ }>;
482
+ options: {
483
+ method: "GET";
484
+ query: z.ZodOptional<z.ZodObject<{
485
+ page: z.ZodOptional<z.ZodNumber>;
486
+ limit: z.ZodOptional<z.ZodNumber>;
487
+ status: z.ZodOptional<z.ZodEnum<["succeeded", "failed", "cancelled", "processing", "requires_customer_action", "requires_merchant_action", "requires_payment_method", "requires_confirmation", "requires_capture", "partially_captured", "partially_captured_and_capturable"]>>;
488
+ }, "strip", z.ZodTypeAny, {
489
+ status?: "cancelled" | "failed" | "succeeded" | "processing" | "requires_customer_action" | "requires_merchant_action" | "requires_payment_method" | "requires_confirmation" | "requires_capture" | "partially_captured" | "partially_captured_and_capturable" | undefined;
490
+ page?: number | undefined;
491
+ limit?: number | undefined;
492
+ }, {
493
+ status?: "cancelled" | "failed" | "succeeded" | "processing" | "requires_customer_action" | "requires_merchant_action" | "requires_payment_method" | "requires_confirmation" | "requires_capture" | "partially_captured" | "partially_captured_and_capturable" | undefined;
494
+ page?: number | undefined;
495
+ limit?: number | undefined;
496
+ }>>;
497
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
498
+ session: {
499
+ session: Record<string, any> & {
500
+ id: string;
501
+ token: string;
502
+ userId: string;
503
+ expiresAt: Date;
504
+ createdAt: Date;
505
+ updatedAt: Date;
506
+ ipAddress?: string | null | undefined;
507
+ userAgent?: string | null | undefined;
508
+ };
509
+ user: Record<string, any> & {
510
+ id: string;
511
+ name: string;
512
+ emailVerified: boolean;
513
+ email: string;
514
+ createdAt: Date;
515
+ updatedAt: Date;
516
+ image?: string | null | undefined;
517
+ };
518
+ };
519
+ }>)[];
520
+ } & {
521
+ use: any[];
522
+ };
523
+ path: "/customer/payments/list";
524
+ };
525
+ };
526
+
527
+ declare const webhooks: (options: WebhookHandlerConfig) => (_dodopayments: DodoPayments$1) => {
528
+ dodopaymentsWebhooks: {
529
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
530
+ body?: undefined;
531
+ } & {
532
+ method?: "POST" | undefined;
533
+ } & {
534
+ query?: Record<string, any> | undefined;
535
+ } & {
536
+ params?: Record<string, any>;
537
+ } & {
538
+ request?: Request;
539
+ } & {
540
+ headers?: HeadersInit;
541
+ } & {
542
+ asResponse?: boolean;
543
+ returnHeaders?: boolean;
544
+ use?: better_call.Middleware[];
545
+ path?: string;
546
+ } & {
547
+ asResponse?: AsResponse | undefined;
548
+ returnHeaders?: ReturnHeaders | undefined;
549
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
550
+ headers: Headers;
551
+ response: {
552
+ received: boolean;
553
+ };
554
+ } : {
555
+ received: boolean;
556
+ }>;
557
+ options: {
558
+ method: "POST";
559
+ metadata: {
560
+ isAction: boolean;
561
+ };
562
+ cloneRequest: true;
563
+ } & {
564
+ use: any[];
565
+ };
566
+ path: "/webhooks/dodopayments";
567
+ };
568
+ };
569
+
570
+ type Product = {
571
+ /**
572
+ * Product Id from DodoPayments Product
573
+ */
574
+ productId: string;
575
+ /**
576
+ * Easily identifiable slug for the product
577
+ */
578
+ slug: string;
579
+ };
580
+ type DodoPaymentsPlugin = ReturnType<typeof checkout> | ReturnType<typeof portal> | ReturnType<typeof webhooks>;
581
+ type DodoPaymentsPlugins = [DodoPaymentsPlugin, ...DodoPaymentsPlugin[]];
582
+ interface DodoPaymentsOptions {
583
+ /**
584
+ * DodoPayments Client
585
+ */
586
+ client: DodoPayments$1;
587
+ /**
588
+ * Enable customer creation when a user signs up
589
+ */
590
+ createCustomerOnSignUp?: boolean;
591
+ /**
592
+ * Use DodoPayments plugins
593
+ */
594
+ use: DodoPaymentsPlugins;
595
+ }
596
+
597
+ declare const dodopaymentsClient: () => {
598
+ id: "dodopayments-client";
599
+ $InferServerPlugin: ReturnType<typeof dodopayments>;
600
+ };
601
+
602
+ declare const dodopayments: (options: DodoPaymentsOptions) => {
603
+ id: "dodopayments";
604
+ endpoints: {
605
+ checkout: {
606
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
607
+ body: zod.objectInputType<{
608
+ product_id: zod.ZodOptional<zod.ZodString>;
609
+ quantity: zod.ZodOptional<zod.ZodNumber>;
610
+ product_cart: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
611
+ product_id: zod.ZodString;
612
+ quantity: zod.ZodNumber;
613
+ }, "strip", zod.ZodTypeAny, {
614
+ quantity: number;
615
+ product_id: string;
616
+ }, {
617
+ quantity: number;
618
+ product_id: string;
619
+ }>, "many">>;
620
+ billing: zod.ZodObject<{
621
+ city: zod.ZodString;
622
+ country: zod.ZodString;
623
+ state: zod.ZodString;
624
+ street: zod.ZodString;
625
+ zipcode: zod.ZodString;
626
+ }, "strip", zod.ZodTypeAny, {
627
+ country: string;
628
+ city: string;
629
+ state: string;
630
+ street: string;
631
+ zipcode: string;
632
+ }, {
633
+ country: string;
634
+ city: string;
635
+ state: string;
636
+ street: string;
637
+ zipcode: string;
638
+ }>;
639
+ customer: zod.ZodObject<{
640
+ customer_id: zod.ZodOptional<zod.ZodString>;
641
+ email: zod.ZodOptional<zod.ZodString>;
642
+ name: zod.ZodOptional<zod.ZodString>;
643
+ }, "strip", zod.ZodTypeAny, {
644
+ email?: string | undefined;
645
+ customer_id?: string | undefined;
646
+ name?: string | undefined;
647
+ }, {
648
+ email?: string | undefined;
649
+ customer_id?: string | undefined;
650
+ name?: string | undefined;
651
+ }>;
652
+ discount_id: zod.ZodOptional<zod.ZodString>;
653
+ addons: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
654
+ addon_id: zod.ZodString;
655
+ quantity: zod.ZodNumber;
656
+ }, "strip", zod.ZodTypeAny, {
657
+ quantity: number;
658
+ addon_id: string;
659
+ }, {
660
+ quantity: number;
661
+ addon_id: string;
662
+ }>, "many">>;
663
+ metadata: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodString>>;
664
+ currency: zod.ZodOptional<zod.ZodString>;
665
+ } & {
666
+ slug: zod.ZodOptional<zod.ZodString>;
667
+ referenceId: zod.ZodOptional<zod.ZodString>;
668
+ }, zod.ZodUnknown, "strip">;
669
+ } & {
670
+ method?: "POST" | undefined;
671
+ } & {
672
+ query?: Record<string, any> | undefined;
673
+ } & {
674
+ params?: Record<string, any>;
675
+ } & {
676
+ request: Request;
677
+ } & {
678
+ headers?: HeadersInit;
679
+ } & {
680
+ asResponse?: boolean;
681
+ returnHeaders?: boolean;
682
+ use?: better_call.Middleware[];
683
+ path?: string;
684
+ } & {
685
+ asResponse?: AsResponse | undefined;
686
+ returnHeaders?: ReturnHeaders | undefined;
687
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
688
+ headers: Headers;
689
+ response: {
690
+ url: string;
691
+ redirect: boolean;
692
+ };
693
+ } : {
694
+ url: string;
695
+ redirect: boolean;
696
+ }>;
697
+ options: {
698
+ method: "POST";
699
+ body: zod.ZodObject<{
700
+ product_id: zod.ZodOptional<zod.ZodString>;
701
+ quantity: zod.ZodOptional<zod.ZodNumber>;
702
+ product_cart: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
703
+ product_id: zod.ZodString;
704
+ quantity: zod.ZodNumber;
705
+ }, "strip", zod.ZodTypeAny, {
706
+ quantity: number;
707
+ product_id: string;
708
+ }, {
709
+ quantity: number;
710
+ product_id: string;
711
+ }>, "many">>;
712
+ billing: zod.ZodObject<{
713
+ city: zod.ZodString;
714
+ country: zod.ZodString;
715
+ state: zod.ZodString;
716
+ street: zod.ZodString;
717
+ zipcode: zod.ZodString;
718
+ }, "strip", zod.ZodTypeAny, {
719
+ country: string;
720
+ city: string;
721
+ state: string;
722
+ street: string;
723
+ zipcode: string;
724
+ }, {
725
+ country: string;
726
+ city: string;
727
+ state: string;
728
+ street: string;
729
+ zipcode: string;
730
+ }>;
731
+ customer: zod.ZodObject<{
732
+ customer_id: zod.ZodOptional<zod.ZodString>;
733
+ email: zod.ZodOptional<zod.ZodString>;
734
+ name: zod.ZodOptional<zod.ZodString>;
735
+ }, "strip", zod.ZodTypeAny, {
736
+ email?: string | undefined;
737
+ customer_id?: string | undefined;
738
+ name?: string | undefined;
739
+ }, {
740
+ email?: string | undefined;
741
+ customer_id?: string | undefined;
742
+ name?: string | undefined;
743
+ }>;
744
+ discount_id: zod.ZodOptional<zod.ZodString>;
745
+ addons: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
746
+ addon_id: zod.ZodString;
747
+ quantity: zod.ZodNumber;
748
+ }, "strip", zod.ZodTypeAny, {
749
+ quantity: number;
750
+ addon_id: string;
751
+ }, {
752
+ quantity: number;
753
+ addon_id: string;
754
+ }>, "many">>;
755
+ metadata: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodString>>;
756
+ currency: zod.ZodOptional<zod.ZodString>;
757
+ } & {
758
+ slug: zod.ZodOptional<zod.ZodString>;
759
+ referenceId: zod.ZodOptional<zod.ZodString>;
760
+ }, "strip", zod.ZodUnknown, zod.objectOutputType<{
761
+ product_id: zod.ZodOptional<zod.ZodString>;
762
+ quantity: zod.ZodOptional<zod.ZodNumber>;
763
+ product_cart: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
764
+ product_id: zod.ZodString;
765
+ quantity: zod.ZodNumber;
766
+ }, "strip", zod.ZodTypeAny, {
767
+ quantity: number;
768
+ product_id: string;
769
+ }, {
770
+ quantity: number;
771
+ product_id: string;
772
+ }>, "many">>;
773
+ billing: zod.ZodObject<{
774
+ city: zod.ZodString;
775
+ country: zod.ZodString;
776
+ state: zod.ZodString;
777
+ street: zod.ZodString;
778
+ zipcode: zod.ZodString;
779
+ }, "strip", zod.ZodTypeAny, {
780
+ country: string;
781
+ city: string;
782
+ state: string;
783
+ street: string;
784
+ zipcode: string;
785
+ }, {
786
+ country: string;
787
+ city: string;
788
+ state: string;
789
+ street: string;
790
+ zipcode: string;
791
+ }>;
792
+ customer: zod.ZodObject<{
793
+ customer_id: zod.ZodOptional<zod.ZodString>;
794
+ email: zod.ZodOptional<zod.ZodString>;
795
+ name: zod.ZodOptional<zod.ZodString>;
796
+ }, "strip", zod.ZodTypeAny, {
797
+ email?: string | undefined;
798
+ customer_id?: string | undefined;
799
+ name?: string | undefined;
800
+ }, {
801
+ email?: string | undefined;
802
+ customer_id?: string | undefined;
803
+ name?: string | undefined;
804
+ }>;
805
+ discount_id: zod.ZodOptional<zod.ZodString>;
806
+ addons: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
807
+ addon_id: zod.ZodString;
808
+ quantity: zod.ZodNumber;
809
+ }, "strip", zod.ZodTypeAny, {
810
+ quantity: number;
811
+ addon_id: string;
812
+ }, {
813
+ quantity: number;
814
+ addon_id: string;
815
+ }>, "many">>;
816
+ metadata: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodString>>;
817
+ currency: zod.ZodOptional<zod.ZodString>;
818
+ } & {
819
+ slug: zod.ZodOptional<zod.ZodString>;
820
+ referenceId: zod.ZodOptional<zod.ZodString>;
821
+ }, zod.ZodUnknown, "strip">, zod.objectInputType<{
822
+ product_id: zod.ZodOptional<zod.ZodString>;
823
+ quantity: zod.ZodOptional<zod.ZodNumber>;
824
+ product_cart: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
825
+ product_id: zod.ZodString;
826
+ quantity: zod.ZodNumber;
827
+ }, "strip", zod.ZodTypeAny, {
828
+ quantity: number;
829
+ product_id: string;
830
+ }, {
831
+ quantity: number;
832
+ product_id: string;
833
+ }>, "many">>;
834
+ billing: zod.ZodObject<{
835
+ city: zod.ZodString;
836
+ country: zod.ZodString;
837
+ state: zod.ZodString;
838
+ street: zod.ZodString;
839
+ zipcode: zod.ZodString;
840
+ }, "strip", zod.ZodTypeAny, {
841
+ country: string;
842
+ city: string;
843
+ state: string;
844
+ street: string;
845
+ zipcode: string;
846
+ }, {
847
+ country: string;
848
+ city: string;
849
+ state: string;
850
+ street: string;
851
+ zipcode: string;
852
+ }>;
853
+ customer: zod.ZodObject<{
854
+ customer_id: zod.ZodOptional<zod.ZodString>;
855
+ email: zod.ZodOptional<zod.ZodString>;
856
+ name: zod.ZodOptional<zod.ZodString>;
857
+ }, "strip", zod.ZodTypeAny, {
858
+ email?: string | undefined;
859
+ customer_id?: string | undefined;
860
+ name?: string | undefined;
861
+ }, {
862
+ email?: string | undefined;
863
+ customer_id?: string | undefined;
864
+ name?: string | undefined;
865
+ }>;
866
+ discount_id: zod.ZodOptional<zod.ZodString>;
867
+ addons: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
868
+ addon_id: zod.ZodString;
869
+ quantity: zod.ZodNumber;
870
+ }, "strip", zod.ZodTypeAny, {
871
+ quantity: number;
872
+ addon_id: string;
873
+ }, {
874
+ quantity: number;
875
+ addon_id: string;
876
+ }>, "many">>;
877
+ metadata: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodString>>;
878
+ currency: zod.ZodOptional<zod.ZodString>;
879
+ } & {
880
+ slug: zod.ZodOptional<zod.ZodString>;
881
+ referenceId: zod.ZodOptional<zod.ZodString>;
882
+ }, zod.ZodUnknown, "strip">>;
883
+ requireRequest: true;
884
+ } & {
885
+ use: any[];
886
+ };
887
+ path: "/checkout";
888
+ };
889
+ } | {
890
+ portal: {
891
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
892
+ body?: undefined;
893
+ } & {
894
+ method?: "GET" | undefined;
895
+ } & {
896
+ query?: Record<string, any> | undefined;
897
+ } & {
898
+ params?: Record<string, any>;
899
+ } & {
900
+ request?: Request;
901
+ } & {
902
+ headers?: HeadersInit;
903
+ } & {
904
+ asResponse?: boolean;
905
+ returnHeaders?: boolean;
906
+ use?: better_call.Middleware[];
907
+ path?: string;
908
+ } & {
909
+ asResponse?: AsResponse | undefined;
910
+ returnHeaders?: ReturnHeaders | undefined;
911
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
912
+ headers: Headers;
913
+ response: {
914
+ url: string;
915
+ redirect: boolean;
916
+ };
917
+ } : {
918
+ url: string;
919
+ redirect: boolean;
920
+ }>;
921
+ options: {
922
+ method: "GET";
923
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
924
+ session: {
925
+ session: Record<string, any> & {
926
+ id: string;
927
+ token: string;
928
+ userId: string;
929
+ expiresAt: Date;
930
+ createdAt: Date;
931
+ updatedAt: Date;
932
+ ipAddress?: string | null | undefined;
933
+ userAgent?: string | null | undefined;
934
+ };
935
+ user: Record<string, any> & {
936
+ id: string;
937
+ name: string;
938
+ emailVerified: boolean;
939
+ email: string;
940
+ createdAt: Date;
941
+ updatedAt: Date;
942
+ image?: string | null | undefined;
943
+ };
944
+ };
945
+ }>)[];
946
+ } & {
947
+ use: any[];
948
+ };
949
+ path: "/customer/portal";
950
+ };
951
+ subscriptions: {
952
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
953
+ body?: undefined;
954
+ } & {
955
+ method?: "GET" | undefined;
956
+ } & {
957
+ query?: {
958
+ status?: "active" | "cancelled" | "on_hold" | "pending" | "paused" | "failed" | "expired" | undefined;
959
+ page?: number | undefined;
960
+ limit?: number | undefined;
961
+ } | undefined;
962
+ } & {
963
+ params?: Record<string, any>;
964
+ } & {
965
+ request?: Request;
966
+ } & {
967
+ headers?: HeadersInit;
968
+ } & {
969
+ asResponse?: boolean;
970
+ returnHeaders?: boolean;
971
+ use?: better_call.Middleware[];
972
+ path?: string;
973
+ } & {
974
+ asResponse?: AsResponse | undefined;
975
+ returnHeaders?: ReturnHeaders | undefined;
976
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
977
+ headers: Headers;
978
+ response: {
979
+ items: dodopayments_resources_subscriptions_mjs.SubscriptionListResponse[];
980
+ };
981
+ } : {
982
+ items: dodopayments_resources_subscriptions_mjs.SubscriptionListResponse[];
983
+ }>;
984
+ options: {
985
+ method: "GET";
986
+ query: zod.ZodOptional<zod.ZodObject<{
987
+ page: zod.ZodOptional<zod.ZodNumber>;
988
+ limit: zod.ZodOptional<zod.ZodNumber>;
989
+ status: zod.ZodOptional<zod.ZodEnum<["active", "cancelled", "on_hold", "pending", "paused", "failed", "expired"]>>;
990
+ }, "strip", zod.ZodTypeAny, {
991
+ status?: "active" | "cancelled" | "on_hold" | "pending" | "paused" | "failed" | "expired" | undefined;
992
+ page?: number | undefined;
993
+ limit?: number | undefined;
994
+ }, {
995
+ status?: "active" | "cancelled" | "on_hold" | "pending" | "paused" | "failed" | "expired" | undefined;
996
+ page?: number | undefined;
997
+ limit?: number | undefined;
998
+ }>>;
999
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
1000
+ session: {
1001
+ session: Record<string, any> & {
1002
+ id: string;
1003
+ token: string;
1004
+ userId: string;
1005
+ expiresAt: Date;
1006
+ createdAt: Date;
1007
+ updatedAt: Date;
1008
+ ipAddress?: string | null | undefined;
1009
+ userAgent?: string | null | undefined;
1010
+ };
1011
+ user: Record<string, any> & {
1012
+ id: string;
1013
+ name: string;
1014
+ emailVerified: boolean;
1015
+ email: string;
1016
+ createdAt: Date;
1017
+ updatedAt: Date;
1018
+ image?: string | null | undefined;
1019
+ };
1020
+ };
1021
+ }>)[];
1022
+ } & {
1023
+ use: any[];
1024
+ };
1025
+ path: "/customer/subscriptions/list";
1026
+ };
1027
+ payments: {
1028
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
1029
+ body?: undefined;
1030
+ } & {
1031
+ method?: "GET" | undefined;
1032
+ } & {
1033
+ query?: {
1034
+ status?: "cancelled" | "failed" | "succeeded" | "processing" | "requires_customer_action" | "requires_merchant_action" | "requires_payment_method" | "requires_confirmation" | "requires_capture" | "partially_captured" | "partially_captured_and_capturable" | undefined;
1035
+ page?: number | undefined;
1036
+ limit?: number | undefined;
1037
+ } | undefined;
1038
+ } & {
1039
+ params?: Record<string, any>;
1040
+ } & {
1041
+ request?: Request;
1042
+ } & {
1043
+ headers?: HeadersInit;
1044
+ } & {
1045
+ asResponse?: boolean;
1046
+ returnHeaders?: boolean;
1047
+ use?: better_call.Middleware[];
1048
+ path?: string;
1049
+ } & {
1050
+ asResponse?: AsResponse | undefined;
1051
+ returnHeaders?: ReturnHeaders | undefined;
1052
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
1053
+ headers: Headers;
1054
+ response: {
1055
+ items: dodopayments_resources_payments_mjs.PaymentListResponse[];
1056
+ };
1057
+ } : {
1058
+ items: dodopayments_resources_payments_mjs.PaymentListResponse[];
1059
+ }>;
1060
+ options: {
1061
+ method: "GET";
1062
+ query: zod.ZodOptional<zod.ZodObject<{
1063
+ page: zod.ZodOptional<zod.ZodNumber>;
1064
+ limit: zod.ZodOptional<zod.ZodNumber>;
1065
+ status: zod.ZodOptional<zod.ZodEnum<["succeeded", "failed", "cancelled", "processing", "requires_customer_action", "requires_merchant_action", "requires_payment_method", "requires_confirmation", "requires_capture", "partially_captured", "partially_captured_and_capturable"]>>;
1066
+ }, "strip", zod.ZodTypeAny, {
1067
+ status?: "cancelled" | "failed" | "succeeded" | "processing" | "requires_customer_action" | "requires_merchant_action" | "requires_payment_method" | "requires_confirmation" | "requires_capture" | "partially_captured" | "partially_captured_and_capturable" | undefined;
1068
+ page?: number | undefined;
1069
+ limit?: number | undefined;
1070
+ }, {
1071
+ status?: "cancelled" | "failed" | "succeeded" | "processing" | "requires_customer_action" | "requires_merchant_action" | "requires_payment_method" | "requires_confirmation" | "requires_capture" | "partially_captured" | "partially_captured_and_capturable" | undefined;
1072
+ page?: number | undefined;
1073
+ limit?: number | undefined;
1074
+ }>>;
1075
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
1076
+ session: {
1077
+ session: Record<string, any> & {
1078
+ id: string;
1079
+ token: string;
1080
+ userId: string;
1081
+ expiresAt: Date;
1082
+ createdAt: Date;
1083
+ updatedAt: Date;
1084
+ ipAddress?: string | null | undefined;
1085
+ userAgent?: string | null | undefined;
1086
+ };
1087
+ user: Record<string, any> & {
1088
+ id: string;
1089
+ name: string;
1090
+ emailVerified: boolean;
1091
+ email: string;
1092
+ createdAt: Date;
1093
+ updatedAt: Date;
1094
+ image?: string | null | undefined;
1095
+ };
1096
+ };
1097
+ }>)[];
1098
+ } & {
1099
+ use: any[];
1100
+ };
1101
+ path: "/customer/payments/list";
1102
+ };
1103
+ } | {
1104
+ dodopaymentsWebhooks: {
1105
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
1106
+ body?: undefined;
1107
+ } & {
1108
+ method?: "POST" | undefined;
1109
+ } & {
1110
+ query?: Record<string, any> | undefined;
1111
+ } & {
1112
+ params?: Record<string, any>;
1113
+ } & {
1114
+ request?: Request;
1115
+ } & {
1116
+ headers?: HeadersInit;
1117
+ } & {
1118
+ asResponse?: boolean;
1119
+ returnHeaders?: boolean;
1120
+ use?: better_call.Middleware[];
1121
+ path?: string;
1122
+ } & {
1123
+ asResponse?: AsResponse | undefined;
1124
+ returnHeaders?: ReturnHeaders | undefined;
1125
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
1126
+ headers: Headers;
1127
+ response: {
1128
+ received: boolean;
1129
+ };
1130
+ } : {
1131
+ received: boolean;
1132
+ }>;
1133
+ options: {
1134
+ method: "POST";
1135
+ metadata: {
1136
+ isAction: boolean;
1137
+ };
1138
+ cloneRequest: true;
1139
+ } & {
1140
+ use: any[];
1141
+ };
1142
+ path: "/webhooks/dodopayments";
1143
+ };
1144
+ };
1145
+ init(): {
1146
+ options: {
1147
+ databaseHooks: {
1148
+ user: {
1149
+ create: {
1150
+ after: (user: better_auth.User, ctx?: better_auth.GenericEndpointContext) => Promise<void>;
1151
+ };
1152
+ update: {
1153
+ after: (user: better_auth.User, ctx?: better_auth.GenericEndpointContext) => Promise<void>;
1154
+ };
1155
+ };
1156
+ };
1157
+ };
1158
+ };
1159
+ };
1160
+
1161
+ export { checkout, dodopayments, dodopaymentsClient, portal, webhooks };
1162
+ export type { CheckoutOptions };