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