@dodopayments/better-auth 1.3.3 → 1.3.5

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 (55) hide show
  1. package/dist/chunk-CRRND2EH.js +67 -0
  2. package/dist/chunk-CRRND2EH.js.map +1 -0
  3. package/dist/chunk-HHIXOUFD.js +80 -0
  4. package/dist/chunk-HHIXOUFD.js.map +1 -0
  5. package/dist/chunk-J55PDPLE.js +196 -0
  6. package/dist/chunk-J55PDPLE.js.map +1 -0
  7. package/dist/chunk-O3BTJOIO.js +177 -0
  8. package/dist/chunk-O3BTJOIO.js.map +1 -0
  9. package/dist/chunk-PXI4EHZC.js +12 -0
  10. package/dist/chunk-PXI4EHZC.js.map +1 -0
  11. package/dist/client.cjs +36 -0
  12. package/dist/client.cjs.map +1 -0
  13. package/dist/client.d.cts +7 -0
  14. package/dist/client.d.ts +7 -5
  15. package/dist/client.js +6 -5
  16. package/dist/client.js.map +1 -0
  17. package/dist/hooks/customer.cjs +92 -0
  18. package/dist/hooks/customer.cjs.map +1 -0
  19. package/dist/hooks/customer.d.cts +11 -0
  20. package/dist/hooks/customer.d.ts +11 -4
  21. package/dist/hooks/customer.js +8 -62
  22. package/dist/hooks/customer.js.map +1 -0
  23. package/dist/index.cjs +573 -0
  24. package/dist/index.cjs.map +1 -0
  25. package/dist/index.d.cts +909 -0
  26. package/dist/index.d.ts +321 -200
  27. package/dist/index.js +53 -34
  28. package/dist/index.js.map +1 -0
  29. package/dist/plugins/checkout.cjs +197 -0
  30. package/dist/plugins/checkout.cjs.map +1 -0
  31. package/dist/plugins/checkout.d.cts +6 -0
  32. package/dist/plugins/checkout.d.ts +6 -548
  33. package/dist/plugins/checkout.js +6 -170
  34. package/dist/plugins/checkout.js.map +1 -0
  35. package/dist/plugins/portal.cjs +220 -0
  36. package/dist/plugins/portal.cjs.map +1 -0
  37. package/dist/plugins/portal.d.cts +6 -0
  38. package/dist/plugins/portal.d.ts +6 -204
  39. package/dist/plugins/portal.js +6 -171
  40. package/dist/plugins/portal.js.map +1 -0
  41. package/dist/plugins/webhooks.cjs +102 -0
  42. package/dist/plugins/webhooks.cjs.map +1 -0
  43. package/dist/plugins/webhooks.d.cts +6 -0
  44. package/dist/plugins/webhooks.d.ts +6 -41
  45. package/dist/plugins/webhooks.js +6 -61
  46. package/dist/plugins/webhooks.js.map +1 -0
  47. package/dist/types-yAk7fHrK.d.cts +953 -0
  48. package/dist/types-yAk7fHrK.d.ts +953 -0
  49. package/dist/types.cjs +19 -0
  50. package/dist/types.cjs.map +1 -0
  51. package/dist/types.d.cts +6 -0
  52. package/dist/types.d.ts +6 -52
  53. package/dist/types.js +1 -1
  54. package/dist/types.js.map +1 -0
  55. package/package.json +5 -10
@@ -0,0 +1,953 @@
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
+ addons?: {
310
+ quantity: number;
311
+ addon_id: string;
312
+ }[] | undefined;
313
+ amount?: number | undefined;
314
+ }[] | undefined;
315
+ customer?: {
316
+ email?: string | undefined;
317
+ name?: string | undefined;
318
+ phone_number?: string | undefined;
319
+ } | {
320
+ customer_id: string;
321
+ } | undefined;
322
+ metadata?: Record<string, string> | undefined;
323
+ slug?: string | undefined;
324
+ referenceId?: string | undefined;
325
+ billing_address?: {
326
+ country: string;
327
+ city?: string | undefined;
328
+ state?: string | undefined;
329
+ street?: string | undefined;
330
+ zipcode?: string | undefined;
331
+ } | undefined;
332
+ return_url?: string | undefined;
333
+ allowed_payment_method_types?: ("credit" | "debit" | "upi_collect" | "upi_intent" | "apple_pay" | "cashapp" | "google_pay" | "multibanco" | "bancontact_card" | "eps" | "ideal" | "przelewy24" | "paypal" | "affirm" | "klarna" | "sepa" | "ach" | "amazon_pay" | "afterpay_clearpay")[] | undefined;
334
+ billing_currency?: string | undefined;
335
+ show_saved_payment_methods?: boolean | undefined;
336
+ confirm?: boolean | undefined;
337
+ discount_code?: string | undefined;
338
+ customization?: {
339
+ theme?: "light" | "dark" | "system" | undefined;
340
+ show_order_details?: boolean | undefined;
341
+ show_on_demand_tag?: boolean | undefined;
342
+ force_language?: string | undefined;
343
+ } | undefined;
344
+ feature_flags?: {
345
+ allow_currency_selection?: boolean | undefined;
346
+ allow_discount_code?: boolean | undefined;
347
+ allow_phone_number_collection?: boolean | undefined;
348
+ allow_tax_id?: boolean | undefined;
349
+ always_create_new_customer?: boolean | undefined;
350
+ } | undefined;
351
+ subscription_data?: {
352
+ trial_period_days?: number | undefined;
353
+ on_demand?: {
354
+ mandate_only: boolean;
355
+ product_price?: number | undefined;
356
+ product_currency?: string | undefined;
357
+ product_description?: string | undefined;
358
+ adaptive_currency_fees_inclusive?: boolean | undefined;
359
+ } | undefined;
360
+ } | undefined;
361
+ force_3ds?: boolean | undefined;
362
+ };
363
+ } & {
364
+ method?: "POST" | undefined;
365
+ } & {
366
+ query?: Record<string, any> | undefined;
367
+ } & {
368
+ params?: Record<string, any>;
369
+ } & {
370
+ request: Request;
371
+ } & {
372
+ headers?: HeadersInit;
373
+ } & {
374
+ asResponse?: boolean;
375
+ returnHeaders?: boolean;
376
+ use?: better_call.Middleware[];
377
+ path?: string;
378
+ } & {
379
+ asResponse?: AsResponse | undefined;
380
+ returnHeaders?: ReturnHeaders | undefined;
381
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
382
+ headers: Headers;
383
+ response: CreateCheckoutResponse;
384
+ } : CreateCheckoutResponse>;
385
+ options: {
386
+ method: "POST";
387
+ body: z.ZodObject<{
388
+ product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
389
+ product_id: z.ZodString;
390
+ quantity: z.ZodNumber;
391
+ addons: z.ZodOptional<z.ZodArray<z.ZodObject<{
392
+ addon_id: z.ZodString;
393
+ quantity: z.ZodNumber;
394
+ }, "strip", z.ZodTypeAny, {
395
+ quantity: number;
396
+ addon_id: string;
397
+ }, {
398
+ quantity: number;
399
+ addon_id: string;
400
+ }>, "many">>;
401
+ amount: z.ZodOptional<z.ZodNumber>;
402
+ }, "strip", z.ZodTypeAny, {
403
+ quantity: number;
404
+ product_id: string;
405
+ addons?: {
406
+ quantity: number;
407
+ addon_id: string;
408
+ }[] | undefined;
409
+ amount?: number | undefined;
410
+ }, {
411
+ quantity: number;
412
+ product_id: string;
413
+ addons?: {
414
+ quantity: number;
415
+ addon_id: string;
416
+ }[] | undefined;
417
+ amount?: number | undefined;
418
+ }>, "many">>;
419
+ customer: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
420
+ email: z.ZodOptional<z.ZodString>;
421
+ name: z.ZodOptional<z.ZodString>;
422
+ phone_number: z.ZodOptional<z.ZodString>;
423
+ }, "strip", z.ZodTypeAny, {
424
+ email?: string | undefined;
425
+ name?: string | undefined;
426
+ phone_number?: string | undefined;
427
+ }, {
428
+ email?: string | undefined;
429
+ name?: string | undefined;
430
+ phone_number?: string | undefined;
431
+ }>, z.ZodObject<{
432
+ customer_id: z.ZodString;
433
+ }, "strip", z.ZodTypeAny, {
434
+ customer_id: string;
435
+ }, {
436
+ customer_id: string;
437
+ }>]>>;
438
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
439
+ slug: z.ZodOptional<z.ZodString>;
440
+ referenceId: z.ZodOptional<z.ZodString>;
441
+ billing_address: z.ZodOptional<z.ZodObject<{
442
+ street: z.ZodOptional<z.ZodString>;
443
+ city: z.ZodOptional<z.ZodString>;
444
+ state: z.ZodOptional<z.ZodString>;
445
+ country: z.ZodString;
446
+ zipcode: z.ZodOptional<z.ZodString>;
447
+ }, "strip", z.ZodTypeAny, {
448
+ country: string;
449
+ city?: string | undefined;
450
+ state?: string | undefined;
451
+ street?: string | undefined;
452
+ zipcode?: string | undefined;
453
+ }, {
454
+ country: string;
455
+ city?: string | undefined;
456
+ state?: string | undefined;
457
+ street?: string | undefined;
458
+ zipcode?: string | undefined;
459
+ }>>;
460
+ return_url: z.ZodOptional<z.ZodString>;
461
+ allowed_payment_method_types: z.ZodOptional<z.ZodArray<z.ZodEnum<["credit", "debit", "upi_collect", "upi_intent", "apple_pay", "cashapp", "google_pay", "multibanco", "bancontact_card", "eps", "ideal", "przelewy24", "paypal", "affirm", "klarna", "sepa", "ach", "amazon_pay", "afterpay_clearpay"]>, "many">>;
462
+ billing_currency: z.ZodOptional<z.ZodString>;
463
+ show_saved_payment_methods: z.ZodOptional<z.ZodBoolean>;
464
+ confirm: z.ZodOptional<z.ZodBoolean>;
465
+ discount_code: z.ZodOptional<z.ZodString>;
466
+ customization: z.ZodOptional<z.ZodObject<{
467
+ theme: z.ZodOptional<z.ZodEnum<["light", "dark", "system"]>>;
468
+ show_order_details: z.ZodOptional<z.ZodBoolean>;
469
+ show_on_demand_tag: z.ZodOptional<z.ZodBoolean>;
470
+ force_language: z.ZodOptional<z.ZodString>;
471
+ }, "strip", z.ZodTypeAny, {
472
+ theme?: "light" | "dark" | "system" | undefined;
473
+ show_order_details?: boolean | undefined;
474
+ show_on_demand_tag?: boolean | undefined;
475
+ force_language?: string | undefined;
476
+ }, {
477
+ theme?: "light" | "dark" | "system" | undefined;
478
+ show_order_details?: boolean | undefined;
479
+ show_on_demand_tag?: boolean | undefined;
480
+ force_language?: string | undefined;
481
+ }>>;
482
+ feature_flags: z.ZodOptional<z.ZodObject<{
483
+ allow_currency_selection: z.ZodOptional<z.ZodBoolean>;
484
+ allow_discount_code: z.ZodOptional<z.ZodBoolean>;
485
+ allow_phone_number_collection: z.ZodOptional<z.ZodBoolean>;
486
+ allow_tax_id: z.ZodOptional<z.ZodBoolean>;
487
+ always_create_new_customer: z.ZodOptional<z.ZodBoolean>;
488
+ }, "strip", z.ZodTypeAny, {
489
+ allow_currency_selection?: boolean | undefined;
490
+ allow_discount_code?: boolean | undefined;
491
+ allow_phone_number_collection?: boolean | undefined;
492
+ allow_tax_id?: boolean | undefined;
493
+ always_create_new_customer?: boolean | undefined;
494
+ }, {
495
+ allow_currency_selection?: boolean | undefined;
496
+ allow_discount_code?: boolean | undefined;
497
+ allow_phone_number_collection?: boolean | undefined;
498
+ allow_tax_id?: boolean | undefined;
499
+ always_create_new_customer?: boolean | undefined;
500
+ }>>;
501
+ subscription_data: z.ZodOptional<z.ZodObject<{
502
+ trial_period_days: z.ZodOptional<z.ZodNumber>;
503
+ on_demand: z.ZodOptional<z.ZodObject<{
504
+ mandate_only: z.ZodBoolean;
505
+ product_price: z.ZodOptional<z.ZodNumber>;
506
+ product_currency: z.ZodOptional<z.ZodString>;
507
+ product_description: z.ZodOptional<z.ZodString>;
508
+ adaptive_currency_fees_inclusive: z.ZodOptional<z.ZodBoolean>;
509
+ }, "strip", z.ZodTypeAny, {
510
+ mandate_only: boolean;
511
+ product_price?: number | undefined;
512
+ product_currency?: string | undefined;
513
+ product_description?: string | undefined;
514
+ adaptive_currency_fees_inclusive?: boolean | undefined;
515
+ }, {
516
+ mandate_only: boolean;
517
+ product_price?: number | undefined;
518
+ product_currency?: string | undefined;
519
+ product_description?: string | undefined;
520
+ adaptive_currency_fees_inclusive?: boolean | undefined;
521
+ }>>;
522
+ }, "strip", z.ZodTypeAny, {
523
+ trial_period_days?: number | undefined;
524
+ on_demand?: {
525
+ mandate_only: boolean;
526
+ product_price?: number | undefined;
527
+ product_currency?: string | undefined;
528
+ product_description?: string | undefined;
529
+ adaptive_currency_fees_inclusive?: boolean | undefined;
530
+ } | undefined;
531
+ }, {
532
+ trial_period_days?: number | undefined;
533
+ on_demand?: {
534
+ mandate_only: boolean;
535
+ product_price?: number | undefined;
536
+ product_currency?: string | undefined;
537
+ product_description?: string | undefined;
538
+ adaptive_currency_fees_inclusive?: boolean | undefined;
539
+ } | undefined;
540
+ }>>;
541
+ force_3ds: z.ZodOptional<z.ZodBoolean>;
542
+ }, "strip", z.ZodTypeAny, {
543
+ product_cart?: {
544
+ quantity: number;
545
+ product_id: string;
546
+ addons?: {
547
+ quantity: number;
548
+ addon_id: string;
549
+ }[] | undefined;
550
+ amount?: number | undefined;
551
+ }[] | undefined;
552
+ customer?: {
553
+ email?: string | undefined;
554
+ name?: string | undefined;
555
+ phone_number?: string | undefined;
556
+ } | {
557
+ customer_id: string;
558
+ } | undefined;
559
+ metadata?: Record<string, string> | undefined;
560
+ slug?: string | undefined;
561
+ referenceId?: string | undefined;
562
+ billing_address?: {
563
+ country: string;
564
+ city?: string | undefined;
565
+ state?: string | undefined;
566
+ street?: string | undefined;
567
+ zipcode?: string | undefined;
568
+ } | undefined;
569
+ return_url?: string | undefined;
570
+ allowed_payment_method_types?: ("credit" | "debit" | "upi_collect" | "upi_intent" | "apple_pay" | "cashapp" | "google_pay" | "multibanco" | "bancontact_card" | "eps" | "ideal" | "przelewy24" | "paypal" | "affirm" | "klarna" | "sepa" | "ach" | "amazon_pay" | "afterpay_clearpay")[] | undefined;
571
+ billing_currency?: string | undefined;
572
+ show_saved_payment_methods?: boolean | undefined;
573
+ confirm?: boolean | undefined;
574
+ discount_code?: string | undefined;
575
+ customization?: {
576
+ theme?: "light" | "dark" | "system" | undefined;
577
+ show_order_details?: boolean | undefined;
578
+ show_on_demand_tag?: boolean | undefined;
579
+ force_language?: string | undefined;
580
+ } | undefined;
581
+ feature_flags?: {
582
+ allow_currency_selection?: boolean | undefined;
583
+ allow_discount_code?: boolean | undefined;
584
+ allow_phone_number_collection?: boolean | undefined;
585
+ allow_tax_id?: boolean | undefined;
586
+ always_create_new_customer?: boolean | undefined;
587
+ } | undefined;
588
+ subscription_data?: {
589
+ trial_period_days?: number | undefined;
590
+ on_demand?: {
591
+ mandate_only: boolean;
592
+ product_price?: number | undefined;
593
+ product_currency?: string | undefined;
594
+ product_description?: string | undefined;
595
+ adaptive_currency_fees_inclusive?: boolean | undefined;
596
+ } | undefined;
597
+ } | undefined;
598
+ force_3ds?: boolean | undefined;
599
+ }, {
600
+ product_cart?: {
601
+ quantity: number;
602
+ product_id: string;
603
+ addons?: {
604
+ quantity: number;
605
+ addon_id: string;
606
+ }[] | undefined;
607
+ amount?: number | undefined;
608
+ }[] | undefined;
609
+ customer?: {
610
+ email?: string | undefined;
611
+ name?: string | undefined;
612
+ phone_number?: string | undefined;
613
+ } | {
614
+ customer_id: string;
615
+ } | undefined;
616
+ metadata?: Record<string, string> | undefined;
617
+ slug?: string | undefined;
618
+ referenceId?: string | undefined;
619
+ billing_address?: {
620
+ country: string;
621
+ city?: string | undefined;
622
+ state?: string | undefined;
623
+ street?: string | undefined;
624
+ zipcode?: string | undefined;
625
+ } | undefined;
626
+ return_url?: string | undefined;
627
+ allowed_payment_method_types?: ("credit" | "debit" | "upi_collect" | "upi_intent" | "apple_pay" | "cashapp" | "google_pay" | "multibanco" | "bancontact_card" | "eps" | "ideal" | "przelewy24" | "paypal" | "affirm" | "klarna" | "sepa" | "ach" | "amazon_pay" | "afterpay_clearpay")[] | undefined;
628
+ billing_currency?: string | undefined;
629
+ show_saved_payment_methods?: boolean | undefined;
630
+ confirm?: boolean | undefined;
631
+ discount_code?: string | undefined;
632
+ customization?: {
633
+ theme?: "light" | "dark" | "system" | undefined;
634
+ show_order_details?: boolean | undefined;
635
+ show_on_demand_tag?: boolean | undefined;
636
+ force_language?: string | undefined;
637
+ } | undefined;
638
+ feature_flags?: {
639
+ allow_currency_selection?: boolean | undefined;
640
+ allow_discount_code?: boolean | undefined;
641
+ allow_phone_number_collection?: boolean | undefined;
642
+ allow_tax_id?: boolean | undefined;
643
+ always_create_new_customer?: boolean | undefined;
644
+ } | undefined;
645
+ subscription_data?: {
646
+ trial_period_days?: number | undefined;
647
+ on_demand?: {
648
+ mandate_only: boolean;
649
+ product_price?: number | undefined;
650
+ product_currency?: string | undefined;
651
+ product_description?: string | undefined;
652
+ adaptive_currency_fees_inclusive?: boolean | undefined;
653
+ } | undefined;
654
+ } | undefined;
655
+ force_3ds?: boolean | undefined;
656
+ }>;
657
+ requireRequest: true;
658
+ } & {
659
+ use: any[];
660
+ };
661
+ path: "/dodopayments/checkout-session";
662
+ };
663
+ };
664
+
665
+ declare const portal: () => (dodopayments: DodoPayments$1) => {
666
+ dodoPortal: {
667
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
668
+ body?: undefined;
669
+ } & {
670
+ method?: "GET" | 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
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
688
+ headers: Headers;
689
+ response: CustomerPortalResponse;
690
+ } : CustomerPortalResponse>;
691
+ options: {
692
+ method: "GET";
693
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
694
+ session: {
695
+ session: Record<string, any> & {
696
+ id: string;
697
+ userId: string;
698
+ expiresAt: Date;
699
+ createdAt: Date;
700
+ updatedAt: Date;
701
+ token: string;
702
+ ipAddress?: string | null | undefined;
703
+ userAgent?: string | null | undefined;
704
+ };
705
+ user: Record<string, any> & {
706
+ id: string;
707
+ email: string;
708
+ emailVerified: boolean;
709
+ name: string;
710
+ createdAt: Date;
711
+ updatedAt: Date;
712
+ image?: string | null | undefined;
713
+ };
714
+ };
715
+ }>)[];
716
+ } & {
717
+ use: any[];
718
+ };
719
+ path: "/dodopayments/customer/portal";
720
+ };
721
+ dodoSubscriptions: {
722
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
723
+ body?: undefined;
724
+ } & {
725
+ method?: "GET" | undefined;
726
+ } & {
727
+ query?: {
728
+ status?: "active" | "cancelled" | "on_hold" | "pending" | "failed" | "expired" | undefined;
729
+ page?: number | undefined;
730
+ limit?: number | undefined;
731
+ } | undefined;
732
+ } & {
733
+ params?: Record<string, any>;
734
+ } & {
735
+ request?: Request;
736
+ } & {
737
+ headers?: HeadersInit;
738
+ } & {
739
+ asResponse?: boolean;
740
+ returnHeaders?: boolean;
741
+ use?: better_call.Middleware[];
742
+ path?: string;
743
+ } & {
744
+ asResponse?: AsResponse | undefined;
745
+ returnHeaders?: ReturnHeaders | undefined;
746
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
747
+ headers: Headers;
748
+ response: SubscriptionItems;
749
+ } : SubscriptionItems>;
750
+ options: {
751
+ method: "GET";
752
+ query: z.ZodOptional<z.ZodObject<{
753
+ page: z.ZodOptional<z.ZodNumber>;
754
+ limit: z.ZodOptional<z.ZodNumber>;
755
+ status: z.ZodOptional<z.ZodEnum<["active", "cancelled", "on_hold", "pending", "failed", "expired"]>>;
756
+ }, "strip", z.ZodTypeAny, {
757
+ status?: "active" | "cancelled" | "on_hold" | "pending" | "failed" | "expired" | undefined;
758
+ page?: number | undefined;
759
+ limit?: number | undefined;
760
+ }, {
761
+ status?: "active" | "cancelled" | "on_hold" | "pending" | "failed" | "expired" | undefined;
762
+ page?: number | undefined;
763
+ limit?: number | undefined;
764
+ }>>;
765
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
766
+ session: {
767
+ session: Record<string, any> & {
768
+ id: string;
769
+ userId: string;
770
+ expiresAt: Date;
771
+ createdAt: Date;
772
+ updatedAt: Date;
773
+ token: string;
774
+ ipAddress?: string | null | undefined;
775
+ userAgent?: string | null | undefined;
776
+ };
777
+ user: Record<string, any> & {
778
+ id: string;
779
+ email: string;
780
+ emailVerified: boolean;
781
+ name: string;
782
+ createdAt: Date;
783
+ updatedAt: Date;
784
+ image?: string | null | undefined;
785
+ };
786
+ };
787
+ }>)[];
788
+ } & {
789
+ use: any[];
790
+ };
791
+ path: "/dodopayments/customer/subscriptions/list";
792
+ };
793
+ dodoPayments: {
794
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
795
+ body?: undefined;
796
+ } & {
797
+ method?: "GET" | undefined;
798
+ } & {
799
+ query?: {
800
+ 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;
801
+ page?: number | undefined;
802
+ limit?: number | undefined;
803
+ } | undefined;
804
+ } & {
805
+ params?: Record<string, any>;
806
+ } & {
807
+ request?: Request;
808
+ } & {
809
+ headers?: HeadersInit;
810
+ } & {
811
+ asResponse?: boolean;
812
+ returnHeaders?: boolean;
813
+ use?: better_call.Middleware[];
814
+ path?: string;
815
+ } & {
816
+ asResponse?: AsResponse | undefined;
817
+ returnHeaders?: ReturnHeaders | undefined;
818
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
819
+ headers: Headers;
820
+ response: PaymentItems;
821
+ } : PaymentItems>;
822
+ options: {
823
+ method: "GET";
824
+ query: z.ZodOptional<z.ZodObject<{
825
+ page: z.ZodOptional<z.ZodNumber>;
826
+ limit: z.ZodOptional<z.ZodNumber>;
827
+ 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"]>>;
828
+ }, "strip", z.ZodTypeAny, {
829
+ 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;
830
+ page?: number | undefined;
831
+ limit?: number | undefined;
832
+ }, {
833
+ 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;
834
+ page?: number | undefined;
835
+ limit?: number | undefined;
836
+ }>>;
837
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
838
+ session: {
839
+ session: Record<string, any> & {
840
+ id: string;
841
+ userId: string;
842
+ expiresAt: Date;
843
+ createdAt: Date;
844
+ updatedAt: Date;
845
+ token: string;
846
+ ipAddress?: string | null | undefined;
847
+ userAgent?: string | null | undefined;
848
+ };
849
+ user: Record<string, any> & {
850
+ id: string;
851
+ email: string;
852
+ emailVerified: boolean;
853
+ name: string;
854
+ createdAt: Date;
855
+ updatedAt: Date;
856
+ image?: string | null | undefined;
857
+ };
858
+ };
859
+ }>)[];
860
+ } & {
861
+ use: any[];
862
+ };
863
+ path: "/dodopayments/customer/payments/list";
864
+ };
865
+ };
866
+
867
+ declare const webhooks: (options: WebhookHandlerConfig) => (_dodopayments: DodoPayments$1) => {
868
+ dodopaymentsWebhooks: {
869
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
870
+ body?: undefined;
871
+ } & {
872
+ method?: "POST" | undefined;
873
+ } & {
874
+ query?: Record<string, any> | undefined;
875
+ } & {
876
+ params?: Record<string, any>;
877
+ } & {
878
+ request?: Request;
879
+ } & {
880
+ headers?: HeadersInit;
881
+ } & {
882
+ asResponse?: boolean;
883
+ returnHeaders?: boolean;
884
+ use?: better_call.Middleware[];
885
+ path?: string;
886
+ } & {
887
+ asResponse?: AsResponse | undefined;
888
+ returnHeaders?: ReturnHeaders | undefined;
889
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
890
+ headers: Headers;
891
+ response: WebhookResponse;
892
+ } : WebhookResponse>;
893
+ options: {
894
+ method: "POST";
895
+ metadata: {
896
+ isAction: boolean;
897
+ };
898
+ cloneRequest: true;
899
+ } & {
900
+ use: any[];
901
+ };
902
+ path: "/dodopayments/webhooks";
903
+ };
904
+ };
905
+
906
+ type Product = {
907
+ /**
908
+ * Product Id from DodoPayments Product
909
+ */
910
+ productId: string;
911
+ /**
912
+ * Easily identifiable slug for the product
913
+ */
914
+ slug: string;
915
+ };
916
+ type DodoPaymentsPlugin = ReturnType<typeof checkout> | ReturnType<typeof portal> | ReturnType<typeof webhooks>;
917
+ type DodoPaymentsPlugins = [DodoPaymentsPlugin, ...DodoPaymentsPlugin[]];
918
+ type DodoPaymentsEndpoints = UnionToIntersection<ReturnType<DodoPaymentsPlugin>>;
919
+ interface DodoPaymentsOptions {
920
+ /**
921
+ * DodoPayments Client
922
+ */
923
+ client: DodoPayments$1;
924
+ /**
925
+ * Enable customer creation when a user signs up
926
+ */
927
+ createCustomerOnSignUp?: boolean;
928
+ /**
929
+ * Use DodoPayments plugins
930
+ */
931
+ use: DodoPaymentsPlugins;
932
+ }
933
+ type PaymentsList = Awaited<ReturnType<DodoPayments$1["payments"]["list"]>>;
934
+ type SubscriptionsList = Awaited<ReturnType<DodoPayments$1["subscriptions"]["list"]>>;
935
+ type PaymentItems = {
936
+ items: PaymentsList["items"];
937
+ };
938
+ type SubscriptionItems = {
939
+ items: SubscriptionsList["items"];
940
+ };
941
+ type CustomerPortalResponse = {
942
+ url: string;
943
+ redirect: boolean;
944
+ };
945
+ type CreateCheckoutResponse = {
946
+ url: string;
947
+ redirect: boolean;
948
+ };
949
+ type WebhookResponse = {
950
+ received: boolean;
951
+ };
952
+
953
+ 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 };