@dodopayments/better-auth 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,996 +0,0 @@
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
- import { usage } from './plugins/usage.js';
7
-
8
- interface CheckoutOptions {
9
- /**
10
- * Optional list of slug -> productId mappings for easy slug checkouts
11
- */
12
- products?: Product[] | (() => Promise<Product[]>);
13
- /**
14
- * Checkout Success URL
15
- */
16
- successUrl?: string;
17
- /**
18
- * Only allow authenticated customers to checkout
19
- */
20
- authenticatedUsersOnly?: boolean;
21
- }
22
- declare const checkout: (checkoutOptions?: CheckoutOptions) => (dodopayments: DodoPayments) => {
23
- /**
24
- * @deprecated
25
- */
26
- dodoCheckout: {
27
- <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
28
- body: z.objectInputType<{
29
- product_id: z.ZodOptional<z.ZodString>;
30
- quantity: z.ZodOptional<z.ZodNumber>;
31
- product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
32
- product_id: z.ZodString;
33
- quantity: z.ZodNumber;
34
- }, "strip", z.ZodTypeAny, {
35
- quantity: number;
36
- product_id: string;
37
- }, {
38
- quantity: number;
39
- product_id: string;
40
- }>, "many">>;
41
- billing: z.ZodObject<{
42
- city: z.ZodString;
43
- country: z.ZodString;
44
- state: z.ZodString;
45
- street: z.ZodString;
46
- zipcode: z.ZodString;
47
- }, "strip", z.ZodTypeAny, {
48
- country: string;
49
- city: string;
50
- state: string;
51
- street: string;
52
- zipcode: string;
53
- }, {
54
- country: string;
55
- city: string;
56
- state: string;
57
- street: string;
58
- zipcode: string;
59
- }>;
60
- customer: z.ZodObject<{
61
- customer_id: z.ZodOptional<z.ZodString>;
62
- email: z.ZodOptional<z.ZodString>;
63
- name: z.ZodOptional<z.ZodString>;
64
- }, "strip", z.ZodTypeAny, {
65
- email?: string | undefined;
66
- customer_id?: string | undefined;
67
- name?: string | undefined;
68
- }, {
69
- email?: string | undefined;
70
- customer_id?: string | undefined;
71
- name?: string | undefined;
72
- }>;
73
- discount_id: z.ZodOptional<z.ZodString>;
74
- addons: z.ZodOptional<z.ZodArray<z.ZodObject<{
75
- addon_id: z.ZodString;
76
- quantity: z.ZodNumber;
77
- }, "strip", z.ZodTypeAny, {
78
- quantity: number;
79
- addon_id: string;
80
- }, {
81
- quantity: number;
82
- addon_id: string;
83
- }>, "many">>;
84
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
85
- currency: z.ZodOptional<z.ZodString>;
86
- } & {
87
- slug: z.ZodOptional<z.ZodString>;
88
- referenceId: z.ZodOptional<z.ZodString>;
89
- }, z.ZodUnknown, "strip">;
90
- } & {
91
- method?: "POST" | undefined;
92
- } & {
93
- query?: Record<string, any> | undefined;
94
- } & {
95
- params?: Record<string, any>;
96
- } & {
97
- request: Request;
98
- } & {
99
- headers?: HeadersInit;
100
- } & {
101
- asResponse?: boolean;
102
- returnHeaders?: boolean;
103
- use?: better_call.Middleware[];
104
- path?: string;
105
- } & {
106
- asResponse?: AsResponse | undefined;
107
- returnHeaders?: ReturnHeaders | undefined;
108
- }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
109
- headers: Headers;
110
- response: CreateCheckoutResponse;
111
- } : CreateCheckoutResponse>;
112
- options: {
113
- method: "POST";
114
- body: z.ZodObject<{
115
- product_id: z.ZodOptional<z.ZodString>;
116
- quantity: z.ZodOptional<z.ZodNumber>;
117
- product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
118
- product_id: z.ZodString;
119
- quantity: z.ZodNumber;
120
- }, "strip", z.ZodTypeAny, {
121
- quantity: number;
122
- product_id: string;
123
- }, {
124
- quantity: number;
125
- product_id: string;
126
- }>, "many">>;
127
- billing: z.ZodObject<{
128
- city: z.ZodString;
129
- country: z.ZodString;
130
- state: z.ZodString;
131
- street: z.ZodString;
132
- zipcode: z.ZodString;
133
- }, "strip", z.ZodTypeAny, {
134
- country: string;
135
- city: string;
136
- state: string;
137
- street: string;
138
- zipcode: string;
139
- }, {
140
- country: string;
141
- city: string;
142
- state: string;
143
- street: string;
144
- zipcode: string;
145
- }>;
146
- customer: z.ZodObject<{
147
- customer_id: z.ZodOptional<z.ZodString>;
148
- email: z.ZodOptional<z.ZodString>;
149
- name: z.ZodOptional<z.ZodString>;
150
- }, "strip", z.ZodTypeAny, {
151
- email?: string | undefined;
152
- customer_id?: string | undefined;
153
- name?: string | undefined;
154
- }, {
155
- email?: string | undefined;
156
- customer_id?: string | undefined;
157
- name?: string | undefined;
158
- }>;
159
- discount_id: z.ZodOptional<z.ZodString>;
160
- addons: z.ZodOptional<z.ZodArray<z.ZodObject<{
161
- addon_id: z.ZodString;
162
- quantity: z.ZodNumber;
163
- }, "strip", z.ZodTypeAny, {
164
- quantity: number;
165
- addon_id: string;
166
- }, {
167
- quantity: number;
168
- addon_id: string;
169
- }>, "many">>;
170
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
171
- currency: z.ZodOptional<z.ZodString>;
172
- } & {
173
- slug: z.ZodOptional<z.ZodString>;
174
- referenceId: z.ZodOptional<z.ZodString>;
175
- }, "strip", z.ZodUnknown, z.objectOutputType<{
176
- product_id: z.ZodOptional<z.ZodString>;
177
- quantity: z.ZodOptional<z.ZodNumber>;
178
- product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
179
- product_id: z.ZodString;
180
- quantity: z.ZodNumber;
181
- }, "strip", z.ZodTypeAny, {
182
- quantity: number;
183
- product_id: string;
184
- }, {
185
- quantity: number;
186
- product_id: string;
187
- }>, "many">>;
188
- billing: z.ZodObject<{
189
- city: z.ZodString;
190
- country: z.ZodString;
191
- state: z.ZodString;
192
- street: z.ZodString;
193
- zipcode: z.ZodString;
194
- }, "strip", z.ZodTypeAny, {
195
- country: string;
196
- city: string;
197
- state: string;
198
- street: string;
199
- zipcode: string;
200
- }, {
201
- country: string;
202
- city: string;
203
- state: string;
204
- street: string;
205
- zipcode: string;
206
- }>;
207
- customer: z.ZodObject<{
208
- customer_id: z.ZodOptional<z.ZodString>;
209
- email: z.ZodOptional<z.ZodString>;
210
- name: z.ZodOptional<z.ZodString>;
211
- }, "strip", z.ZodTypeAny, {
212
- email?: string | undefined;
213
- customer_id?: string | undefined;
214
- name?: string | undefined;
215
- }, {
216
- email?: string | undefined;
217
- customer_id?: string | undefined;
218
- name?: string | undefined;
219
- }>;
220
- discount_id: z.ZodOptional<z.ZodString>;
221
- addons: z.ZodOptional<z.ZodArray<z.ZodObject<{
222
- addon_id: z.ZodString;
223
- quantity: z.ZodNumber;
224
- }, "strip", z.ZodTypeAny, {
225
- quantity: number;
226
- addon_id: string;
227
- }, {
228
- quantity: number;
229
- addon_id: string;
230
- }>, "many">>;
231
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
232
- currency: z.ZodOptional<z.ZodString>;
233
- } & {
234
- slug: z.ZodOptional<z.ZodString>;
235
- referenceId: z.ZodOptional<z.ZodString>;
236
- }, z.ZodUnknown, "strip">, z.objectInputType<{
237
- product_id: z.ZodOptional<z.ZodString>;
238
- quantity: z.ZodOptional<z.ZodNumber>;
239
- product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
240
- product_id: z.ZodString;
241
- quantity: z.ZodNumber;
242
- }, "strip", z.ZodTypeAny, {
243
- quantity: number;
244
- product_id: string;
245
- }, {
246
- quantity: number;
247
- product_id: string;
248
- }>, "many">>;
249
- billing: z.ZodObject<{
250
- city: z.ZodString;
251
- country: z.ZodString;
252
- state: z.ZodString;
253
- street: z.ZodString;
254
- zipcode: z.ZodString;
255
- }, "strip", z.ZodTypeAny, {
256
- country: string;
257
- city: string;
258
- state: string;
259
- street: string;
260
- zipcode: string;
261
- }, {
262
- country: string;
263
- city: string;
264
- state: string;
265
- street: string;
266
- zipcode: string;
267
- }>;
268
- customer: z.ZodObject<{
269
- customer_id: z.ZodOptional<z.ZodString>;
270
- email: z.ZodOptional<z.ZodString>;
271
- name: z.ZodOptional<z.ZodString>;
272
- }, "strip", z.ZodTypeAny, {
273
- email?: string | undefined;
274
- customer_id?: string | undefined;
275
- name?: string | undefined;
276
- }, {
277
- email?: string | undefined;
278
- customer_id?: string | undefined;
279
- name?: string | undefined;
280
- }>;
281
- discount_id: z.ZodOptional<z.ZodString>;
282
- addons: z.ZodOptional<z.ZodArray<z.ZodObject<{
283
- addon_id: z.ZodString;
284
- quantity: z.ZodNumber;
285
- }, "strip", z.ZodTypeAny, {
286
- quantity: number;
287
- addon_id: string;
288
- }, {
289
- quantity: number;
290
- addon_id: string;
291
- }>, "many">>;
292
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
293
- currency: z.ZodOptional<z.ZodString>;
294
- } & {
295
- slug: z.ZodOptional<z.ZodString>;
296
- referenceId: z.ZodOptional<z.ZodString>;
297
- }, z.ZodUnknown, "strip">>;
298
- requireRequest: true;
299
- } & {
300
- use: any[];
301
- };
302
- path: "/dodopayments/checkout";
303
- };
304
- dodoCheckoutSession: {
305
- <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
306
- body: {
307
- product_cart?: {
308
- quantity: number;
309
- product_id: string;
310
- addons?: {
311
- quantity: number;
312
- addon_id: string;
313
- }[] | undefined;
314
- amount?: number | undefined;
315
- }[] | undefined;
316
- customer?: {
317
- email: string;
318
- name?: string | undefined;
319
- phone_number?: string | undefined;
320
- } | {
321
- customer_id: string;
322
- } | undefined;
323
- metadata?: Record<string, string> | undefined;
324
- slug?: string | undefined;
325
- referenceId?: string | undefined;
326
- billing_address?: {
327
- country: string;
328
- city?: string | undefined;
329
- state?: string | undefined;
330
- street?: string | undefined;
331
- zipcode?: string | undefined;
332
- } | undefined;
333
- return_url?: string | undefined;
334
- 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;
335
- billing_currency?: string | undefined;
336
- show_saved_payment_methods?: boolean | undefined;
337
- confirm?: boolean | undefined;
338
- discount_code?: string | undefined;
339
- customization?: {
340
- theme?: "light" | "dark" | "system" | undefined;
341
- show_order_details?: boolean | undefined;
342
- show_on_demand_tag?: boolean | undefined;
343
- force_language?: string | undefined;
344
- } | undefined;
345
- feature_flags?: {
346
- allow_currency_selection?: boolean | undefined;
347
- allow_customer_editing_city?: boolean | undefined;
348
- allow_customer_editing_country?: boolean | undefined;
349
- allow_customer_editing_email?: boolean | undefined;
350
- allow_customer_editing_name?: boolean | undefined;
351
- allow_customer_editing_state?: boolean | undefined;
352
- allow_customer_editing_street?: boolean | undefined;
353
- allow_customer_editing_zipcode?: boolean | undefined;
354
- allow_discount_code?: boolean | undefined;
355
- allow_phone_number_collection?: boolean | undefined;
356
- allow_tax_id?: boolean | undefined;
357
- always_create_new_customer?: boolean | undefined;
358
- } | undefined;
359
- subscription_data?: {
360
- trial_period_days?: number | undefined;
361
- on_demand?: {
362
- mandate_only: boolean;
363
- product_price?: number | undefined;
364
- product_currency?: string | undefined;
365
- product_description?: string | undefined;
366
- adaptive_currency_fees_inclusive?: boolean | undefined;
367
- } | undefined;
368
- } | undefined;
369
- force_3ds?: boolean | undefined;
370
- };
371
- } & {
372
- method?: "POST" | undefined;
373
- } & {
374
- query?: Record<string, any> | undefined;
375
- } & {
376
- params?: Record<string, any>;
377
- } & {
378
- request: Request;
379
- } & {
380
- headers?: HeadersInit;
381
- } & {
382
- asResponse?: boolean;
383
- returnHeaders?: boolean;
384
- use?: better_call.Middleware[];
385
- path?: string;
386
- } & {
387
- asResponse?: AsResponse | undefined;
388
- returnHeaders?: ReturnHeaders | undefined;
389
- }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
390
- headers: Headers;
391
- response: CreateCheckoutResponse;
392
- } : CreateCheckoutResponse>;
393
- options: {
394
- method: "POST";
395
- body: z.ZodObject<{
396
- product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
397
- product_id: z.ZodString;
398
- quantity: z.ZodNumber;
399
- addons: z.ZodOptional<z.ZodArray<z.ZodObject<{
400
- addon_id: z.ZodString;
401
- quantity: z.ZodNumber;
402
- }, "strip", z.ZodTypeAny, {
403
- quantity: number;
404
- addon_id: string;
405
- }, {
406
- quantity: number;
407
- addon_id: string;
408
- }>, "many">>;
409
- amount: z.ZodOptional<z.ZodNumber>;
410
- }, "strip", z.ZodTypeAny, {
411
- quantity: number;
412
- product_id: string;
413
- addons?: {
414
- quantity: number;
415
- addon_id: string;
416
- }[] | undefined;
417
- amount?: number | undefined;
418
- }, {
419
- quantity: number;
420
- product_id: string;
421
- addons?: {
422
- quantity: number;
423
- addon_id: string;
424
- }[] | undefined;
425
- amount?: number | undefined;
426
- }>, "many">>;
427
- customer: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
428
- email: z.ZodString;
429
- name: z.ZodOptional<z.ZodString>;
430
- phone_number: z.ZodOptional<z.ZodString>;
431
- }, "strip", z.ZodTypeAny, {
432
- email: string;
433
- name?: string | undefined;
434
- phone_number?: string | undefined;
435
- }, {
436
- email: string;
437
- name?: string | undefined;
438
- phone_number?: string | undefined;
439
- }>, z.ZodObject<{
440
- customer_id: z.ZodString;
441
- }, "strip", z.ZodTypeAny, {
442
- customer_id: string;
443
- }, {
444
- customer_id: string;
445
- }>]>>;
446
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
447
- slug: z.ZodOptional<z.ZodString>;
448
- referenceId: z.ZodOptional<z.ZodString>;
449
- billing_address: z.ZodOptional<z.ZodObject<{
450
- street: z.ZodOptional<z.ZodString>;
451
- city: z.ZodOptional<z.ZodString>;
452
- state: z.ZodOptional<z.ZodString>;
453
- country: z.ZodString;
454
- zipcode: z.ZodOptional<z.ZodString>;
455
- }, "strip", z.ZodTypeAny, {
456
- country: string;
457
- city?: string | undefined;
458
- state?: string | undefined;
459
- street?: string | undefined;
460
- zipcode?: string | undefined;
461
- }, {
462
- country: string;
463
- city?: string | undefined;
464
- state?: string | undefined;
465
- street?: string | undefined;
466
- zipcode?: string | undefined;
467
- }>>;
468
- return_url: z.ZodOptional<z.ZodString>;
469
- 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">>;
470
- billing_currency: z.ZodOptional<z.ZodString>;
471
- show_saved_payment_methods: z.ZodOptional<z.ZodBoolean>;
472
- confirm: z.ZodOptional<z.ZodBoolean>;
473
- discount_code: z.ZodOptional<z.ZodString>;
474
- customization: z.ZodOptional<z.ZodObject<{
475
- theme: z.ZodOptional<z.ZodEnum<["light", "dark", "system"]>>;
476
- show_order_details: z.ZodOptional<z.ZodBoolean>;
477
- show_on_demand_tag: z.ZodOptional<z.ZodBoolean>;
478
- force_language: z.ZodOptional<z.ZodString>;
479
- }, "strip", z.ZodTypeAny, {
480
- theme?: "light" | "dark" | "system" | undefined;
481
- show_order_details?: boolean | undefined;
482
- show_on_demand_tag?: boolean | undefined;
483
- force_language?: string | undefined;
484
- }, {
485
- theme?: "light" | "dark" | "system" | undefined;
486
- show_order_details?: boolean | undefined;
487
- show_on_demand_tag?: boolean | undefined;
488
- force_language?: string | undefined;
489
- }>>;
490
- feature_flags: z.ZodOptional<z.ZodObject<{
491
- allow_currency_selection: z.ZodOptional<z.ZodBoolean>;
492
- allow_customer_editing_city: z.ZodOptional<z.ZodBoolean>;
493
- allow_customer_editing_country: z.ZodOptional<z.ZodBoolean>;
494
- allow_customer_editing_email: z.ZodOptional<z.ZodBoolean>;
495
- allow_customer_editing_name: z.ZodOptional<z.ZodBoolean>;
496
- allow_customer_editing_state: z.ZodOptional<z.ZodBoolean>;
497
- allow_customer_editing_street: z.ZodOptional<z.ZodBoolean>;
498
- allow_customer_editing_zipcode: z.ZodOptional<z.ZodBoolean>;
499
- allow_discount_code: z.ZodOptional<z.ZodBoolean>;
500
- allow_phone_number_collection: z.ZodOptional<z.ZodBoolean>;
501
- allow_tax_id: z.ZodOptional<z.ZodBoolean>;
502
- always_create_new_customer: z.ZodOptional<z.ZodBoolean>;
503
- }, "strip", z.ZodTypeAny, {
504
- allow_currency_selection?: boolean | undefined;
505
- allow_customer_editing_city?: boolean | undefined;
506
- allow_customer_editing_country?: boolean | undefined;
507
- allow_customer_editing_email?: boolean | undefined;
508
- allow_customer_editing_name?: boolean | undefined;
509
- allow_customer_editing_state?: boolean | undefined;
510
- allow_customer_editing_street?: boolean | undefined;
511
- allow_customer_editing_zipcode?: boolean | undefined;
512
- allow_discount_code?: boolean | undefined;
513
- allow_phone_number_collection?: boolean | undefined;
514
- allow_tax_id?: boolean | undefined;
515
- always_create_new_customer?: boolean | undefined;
516
- }, {
517
- allow_currency_selection?: boolean | undefined;
518
- allow_customer_editing_city?: boolean | undefined;
519
- allow_customer_editing_country?: boolean | undefined;
520
- allow_customer_editing_email?: boolean | undefined;
521
- allow_customer_editing_name?: boolean | undefined;
522
- allow_customer_editing_state?: boolean | undefined;
523
- allow_customer_editing_street?: boolean | undefined;
524
- allow_customer_editing_zipcode?: boolean | undefined;
525
- allow_discount_code?: boolean | undefined;
526
- allow_phone_number_collection?: boolean | undefined;
527
- allow_tax_id?: boolean | undefined;
528
- always_create_new_customer?: boolean | undefined;
529
- }>>;
530
- subscription_data: z.ZodOptional<z.ZodObject<{
531
- trial_period_days: z.ZodOptional<z.ZodNumber>;
532
- on_demand: z.ZodOptional<z.ZodObject<{
533
- mandate_only: z.ZodBoolean;
534
- product_price: z.ZodOptional<z.ZodNumber>;
535
- product_currency: z.ZodOptional<z.ZodString>;
536
- product_description: z.ZodOptional<z.ZodString>;
537
- adaptive_currency_fees_inclusive: z.ZodOptional<z.ZodBoolean>;
538
- }, "strip", z.ZodTypeAny, {
539
- mandate_only: boolean;
540
- product_price?: number | undefined;
541
- product_currency?: string | undefined;
542
- product_description?: string | undefined;
543
- adaptive_currency_fees_inclusive?: boolean | undefined;
544
- }, {
545
- mandate_only: boolean;
546
- product_price?: number | undefined;
547
- product_currency?: string | undefined;
548
- product_description?: string | undefined;
549
- adaptive_currency_fees_inclusive?: boolean | undefined;
550
- }>>;
551
- }, "strip", z.ZodTypeAny, {
552
- trial_period_days?: number | undefined;
553
- on_demand?: {
554
- mandate_only: boolean;
555
- product_price?: number | undefined;
556
- product_currency?: string | undefined;
557
- product_description?: string | undefined;
558
- adaptive_currency_fees_inclusive?: boolean | undefined;
559
- } | undefined;
560
- }, {
561
- trial_period_days?: number | undefined;
562
- on_demand?: {
563
- mandate_only: boolean;
564
- product_price?: number | undefined;
565
- product_currency?: string | undefined;
566
- product_description?: string | undefined;
567
- adaptive_currency_fees_inclusive?: boolean | undefined;
568
- } | undefined;
569
- }>>;
570
- force_3ds: z.ZodOptional<z.ZodBoolean>;
571
- }, "strip", z.ZodTypeAny, {
572
- product_cart?: {
573
- quantity: number;
574
- product_id: string;
575
- addons?: {
576
- quantity: number;
577
- addon_id: string;
578
- }[] | undefined;
579
- amount?: number | undefined;
580
- }[] | undefined;
581
- customer?: {
582
- email: string;
583
- name?: string | undefined;
584
- phone_number?: string | undefined;
585
- } | {
586
- customer_id: string;
587
- } | undefined;
588
- metadata?: Record<string, string> | undefined;
589
- slug?: string | undefined;
590
- referenceId?: string | undefined;
591
- billing_address?: {
592
- country: string;
593
- city?: string | undefined;
594
- state?: string | undefined;
595
- street?: string | undefined;
596
- zipcode?: string | undefined;
597
- } | undefined;
598
- return_url?: string | undefined;
599
- 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;
600
- billing_currency?: string | undefined;
601
- show_saved_payment_methods?: boolean | undefined;
602
- confirm?: boolean | undefined;
603
- discount_code?: string | undefined;
604
- customization?: {
605
- theme?: "light" | "dark" | "system" | undefined;
606
- show_order_details?: boolean | undefined;
607
- show_on_demand_tag?: boolean | undefined;
608
- force_language?: string | undefined;
609
- } | undefined;
610
- feature_flags?: {
611
- allow_currency_selection?: boolean | undefined;
612
- allow_customer_editing_city?: boolean | undefined;
613
- allow_customer_editing_country?: boolean | undefined;
614
- allow_customer_editing_email?: boolean | undefined;
615
- allow_customer_editing_name?: boolean | undefined;
616
- allow_customer_editing_state?: boolean | undefined;
617
- allow_customer_editing_street?: boolean | undefined;
618
- allow_customer_editing_zipcode?: boolean | undefined;
619
- allow_discount_code?: boolean | undefined;
620
- allow_phone_number_collection?: boolean | undefined;
621
- allow_tax_id?: boolean | undefined;
622
- always_create_new_customer?: boolean | undefined;
623
- } | undefined;
624
- subscription_data?: {
625
- trial_period_days?: number | undefined;
626
- on_demand?: {
627
- mandate_only: boolean;
628
- product_price?: number | undefined;
629
- product_currency?: string | undefined;
630
- product_description?: string | undefined;
631
- adaptive_currency_fees_inclusive?: boolean | undefined;
632
- } | undefined;
633
- } | undefined;
634
- force_3ds?: boolean | undefined;
635
- }, {
636
- product_cart?: {
637
- quantity: number;
638
- product_id: string;
639
- addons?: {
640
- quantity: number;
641
- addon_id: string;
642
- }[] | undefined;
643
- amount?: number | undefined;
644
- }[] | undefined;
645
- customer?: {
646
- email: string;
647
- name?: string | undefined;
648
- phone_number?: string | undefined;
649
- } | {
650
- customer_id: string;
651
- } | undefined;
652
- metadata?: Record<string, string> | undefined;
653
- slug?: string | undefined;
654
- referenceId?: string | undefined;
655
- billing_address?: {
656
- country: string;
657
- city?: string | undefined;
658
- state?: string | undefined;
659
- street?: string | undefined;
660
- zipcode?: string | undefined;
661
- } | undefined;
662
- return_url?: string | undefined;
663
- 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;
664
- billing_currency?: string | undefined;
665
- show_saved_payment_methods?: boolean | undefined;
666
- confirm?: boolean | undefined;
667
- discount_code?: string | undefined;
668
- customization?: {
669
- theme?: "light" | "dark" | "system" | undefined;
670
- show_order_details?: boolean | undefined;
671
- show_on_demand_tag?: boolean | undefined;
672
- force_language?: string | undefined;
673
- } | undefined;
674
- feature_flags?: {
675
- allow_currency_selection?: boolean | undefined;
676
- allow_customer_editing_city?: boolean | undefined;
677
- allow_customer_editing_country?: boolean | undefined;
678
- allow_customer_editing_email?: boolean | undefined;
679
- allow_customer_editing_name?: boolean | undefined;
680
- allow_customer_editing_state?: boolean | undefined;
681
- allow_customer_editing_street?: boolean | undefined;
682
- allow_customer_editing_zipcode?: boolean | undefined;
683
- allow_discount_code?: boolean | undefined;
684
- allow_phone_number_collection?: boolean | undefined;
685
- allow_tax_id?: boolean | undefined;
686
- always_create_new_customer?: boolean | undefined;
687
- } | undefined;
688
- subscription_data?: {
689
- trial_period_days?: number | undefined;
690
- on_demand?: {
691
- mandate_only: boolean;
692
- product_price?: number | undefined;
693
- product_currency?: string | undefined;
694
- product_description?: string | undefined;
695
- adaptive_currency_fees_inclusive?: boolean | undefined;
696
- } | undefined;
697
- } | undefined;
698
- force_3ds?: boolean | undefined;
699
- }>;
700
- requireRequest: true;
701
- } & {
702
- use: any[];
703
- };
704
- path: "/dodopayments/checkout-session";
705
- };
706
- };
707
-
708
- declare const portal: () => (dodopayments: DodoPayments$1) => {
709
- dodoPortal: {
710
- <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
711
- body?: undefined;
712
- } & {
713
- method?: "GET" | undefined;
714
- } & {
715
- query?: Record<string, any> | undefined;
716
- } & {
717
- params?: Record<string, any>;
718
- } & {
719
- request?: Request;
720
- } & {
721
- headers?: HeadersInit;
722
- } & {
723
- asResponse?: boolean;
724
- returnHeaders?: boolean;
725
- use?: better_call.Middleware[];
726
- path?: string;
727
- } & {
728
- asResponse?: AsResponse | undefined;
729
- returnHeaders?: ReturnHeaders | undefined;
730
- }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
731
- headers: Headers;
732
- response: CustomerPortalResponse;
733
- } : CustomerPortalResponse>;
734
- options: {
735
- method: "GET";
736
- use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
737
- session: {
738
- session: Record<string, any> & {
739
- id: string;
740
- createdAt: Date;
741
- updatedAt: Date;
742
- userId: string;
743
- expiresAt: Date;
744
- token: string;
745
- ipAddress?: string | null | undefined;
746
- userAgent?: string | null | undefined;
747
- };
748
- user: Record<string, any> & {
749
- id: string;
750
- createdAt: Date;
751
- updatedAt: Date;
752
- email: string;
753
- emailVerified: boolean;
754
- name: string;
755
- image?: string | null | undefined;
756
- };
757
- };
758
- }>)[];
759
- } & {
760
- use: any[];
761
- };
762
- path: "/dodopayments/customer/portal";
763
- };
764
- dodoSubscriptions: {
765
- <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
766
- body?: undefined;
767
- } & {
768
- method?: "GET" | undefined;
769
- } & {
770
- query?: {
771
- status?: "active" | "cancelled" | "on_hold" | "pending" | "failed" | "expired" | undefined;
772
- page?: number | undefined;
773
- limit?: number | undefined;
774
- } | undefined;
775
- } & {
776
- params?: Record<string, any>;
777
- } & {
778
- request?: Request;
779
- } & {
780
- headers?: HeadersInit;
781
- } & {
782
- asResponse?: boolean;
783
- returnHeaders?: boolean;
784
- use?: better_call.Middleware[];
785
- path?: string;
786
- } & {
787
- asResponse?: AsResponse | undefined;
788
- returnHeaders?: ReturnHeaders | undefined;
789
- }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
790
- headers: Headers;
791
- response: SubscriptionItems;
792
- } : SubscriptionItems>;
793
- options: {
794
- method: "GET";
795
- query: z.ZodOptional<z.ZodObject<{
796
- page: z.ZodOptional<z.ZodNumber>;
797
- limit: z.ZodOptional<z.ZodNumber>;
798
- status: z.ZodOptional<z.ZodEnum<["active", "cancelled", "on_hold", "pending", "failed", "expired"]>>;
799
- }, "strip", z.ZodTypeAny, {
800
- status?: "active" | "cancelled" | "on_hold" | "pending" | "failed" | "expired" | undefined;
801
- page?: number | undefined;
802
- limit?: number | undefined;
803
- }, {
804
- status?: "active" | "cancelled" | "on_hold" | "pending" | "failed" | "expired" | undefined;
805
- page?: number | undefined;
806
- limit?: number | undefined;
807
- }>>;
808
- use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
809
- session: {
810
- session: Record<string, any> & {
811
- id: string;
812
- createdAt: Date;
813
- updatedAt: Date;
814
- userId: string;
815
- expiresAt: Date;
816
- token: string;
817
- ipAddress?: string | null | undefined;
818
- userAgent?: string | null | undefined;
819
- };
820
- user: Record<string, any> & {
821
- id: string;
822
- createdAt: Date;
823
- updatedAt: Date;
824
- email: string;
825
- emailVerified: boolean;
826
- name: string;
827
- image?: string | null | undefined;
828
- };
829
- };
830
- }>)[];
831
- } & {
832
- use: any[];
833
- };
834
- path: "/dodopayments/customer/subscriptions/list";
835
- };
836
- dodoPayments: {
837
- <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
838
- body?: undefined;
839
- } & {
840
- method?: "GET" | undefined;
841
- } & {
842
- query?: {
843
- 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;
844
- page?: number | undefined;
845
- limit?: number | undefined;
846
- } | undefined;
847
- } & {
848
- params?: Record<string, any>;
849
- } & {
850
- request?: Request;
851
- } & {
852
- headers?: HeadersInit;
853
- } & {
854
- asResponse?: boolean;
855
- returnHeaders?: boolean;
856
- use?: better_call.Middleware[];
857
- path?: string;
858
- } & {
859
- asResponse?: AsResponse | undefined;
860
- returnHeaders?: ReturnHeaders | undefined;
861
- }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
862
- headers: Headers;
863
- response: PaymentItems;
864
- } : PaymentItems>;
865
- options: {
866
- method: "GET";
867
- query: z.ZodOptional<z.ZodObject<{
868
- page: z.ZodOptional<z.ZodNumber>;
869
- limit: z.ZodOptional<z.ZodNumber>;
870
- 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"]>>;
871
- }, "strip", z.ZodTypeAny, {
872
- 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;
873
- page?: number | undefined;
874
- limit?: number | undefined;
875
- }, {
876
- 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;
877
- page?: number | undefined;
878
- limit?: number | undefined;
879
- }>>;
880
- use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
881
- session: {
882
- session: Record<string, any> & {
883
- id: string;
884
- createdAt: Date;
885
- updatedAt: Date;
886
- userId: string;
887
- expiresAt: Date;
888
- token: string;
889
- ipAddress?: string | null | undefined;
890
- userAgent?: string | null | undefined;
891
- };
892
- user: Record<string, any> & {
893
- id: string;
894
- createdAt: Date;
895
- updatedAt: Date;
896
- email: string;
897
- emailVerified: boolean;
898
- name: string;
899
- image?: string | null | undefined;
900
- };
901
- };
902
- }>)[];
903
- } & {
904
- use: any[];
905
- };
906
- path: "/dodopayments/customer/payments/list";
907
- };
908
- };
909
-
910
- declare const webhooks: (options: WebhookHandlerConfig) => (_dodopayments: DodoPayments$1) => {
911
- dodopaymentsWebhooks: {
912
- <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
913
- body?: undefined;
914
- } & {
915
- method?: "POST" | undefined;
916
- } & {
917
- query?: Record<string, any> | undefined;
918
- } & {
919
- params?: Record<string, any>;
920
- } & {
921
- request?: Request;
922
- } & {
923
- headers?: HeadersInit;
924
- } & {
925
- asResponse?: boolean;
926
- returnHeaders?: boolean;
927
- use?: better_call.Middleware[];
928
- path?: string;
929
- } & {
930
- asResponse?: AsResponse | undefined;
931
- returnHeaders?: ReturnHeaders | undefined;
932
- }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
933
- headers: Headers;
934
- response: WebhookResponse;
935
- } : WebhookResponse>;
936
- options: {
937
- method: "POST";
938
- metadata: {
939
- isAction: boolean;
940
- };
941
- cloneRequest: true;
942
- } & {
943
- use: any[];
944
- };
945
- path: "/dodopayments/webhooks";
946
- };
947
- };
948
-
949
- type Product = {
950
- /**
951
- * Product Id from DodoPayments Product
952
- */
953
- productId: string;
954
- /**
955
- * Easily identifiable slug for the product
956
- */
957
- slug: string;
958
- };
959
- type DodoPaymentsPlugin = ReturnType<typeof checkout> | ReturnType<typeof portal> | ReturnType<typeof webhooks> | ReturnType<typeof usage>;
960
- type DodoPaymentsPlugins = [DodoPaymentsPlugin, ...DodoPaymentsPlugin[]];
961
- type DodoPaymentsEndpoints = UnionToIntersection<ReturnType<DodoPaymentsPlugin>>;
962
- interface DodoPaymentsOptions {
963
- /**
964
- * DodoPayments Client
965
- */
966
- client: DodoPayments$1;
967
- /**
968
- * Enable customer creation when a user signs up
969
- */
970
- createCustomerOnSignUp?: boolean;
971
- /**
972
- * Use DodoPayments plugins
973
- */
974
- use: DodoPaymentsPlugins;
975
- }
976
- type PaymentsList = Awaited<ReturnType<DodoPayments$1["payments"]["list"]>>;
977
- type SubscriptionsList = Awaited<ReturnType<DodoPayments$1["subscriptions"]["list"]>>;
978
- type PaymentItems = {
979
- items: PaymentsList["items"];
980
- };
981
- type SubscriptionItems = {
982
- items: SubscriptionsList["items"];
983
- };
984
- type CustomerPortalResponse = {
985
- url: string;
986
- redirect: boolean;
987
- };
988
- type CreateCheckoutResponse = {
989
- url: string;
990
- redirect: boolean;
991
- };
992
- type WebhookResponse = {
993
- received: boolean;
994
- };
995
-
996
- 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 };