@dodopayments/better-auth 1.3.2 → 1.3.4

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.
Files changed (59) hide show
  1. package/dist/chunk-52LQJCF4.js +199 -0
  2. package/dist/chunk-52LQJCF4.js.map +1 -0
  3. package/dist/chunk-FBAIEKOL.js +70 -0
  4. package/dist/chunk-FBAIEKOL.js.map +1 -0
  5. package/dist/chunk-PXI4EHZC.js +12 -0
  6. package/dist/chunk-PXI4EHZC.js.map +1 -0
  7. package/dist/chunk-QR7PLJJQ.js +13943 -0
  8. package/dist/chunk-QR7PLJJQ.js.map +1 -0
  9. package/dist/chunk-WIFOXVZ3.js +291 -0
  10. package/dist/chunk-WIFOXVZ3.js.map +1 -0
  11. package/dist/chunk-YK6XO66Y.js +84 -0
  12. package/dist/chunk-YK6XO66Y.js.map +1 -0
  13. package/dist/chunk-Z7VSWPPK.js +181 -0
  14. package/dist/chunk-Z7VSWPPK.js.map +1 -0
  15. package/dist/client.cjs +36 -0
  16. package/dist/client.cjs.map +1 -0
  17. package/dist/client.d.cts +7 -0
  18. package/dist/client.d.ts +7 -5
  19. package/dist/client.js +6 -5
  20. package/dist/client.js.map +1 -0
  21. package/dist/hooks/customer.cjs +14036 -0
  22. package/dist/hooks/customer.cjs.map +1 -0
  23. package/dist/hooks/customer.d.cts +11 -0
  24. package/dist/hooks/customer.d.ts +11 -4
  25. package/dist/hooks/customer.js +9 -62
  26. package/dist/hooks/customer.js.map +1 -0
  27. package/dist/index.cjs +14793 -0
  28. package/dist/index.cjs.map +1 -0
  29. package/dist/index.d.cts +797 -0
  30. package/dist/index.d.ts +205 -196
  31. package/dist/index.js +55 -34
  32. package/dist/index.js.map +1 -0
  33. package/dist/plugins/checkout.cjs +14424 -0
  34. package/dist/plugins/checkout.cjs.map +1 -0
  35. package/dist/plugins/checkout.d.cts +6 -0
  36. package/dist/plugins/checkout.d.ts +6 -548
  37. package/dist/plugins/checkout.js +8 -170
  38. package/dist/plugins/checkout.js.map +1 -0
  39. package/dist/plugins/portal.cjs +14446 -0
  40. package/dist/plugins/portal.cjs.map +1 -0
  41. package/dist/plugins/portal.d.cts +6 -0
  42. package/dist/plugins/portal.d.ts +6 -204
  43. package/dist/plugins/portal.js +8 -171
  44. package/dist/plugins/portal.js.map +1 -0
  45. package/dist/plugins/webhooks.cjs +14046 -0
  46. package/dist/plugins/webhooks.cjs.map +1 -0
  47. package/dist/plugins/webhooks.d.cts +6 -0
  48. package/dist/plugins/webhooks.d.ts +6 -41
  49. package/dist/plugins/webhooks.js +7 -61
  50. package/dist/plugins/webhooks.js.map +1 -0
  51. package/dist/types-CbotWcHh.d.cts +841 -0
  52. package/dist/types-CbotWcHh.d.ts +841 -0
  53. package/dist/types.cjs +19 -0
  54. package/dist/types.cjs.map +1 -0
  55. package/dist/types.d.cts +6 -0
  56. package/dist/types.d.ts +6 -52
  57. package/dist/types.js +1 -1
  58. package/dist/types.js.map +1 -0
  59. package/package.json +5 -10
@@ -0,0 +1,841 @@
1
+ import DodoPayments, { DodoPayments as DodoPayments$1 } from 'dodopayments';
2
+ import { UnionToIntersection } from 'better-auth';
3
+ import * as better_call from 'better-call';
4
+ import { z } from 'zod/v3';
5
+ import { WebhookHandlerConfig } from '@dodopayments/core/webhook';
6
+
7
+ interface CheckoutOptions {
8
+ /**
9
+ * Optional list of slug -> productId mappings for easy slug checkouts
10
+ */
11
+ products?: Product[] | (() => Promise<Product[]>);
12
+ /**
13
+ * Checkout Success URL
14
+ */
15
+ successUrl?: string;
16
+ /**
17
+ * Only allow authenticated customers to checkout
18
+ */
19
+ authenticatedUsersOnly?: boolean;
20
+ }
21
+ declare const checkout: (checkoutOptions?: CheckoutOptions) => (dodopayments: DodoPayments) => {
22
+ /**
23
+ * @deprecated
24
+ */
25
+ dodoCheckout: {
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: CreateCheckoutResponse;
110
+ } : CreateCheckoutResponse>;
111
+ options: {
112
+ method: "POST";
113
+ body: z.ZodObject<{
114
+ product_id: z.ZodOptional<z.ZodString>;
115
+ quantity: z.ZodOptional<z.ZodNumber>;
116
+ product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
117
+ product_id: z.ZodString;
118
+ quantity: z.ZodNumber;
119
+ }, "strip", z.ZodTypeAny, {
120
+ quantity: number;
121
+ product_id: string;
122
+ }, {
123
+ quantity: number;
124
+ product_id: string;
125
+ }>, "many">>;
126
+ billing: z.ZodObject<{
127
+ city: z.ZodString;
128
+ country: z.ZodString;
129
+ state: z.ZodString;
130
+ street: z.ZodString;
131
+ zipcode: z.ZodString;
132
+ }, "strip", z.ZodTypeAny, {
133
+ country: string;
134
+ city: string;
135
+ state: string;
136
+ street: string;
137
+ zipcode: string;
138
+ }, {
139
+ country: string;
140
+ city: string;
141
+ state: string;
142
+ street: string;
143
+ zipcode: string;
144
+ }>;
145
+ customer: z.ZodObject<{
146
+ customer_id: z.ZodOptional<z.ZodString>;
147
+ email: z.ZodOptional<z.ZodString>;
148
+ name: z.ZodOptional<z.ZodString>;
149
+ }, "strip", z.ZodTypeAny, {
150
+ email?: string | undefined;
151
+ customer_id?: string | undefined;
152
+ name?: string | undefined;
153
+ }, {
154
+ email?: string | undefined;
155
+ customer_id?: string | undefined;
156
+ name?: string | undefined;
157
+ }>;
158
+ discount_id: z.ZodOptional<z.ZodString>;
159
+ addons: z.ZodOptional<z.ZodArray<z.ZodObject<{
160
+ addon_id: z.ZodString;
161
+ quantity: z.ZodNumber;
162
+ }, "strip", z.ZodTypeAny, {
163
+ quantity: number;
164
+ addon_id: string;
165
+ }, {
166
+ quantity: number;
167
+ addon_id: string;
168
+ }>, "many">>;
169
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
170
+ currency: z.ZodOptional<z.ZodString>;
171
+ } & {
172
+ slug: z.ZodOptional<z.ZodString>;
173
+ referenceId: z.ZodOptional<z.ZodString>;
174
+ }, "strip", z.ZodUnknown, z.objectOutputType<{
175
+ product_id: z.ZodOptional<z.ZodString>;
176
+ quantity: z.ZodOptional<z.ZodNumber>;
177
+ product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
178
+ product_id: z.ZodString;
179
+ quantity: z.ZodNumber;
180
+ }, "strip", z.ZodTypeAny, {
181
+ quantity: number;
182
+ product_id: string;
183
+ }, {
184
+ quantity: number;
185
+ product_id: string;
186
+ }>, "many">>;
187
+ billing: z.ZodObject<{
188
+ city: z.ZodString;
189
+ country: z.ZodString;
190
+ state: z.ZodString;
191
+ street: z.ZodString;
192
+ zipcode: z.ZodString;
193
+ }, "strip", z.ZodTypeAny, {
194
+ country: string;
195
+ city: string;
196
+ state: string;
197
+ street: string;
198
+ zipcode: string;
199
+ }, {
200
+ country: string;
201
+ city: string;
202
+ state: string;
203
+ street: string;
204
+ zipcode: string;
205
+ }>;
206
+ customer: z.ZodObject<{
207
+ customer_id: z.ZodOptional<z.ZodString>;
208
+ email: z.ZodOptional<z.ZodString>;
209
+ name: z.ZodOptional<z.ZodString>;
210
+ }, "strip", z.ZodTypeAny, {
211
+ email?: string | undefined;
212
+ customer_id?: string | undefined;
213
+ name?: string | undefined;
214
+ }, {
215
+ email?: string | undefined;
216
+ customer_id?: string | undefined;
217
+ name?: string | undefined;
218
+ }>;
219
+ discount_id: z.ZodOptional<z.ZodString>;
220
+ addons: z.ZodOptional<z.ZodArray<z.ZodObject<{
221
+ addon_id: z.ZodString;
222
+ quantity: z.ZodNumber;
223
+ }, "strip", z.ZodTypeAny, {
224
+ quantity: number;
225
+ addon_id: string;
226
+ }, {
227
+ quantity: number;
228
+ addon_id: string;
229
+ }>, "many">>;
230
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
231
+ currency: z.ZodOptional<z.ZodString>;
232
+ } & {
233
+ slug: z.ZodOptional<z.ZodString>;
234
+ referenceId: z.ZodOptional<z.ZodString>;
235
+ }, z.ZodUnknown, "strip">, z.objectInputType<{
236
+ product_id: z.ZodOptional<z.ZodString>;
237
+ quantity: z.ZodOptional<z.ZodNumber>;
238
+ product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
239
+ product_id: z.ZodString;
240
+ quantity: z.ZodNumber;
241
+ }, "strip", z.ZodTypeAny, {
242
+ quantity: number;
243
+ product_id: string;
244
+ }, {
245
+ quantity: number;
246
+ product_id: string;
247
+ }>, "many">>;
248
+ billing: z.ZodObject<{
249
+ city: z.ZodString;
250
+ country: z.ZodString;
251
+ state: z.ZodString;
252
+ street: z.ZodString;
253
+ zipcode: z.ZodString;
254
+ }, "strip", z.ZodTypeAny, {
255
+ country: string;
256
+ city: string;
257
+ state: string;
258
+ street: string;
259
+ zipcode: string;
260
+ }, {
261
+ country: string;
262
+ city: string;
263
+ state: string;
264
+ street: string;
265
+ zipcode: string;
266
+ }>;
267
+ customer: z.ZodObject<{
268
+ customer_id: z.ZodOptional<z.ZodString>;
269
+ email: z.ZodOptional<z.ZodString>;
270
+ name: z.ZodOptional<z.ZodString>;
271
+ }, "strip", z.ZodTypeAny, {
272
+ email?: string | undefined;
273
+ customer_id?: string | undefined;
274
+ name?: string | undefined;
275
+ }, {
276
+ email?: string | undefined;
277
+ customer_id?: string | undefined;
278
+ name?: string | undefined;
279
+ }>;
280
+ discount_id: z.ZodOptional<z.ZodString>;
281
+ addons: z.ZodOptional<z.ZodArray<z.ZodObject<{
282
+ addon_id: z.ZodString;
283
+ quantity: z.ZodNumber;
284
+ }, "strip", z.ZodTypeAny, {
285
+ quantity: number;
286
+ addon_id: string;
287
+ }, {
288
+ quantity: number;
289
+ addon_id: string;
290
+ }>, "many">>;
291
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
292
+ currency: z.ZodOptional<z.ZodString>;
293
+ } & {
294
+ slug: z.ZodOptional<z.ZodString>;
295
+ referenceId: z.ZodOptional<z.ZodString>;
296
+ }, z.ZodUnknown, "strip">>;
297
+ requireRequest: true;
298
+ } & {
299
+ use: any[];
300
+ };
301
+ path: "/dodopayments/checkout";
302
+ };
303
+ dodoCheckoutSession: {
304
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
305
+ body: {
306
+ product_cart?: {
307
+ quantity: number;
308
+ product_id: string;
309
+ }[] | undefined;
310
+ customer?: {
311
+ email?: string | undefined;
312
+ name?: string | undefined;
313
+ phone_number?: string | undefined;
314
+ } | undefined;
315
+ metadata?: Record<string, string> | undefined;
316
+ slug?: string | undefined;
317
+ referenceId?: string | undefined;
318
+ billing_address?: {
319
+ country: string;
320
+ city?: string | undefined;
321
+ state?: string | undefined;
322
+ street?: string | undefined;
323
+ zipcode?: string | undefined;
324
+ } | undefined;
325
+ return_url?: string | undefined;
326
+ allowed_payment_method_types?: ("credit" | "debit" | "upi_collect" | "upi_intent" | "apple_pay" | "google_pay" | "amazon_pay" | "klarna" | "affirm" | "afterpay_clearpay" | "sepa" | "ach")[] | undefined;
327
+ billing_currency?: string | undefined;
328
+ show_saved_payment_methods?: boolean | undefined;
329
+ confirm?: boolean | undefined;
330
+ discount_code?: string | undefined;
331
+ customization?: {
332
+ theme?: "light" | "dark" | "system" | undefined;
333
+ show_order_details?: boolean | undefined;
334
+ show_on_demand_tag?: boolean | undefined;
335
+ } | undefined;
336
+ feature_flags?: {
337
+ allow_currency_selection?: boolean | undefined;
338
+ allow_discount_code?: boolean | undefined;
339
+ allow_phone_number_collection?: boolean | undefined;
340
+ allow_tax_id?: boolean | undefined;
341
+ always_create_new_customer?: boolean | undefined;
342
+ } | undefined;
343
+ subscription_data?: {
344
+ trial_period_days?: number | undefined;
345
+ } | undefined;
346
+ };
347
+ } & {
348
+ method?: "POST" | undefined;
349
+ } & {
350
+ query?: Record<string, any> | undefined;
351
+ } & {
352
+ params?: Record<string, any>;
353
+ } & {
354
+ request: Request;
355
+ } & {
356
+ headers?: HeadersInit;
357
+ } & {
358
+ asResponse?: boolean;
359
+ returnHeaders?: boolean;
360
+ use?: better_call.Middleware[];
361
+ path?: string;
362
+ } & {
363
+ asResponse?: AsResponse | undefined;
364
+ returnHeaders?: ReturnHeaders | undefined;
365
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
366
+ headers: Headers;
367
+ response: CreateCheckoutResponse;
368
+ } : CreateCheckoutResponse>;
369
+ options: {
370
+ method: "POST";
371
+ body: z.ZodObject<{
372
+ product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
373
+ product_id: z.ZodString;
374
+ quantity: z.ZodNumber;
375
+ }, "strip", z.ZodTypeAny, {
376
+ quantity: number;
377
+ product_id: string;
378
+ }, {
379
+ quantity: number;
380
+ product_id: string;
381
+ }>, "many">>;
382
+ customer: z.ZodOptional<z.ZodObject<{
383
+ email: z.ZodOptional<z.ZodString>;
384
+ name: z.ZodOptional<z.ZodString>;
385
+ phone_number: z.ZodOptional<z.ZodString>;
386
+ }, "strip", z.ZodTypeAny, {
387
+ email?: string | undefined;
388
+ name?: string | undefined;
389
+ phone_number?: string | undefined;
390
+ }, {
391
+ email?: string | undefined;
392
+ name?: string | undefined;
393
+ phone_number?: string | undefined;
394
+ }>>;
395
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
396
+ slug: z.ZodOptional<z.ZodString>;
397
+ referenceId: z.ZodOptional<z.ZodString>;
398
+ billing_address: z.ZodOptional<z.ZodObject<{
399
+ street: z.ZodOptional<z.ZodString>;
400
+ city: z.ZodOptional<z.ZodString>;
401
+ state: z.ZodOptional<z.ZodString>;
402
+ country: z.ZodString;
403
+ zipcode: z.ZodOptional<z.ZodString>;
404
+ }, "strip", z.ZodTypeAny, {
405
+ country: string;
406
+ city?: string | undefined;
407
+ state?: string | undefined;
408
+ street?: string | undefined;
409
+ zipcode?: string | undefined;
410
+ }, {
411
+ country: string;
412
+ city?: string | undefined;
413
+ state?: string | undefined;
414
+ street?: string | undefined;
415
+ zipcode?: string | undefined;
416
+ }>>;
417
+ return_url: z.ZodOptional<z.ZodString>;
418
+ allowed_payment_method_types: z.ZodOptional<z.ZodArray<z.ZodEnum<["credit", "debit", "upi_collect", "upi_intent", "apple_pay", "google_pay", "amazon_pay", "klarna", "affirm", "afterpay_clearpay", "sepa", "ach"]>, "many">>;
419
+ billing_currency: z.ZodOptional<z.ZodString>;
420
+ show_saved_payment_methods: z.ZodOptional<z.ZodBoolean>;
421
+ confirm: z.ZodOptional<z.ZodBoolean>;
422
+ discount_code: z.ZodOptional<z.ZodString>;
423
+ customization: z.ZodOptional<z.ZodObject<{
424
+ theme: z.ZodOptional<z.ZodEnum<["light", "dark", "system"]>>;
425
+ show_order_details: z.ZodOptional<z.ZodBoolean>;
426
+ show_on_demand_tag: z.ZodOptional<z.ZodBoolean>;
427
+ }, "strip", z.ZodTypeAny, {
428
+ theme?: "light" | "dark" | "system" | undefined;
429
+ show_order_details?: boolean | undefined;
430
+ show_on_demand_tag?: boolean | undefined;
431
+ }, {
432
+ theme?: "light" | "dark" | "system" | undefined;
433
+ show_order_details?: boolean | undefined;
434
+ show_on_demand_tag?: boolean | undefined;
435
+ }>>;
436
+ feature_flags: z.ZodOptional<z.ZodObject<{
437
+ allow_currency_selection: z.ZodOptional<z.ZodBoolean>;
438
+ allow_discount_code: z.ZodOptional<z.ZodBoolean>;
439
+ allow_phone_number_collection: z.ZodOptional<z.ZodBoolean>;
440
+ allow_tax_id: z.ZodOptional<z.ZodBoolean>;
441
+ always_create_new_customer: z.ZodOptional<z.ZodBoolean>;
442
+ }, "strip", z.ZodTypeAny, {
443
+ allow_currency_selection?: boolean | undefined;
444
+ allow_discount_code?: boolean | undefined;
445
+ allow_phone_number_collection?: boolean | undefined;
446
+ allow_tax_id?: boolean | undefined;
447
+ always_create_new_customer?: boolean | undefined;
448
+ }, {
449
+ allow_currency_selection?: boolean | undefined;
450
+ allow_discount_code?: boolean | undefined;
451
+ allow_phone_number_collection?: boolean | undefined;
452
+ allow_tax_id?: boolean | undefined;
453
+ always_create_new_customer?: boolean | undefined;
454
+ }>>;
455
+ subscription_data: z.ZodOptional<z.ZodObject<{
456
+ trial_period_days: z.ZodOptional<z.ZodNumber>;
457
+ }, "strip", z.ZodTypeAny, {
458
+ trial_period_days?: number | undefined;
459
+ }, {
460
+ trial_period_days?: number | undefined;
461
+ }>>;
462
+ }, "strip", z.ZodTypeAny, {
463
+ product_cart?: {
464
+ quantity: number;
465
+ product_id: string;
466
+ }[] | undefined;
467
+ customer?: {
468
+ email?: string | undefined;
469
+ name?: string | undefined;
470
+ phone_number?: string | undefined;
471
+ } | undefined;
472
+ metadata?: Record<string, string> | undefined;
473
+ slug?: string | undefined;
474
+ referenceId?: string | undefined;
475
+ billing_address?: {
476
+ country: string;
477
+ city?: string | undefined;
478
+ state?: string | undefined;
479
+ street?: string | undefined;
480
+ zipcode?: string | undefined;
481
+ } | undefined;
482
+ return_url?: string | undefined;
483
+ allowed_payment_method_types?: ("credit" | "debit" | "upi_collect" | "upi_intent" | "apple_pay" | "google_pay" | "amazon_pay" | "klarna" | "affirm" | "afterpay_clearpay" | "sepa" | "ach")[] | undefined;
484
+ billing_currency?: string | undefined;
485
+ show_saved_payment_methods?: boolean | undefined;
486
+ confirm?: boolean | undefined;
487
+ discount_code?: string | undefined;
488
+ customization?: {
489
+ theme?: "light" | "dark" | "system" | undefined;
490
+ show_order_details?: boolean | undefined;
491
+ show_on_demand_tag?: boolean | undefined;
492
+ } | undefined;
493
+ feature_flags?: {
494
+ allow_currency_selection?: boolean | undefined;
495
+ allow_discount_code?: boolean | undefined;
496
+ allow_phone_number_collection?: boolean | undefined;
497
+ allow_tax_id?: boolean | undefined;
498
+ always_create_new_customer?: boolean | undefined;
499
+ } | undefined;
500
+ subscription_data?: {
501
+ trial_period_days?: number | undefined;
502
+ } | undefined;
503
+ }, {
504
+ product_cart?: {
505
+ quantity: number;
506
+ product_id: string;
507
+ }[] | undefined;
508
+ customer?: {
509
+ email?: string | undefined;
510
+ name?: string | undefined;
511
+ phone_number?: string | undefined;
512
+ } | undefined;
513
+ metadata?: Record<string, string> | undefined;
514
+ slug?: string | undefined;
515
+ referenceId?: string | undefined;
516
+ billing_address?: {
517
+ country: string;
518
+ city?: string | undefined;
519
+ state?: string | undefined;
520
+ street?: string | undefined;
521
+ zipcode?: string | undefined;
522
+ } | undefined;
523
+ return_url?: string | undefined;
524
+ allowed_payment_method_types?: ("credit" | "debit" | "upi_collect" | "upi_intent" | "apple_pay" | "google_pay" | "amazon_pay" | "klarna" | "affirm" | "afterpay_clearpay" | "sepa" | "ach")[] | undefined;
525
+ billing_currency?: string | undefined;
526
+ show_saved_payment_methods?: boolean | undefined;
527
+ confirm?: boolean | undefined;
528
+ discount_code?: string | undefined;
529
+ customization?: {
530
+ theme?: "light" | "dark" | "system" | undefined;
531
+ show_order_details?: boolean | undefined;
532
+ show_on_demand_tag?: boolean | undefined;
533
+ } | undefined;
534
+ feature_flags?: {
535
+ allow_currency_selection?: boolean | undefined;
536
+ allow_discount_code?: boolean | undefined;
537
+ allow_phone_number_collection?: boolean | undefined;
538
+ allow_tax_id?: boolean | undefined;
539
+ always_create_new_customer?: boolean | undefined;
540
+ } | undefined;
541
+ subscription_data?: {
542
+ trial_period_days?: number | undefined;
543
+ } | undefined;
544
+ }>;
545
+ requireRequest: true;
546
+ } & {
547
+ use: any[];
548
+ };
549
+ path: "/dodopayments/checkout-session";
550
+ };
551
+ };
552
+
553
+ declare const portal: () => (dodopayments: DodoPayments$1) => {
554
+ dodoPortal: {
555
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
556
+ body?: undefined;
557
+ } & {
558
+ method?: "GET" | undefined;
559
+ } & {
560
+ query?: Record<string, any> | undefined;
561
+ } & {
562
+ params?: Record<string, any>;
563
+ } & {
564
+ request?: Request;
565
+ } & {
566
+ headers?: HeadersInit;
567
+ } & {
568
+ asResponse?: boolean;
569
+ returnHeaders?: boolean;
570
+ use?: better_call.Middleware[];
571
+ path?: string;
572
+ } & {
573
+ asResponse?: AsResponse | undefined;
574
+ returnHeaders?: ReturnHeaders | undefined;
575
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
576
+ headers: Headers;
577
+ response: CustomerPortalResponse;
578
+ } : CustomerPortalResponse>;
579
+ options: {
580
+ method: "GET";
581
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
582
+ session: {
583
+ session: Record<string, any> & {
584
+ id: string;
585
+ userId: string;
586
+ expiresAt: Date;
587
+ createdAt: Date;
588
+ updatedAt: Date;
589
+ token: string;
590
+ ipAddress?: string | null | undefined;
591
+ userAgent?: string | null | undefined;
592
+ };
593
+ user: Record<string, any> & {
594
+ id: string;
595
+ email: string;
596
+ emailVerified: boolean;
597
+ name: string;
598
+ createdAt: Date;
599
+ updatedAt: Date;
600
+ image?: string | null | undefined;
601
+ };
602
+ };
603
+ }>)[];
604
+ } & {
605
+ use: any[];
606
+ };
607
+ path: "/dodopayments/customer/portal";
608
+ };
609
+ dodoSubscriptions: {
610
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
611
+ body?: undefined;
612
+ } & {
613
+ method?: "GET" | undefined;
614
+ } & {
615
+ query?: {
616
+ status?: "active" | "cancelled" | "on_hold" | "pending" | "failed" | "expired" | undefined;
617
+ page?: number | undefined;
618
+ limit?: number | undefined;
619
+ } | undefined;
620
+ } & {
621
+ params?: Record<string, any>;
622
+ } & {
623
+ request?: Request;
624
+ } & {
625
+ headers?: HeadersInit;
626
+ } & {
627
+ asResponse?: boolean;
628
+ returnHeaders?: boolean;
629
+ use?: better_call.Middleware[];
630
+ path?: string;
631
+ } & {
632
+ asResponse?: AsResponse | undefined;
633
+ returnHeaders?: ReturnHeaders | undefined;
634
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
635
+ headers: Headers;
636
+ response: SubscriptionItems;
637
+ } : SubscriptionItems>;
638
+ options: {
639
+ method: "GET";
640
+ query: z.ZodOptional<z.ZodObject<{
641
+ page: z.ZodOptional<z.ZodNumber>;
642
+ limit: z.ZodOptional<z.ZodNumber>;
643
+ status: z.ZodOptional<z.ZodEnum<["active", "cancelled", "on_hold", "pending", "failed", "expired"]>>;
644
+ }, "strip", z.ZodTypeAny, {
645
+ status?: "active" | "cancelled" | "on_hold" | "pending" | "failed" | "expired" | undefined;
646
+ page?: number | undefined;
647
+ limit?: number | undefined;
648
+ }, {
649
+ status?: "active" | "cancelled" | "on_hold" | "pending" | "failed" | "expired" | undefined;
650
+ page?: number | undefined;
651
+ limit?: number | undefined;
652
+ }>>;
653
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
654
+ session: {
655
+ session: Record<string, any> & {
656
+ id: string;
657
+ userId: string;
658
+ expiresAt: Date;
659
+ createdAt: Date;
660
+ updatedAt: Date;
661
+ token: string;
662
+ ipAddress?: string | null | undefined;
663
+ userAgent?: string | null | undefined;
664
+ };
665
+ user: Record<string, any> & {
666
+ id: string;
667
+ email: string;
668
+ emailVerified: boolean;
669
+ name: string;
670
+ createdAt: Date;
671
+ updatedAt: Date;
672
+ image?: string | null | undefined;
673
+ };
674
+ };
675
+ }>)[];
676
+ } & {
677
+ use: any[];
678
+ };
679
+ path: "/dodopayments/customer/subscriptions/list";
680
+ };
681
+ dodoPayments: {
682
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
683
+ body?: undefined;
684
+ } & {
685
+ method?: "GET" | undefined;
686
+ } & {
687
+ query?: {
688
+ 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;
689
+ page?: number | undefined;
690
+ limit?: number | undefined;
691
+ } | undefined;
692
+ } & {
693
+ params?: Record<string, any>;
694
+ } & {
695
+ request?: Request;
696
+ } & {
697
+ headers?: HeadersInit;
698
+ } & {
699
+ asResponse?: boolean;
700
+ returnHeaders?: boolean;
701
+ use?: better_call.Middleware[];
702
+ path?: string;
703
+ } & {
704
+ asResponse?: AsResponse | undefined;
705
+ returnHeaders?: ReturnHeaders | undefined;
706
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
707
+ headers: Headers;
708
+ response: PaymentItems;
709
+ } : PaymentItems>;
710
+ options: {
711
+ method: "GET";
712
+ query: z.ZodOptional<z.ZodObject<{
713
+ page: z.ZodOptional<z.ZodNumber>;
714
+ limit: z.ZodOptional<z.ZodNumber>;
715
+ 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"]>>;
716
+ }, "strip", z.ZodTypeAny, {
717
+ 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;
718
+ page?: number | undefined;
719
+ limit?: number | undefined;
720
+ }, {
721
+ 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;
722
+ page?: number | undefined;
723
+ limit?: number | undefined;
724
+ }>>;
725
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
726
+ session: {
727
+ session: Record<string, any> & {
728
+ id: string;
729
+ userId: string;
730
+ expiresAt: Date;
731
+ createdAt: Date;
732
+ updatedAt: Date;
733
+ token: string;
734
+ ipAddress?: string | null | undefined;
735
+ userAgent?: string | null | undefined;
736
+ };
737
+ user: Record<string, any> & {
738
+ id: string;
739
+ email: string;
740
+ emailVerified: boolean;
741
+ name: string;
742
+ createdAt: Date;
743
+ updatedAt: Date;
744
+ image?: string | null | undefined;
745
+ };
746
+ };
747
+ }>)[];
748
+ } & {
749
+ use: any[];
750
+ };
751
+ path: "/dodopayments/customer/payments/list";
752
+ };
753
+ };
754
+
755
+ declare const webhooks: (options: WebhookHandlerConfig) => (_dodopayments: DodoPayments$1) => {
756
+ dodopaymentsWebhooks: {
757
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
758
+ body?: undefined;
759
+ } & {
760
+ method?: "POST" | undefined;
761
+ } & {
762
+ query?: Record<string, any> | undefined;
763
+ } & {
764
+ params?: Record<string, any>;
765
+ } & {
766
+ request?: Request;
767
+ } & {
768
+ headers?: HeadersInit;
769
+ } & {
770
+ asResponse?: boolean;
771
+ returnHeaders?: boolean;
772
+ use?: better_call.Middleware[];
773
+ path?: string;
774
+ } & {
775
+ asResponse?: AsResponse | undefined;
776
+ returnHeaders?: ReturnHeaders | undefined;
777
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
778
+ headers: Headers;
779
+ response: WebhookResponse;
780
+ } : WebhookResponse>;
781
+ options: {
782
+ method: "POST";
783
+ metadata: {
784
+ isAction: boolean;
785
+ };
786
+ cloneRequest: true;
787
+ } & {
788
+ use: any[];
789
+ };
790
+ path: "/dodopayments/webhooks";
791
+ };
792
+ };
793
+
794
+ type Product = {
795
+ /**
796
+ * Product Id from DodoPayments Product
797
+ */
798
+ productId: string;
799
+ /**
800
+ * Easily identifiable slug for the product
801
+ */
802
+ slug: string;
803
+ };
804
+ type DodoPaymentsPlugin = ReturnType<typeof checkout> | ReturnType<typeof portal> | ReturnType<typeof webhooks>;
805
+ type DodoPaymentsPlugins = [DodoPaymentsPlugin, ...DodoPaymentsPlugin[]];
806
+ type DodoPaymentsEndpoints = UnionToIntersection<ReturnType<DodoPaymentsPlugin>>;
807
+ interface DodoPaymentsOptions {
808
+ /**
809
+ * DodoPayments Client
810
+ */
811
+ client: DodoPayments$1;
812
+ /**
813
+ * Enable customer creation when a user signs up
814
+ */
815
+ createCustomerOnSignUp?: boolean;
816
+ /**
817
+ * Use DodoPayments plugins
818
+ */
819
+ use: DodoPaymentsPlugins;
820
+ }
821
+ type PaymentsList = Awaited<ReturnType<DodoPayments$1["payments"]["list"]>>;
822
+ type SubscriptionsList = Awaited<ReturnType<DodoPayments$1["subscriptions"]["list"]>>;
823
+ type PaymentItems = {
824
+ items: PaymentsList["items"];
825
+ };
826
+ type SubscriptionItems = {
827
+ items: SubscriptionsList["items"];
828
+ };
829
+ type CustomerPortalResponse = {
830
+ url: string;
831
+ redirect: boolean;
832
+ };
833
+ type CreateCheckoutResponse = {
834
+ url: string;
835
+ redirect: boolean;
836
+ };
837
+ type WebhookResponse = {
838
+ received: boolean;
839
+ };
840
+
841
+ export { type CreateCheckoutResponse as C, type DodoPaymentsOptions as D, type PaymentItems as P, type SubscriptionItems as S, type WebhookResponse as W, type CustomerPortalResponse as a, type Product as b, type DodoPaymentsPlugin as c, type DodoPaymentsPlugins as d, type DodoPaymentsEndpoints as e, checkout as f, type CheckoutOptions as g, portal as p, webhooks as w };