dodopayments 2.17.2 → 2.19.0

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 (61) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/client.d.mts +8 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +8 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js +14 -3
  7. package/client.js.map +1 -1
  8. package/client.mjs +14 -3
  9. package/client.mjs.map +1 -1
  10. package/internal/parse.d.mts.map +1 -1
  11. package/internal/parse.d.ts.map +1 -1
  12. package/internal/parse.js +5 -0
  13. package/internal/parse.js.map +1 -1
  14. package/internal/parse.mjs +5 -0
  15. package/internal/parse.mjs.map +1 -1
  16. package/package.json +1 -1
  17. package/resources/balances.d.mts +52 -0
  18. package/resources/balances.d.mts.map +1 -0
  19. package/resources/balances.d.ts +52 -0
  20. package/resources/balances.d.ts.map +1 -0
  21. package/resources/balances.js +16 -0
  22. package/resources/balances.js.map +1 -0
  23. package/resources/balances.mjs +12 -0
  24. package/resources/balances.mjs.map +1 -0
  25. package/resources/checkout-sessions.d.mts +289 -493
  26. package/resources/checkout-sessions.d.mts.map +1 -1
  27. package/resources/checkout-sessions.d.ts +289 -493
  28. package/resources/checkout-sessions.d.ts.map +1 -1
  29. package/resources/index.d.mts +2 -1
  30. package/resources/index.d.mts.map +1 -1
  31. package/resources/index.d.ts +2 -1
  32. package/resources/index.d.ts.map +1 -1
  33. package/resources/index.js +3 -1
  34. package/resources/index.js.map +1 -1
  35. package/resources/index.mjs +1 -0
  36. package/resources/index.mjs.map +1 -1
  37. package/resources/payments.d.mts +5 -0
  38. package/resources/payments.d.mts.map +1 -1
  39. package/resources/payments.d.ts +5 -0
  40. package/resources/payments.d.ts.map +1 -1
  41. package/resources/subscriptions.d.mts +20 -0
  42. package/resources/subscriptions.d.mts.map +1 -1
  43. package/resources/subscriptions.d.ts +20 -0
  44. package/resources/subscriptions.d.ts.map +1 -1
  45. package/resources/webhook-events.d.mts +1 -1
  46. package/resources/webhook-events.d.mts.map +1 -1
  47. package/resources/webhook-events.d.ts +1 -1
  48. package/resources/webhook-events.d.ts.map +1 -1
  49. package/src/client.ts +48 -5
  50. package/src/internal/parse.ts +6 -0
  51. package/src/resources/balances.ts +271 -0
  52. package/src/resources/checkout-sessions.ts +338 -577
  53. package/src/resources/index.ts +14 -0
  54. package/src/resources/payments.ts +6 -0
  55. package/src/resources/subscriptions.ts +22 -0
  56. package/src/resources/webhook-events.ts +6 -1
  57. package/src/version.ts +1 -1
  58. package/version.d.mts +1 -1
  59. package/version.d.ts +1 -1
  60. package/version.js +1 -1
  61. package/version.mjs +1 -1
@@ -9,8 +9,104 @@ export declare class CheckoutSessions extends APIResource {
9
9
  retrieve(id: string, options?: RequestOptions): APIPromise<CheckoutSessionStatus>;
10
10
  preview(body: CheckoutSessionPreviewParams, options?: RequestOptions): APIPromise<CheckoutSessionPreviewResponse>;
11
11
  }
12
+ export interface CheckoutSessionBillingAddress {
13
+ /**
14
+ * Two-letter ISO country code (ISO 3166-1 alpha-2)
15
+ */
16
+ country: MiscAPI.CountryCode;
17
+ /**
18
+ * City name
19
+ */
20
+ city?: string | null;
21
+ /**
22
+ * State or province name
23
+ */
24
+ state?: string | null;
25
+ /**
26
+ * Street address including house number and unit/apartment if applicable
27
+ */
28
+ street?: string | null;
29
+ /**
30
+ * Postal code or ZIP code
31
+ */
32
+ zipcode?: string | null;
33
+ }
34
+ export interface CheckoutSessionCustomization {
35
+ /**
36
+ * Force the checkout interface to render in a specific language (e.g. `en`, `es`)
37
+ */
38
+ force_language?: string | null;
39
+ /**
40
+ * Show on demand tag
41
+ *
42
+ * Default is true
43
+ */
44
+ show_on_demand_tag?: boolean;
45
+ /**
46
+ * Show order details by default
47
+ *
48
+ * Default is true
49
+ */
50
+ show_order_details?: boolean;
51
+ /**
52
+ * Theme of the page (determines which mode - light/dark/system - to use)
53
+ *
54
+ * Default is `System`.
55
+ */
56
+ theme?: 'dark' | 'light' | 'system';
57
+ /**
58
+ * Optional custom theme configuration with colors for light and dark modes
59
+ */
60
+ theme_config?: ThemeConfig | null;
61
+ }
62
+ export interface CheckoutSessionFlags {
63
+ /**
64
+ * if customer is allowed to change currency, set it to true
65
+ *
66
+ * Default is true
67
+ */
68
+ allow_currency_selection?: boolean;
69
+ allow_customer_editing_city?: boolean;
70
+ allow_customer_editing_country?: boolean;
71
+ allow_customer_editing_email?: boolean;
72
+ allow_customer_editing_name?: boolean;
73
+ allow_customer_editing_state?: boolean;
74
+ allow_customer_editing_street?: boolean;
75
+ allow_customer_editing_zipcode?: boolean;
76
+ /**
77
+ * If the customer is allowed to apply discount code, set it to true.
78
+ *
79
+ * Default is true
80
+ */
81
+ allow_discount_code?: boolean;
82
+ /**
83
+ * If phone number is collected from customer, set it to rue
84
+ *
85
+ * Default is true
86
+ */
87
+ allow_phone_number_collection?: boolean;
88
+ /**
89
+ * If the customer is allowed to add tax id, set it to true
90
+ *
91
+ * Default is true
92
+ */
93
+ allow_tax_id?: boolean;
94
+ /**
95
+ * Set to true if a new customer object should be created. By default email is used
96
+ * to find an existing customer to attach the session to
97
+ *
98
+ * Default is false
99
+ */
100
+ always_create_new_customer?: boolean;
101
+ /**
102
+ * If true, redirects the customer immediately after payment completion
103
+ *
104
+ * Default is false
105
+ */
106
+ redirect_immediately?: boolean;
107
+ }
12
108
  export interface CheckoutSessionRequest {
13
- product_cart: Array<CheckoutSessionRequest.ProductCart>;
109
+ product_cart: Array<ProductItemReq>;
14
110
  /**
15
111
  * Customers will never see payment methods that are not in this list. However,
16
112
  * adding a method here does not guarantee customers will see it. Availability
@@ -23,7 +119,7 @@ export interface CheckoutSessionRequest {
23
119
  /**
24
120
  * Billing address information for the session
25
121
  */
26
- billing_address?: CheckoutSessionRequest.BillingAddress | null;
122
+ billing_address?: CheckoutSessionBillingAddress | null;
27
123
  /**
28
124
  * This field is ingored if adaptive pricing is disabled
29
125
  */
@@ -36,7 +132,7 @@ export interface CheckoutSessionRequest {
36
132
  /**
37
133
  * Custom fields to collect from customer during checkout (max 5 fields)
38
134
  */
39
- custom_fields?: Array<CheckoutSessionRequest.CustomField> | null;
135
+ custom_fields?: Array<CustomField> | null;
40
136
  /**
41
137
  * Customer details for the session
42
138
  */
@@ -44,9 +140,9 @@ export interface CheckoutSessionRequest {
44
140
  /**
45
141
  * Customization for the checkout session page
46
142
  */
47
- customization?: CheckoutSessionRequest.Customization;
143
+ customization?: CheckoutSessionCustomization;
48
144
  discount_code?: string | null;
49
- feature_flags?: CheckoutSessionRequest.FeatureFlags;
145
+ feature_flags?: CheckoutSessionFlags;
50
146
  /**
51
147
  * Override merchant default 3DS behaviour for this session
52
148
  */
@@ -84,165 +180,7 @@ export interface CheckoutSessionRequest {
84
180
  * Display saved payment methods of a returning customer False by default
85
181
  */
86
182
  show_saved_payment_methods?: boolean;
87
- subscription_data?: CheckoutSessionRequest.SubscriptionData | null;
88
- }
89
- export declare namespace CheckoutSessionRequest {
90
- interface ProductCart {
91
- /**
92
- * unique id of the product
93
- */
94
- product_id: string;
95
- quantity: number;
96
- /**
97
- * only valid if product is a subscription
98
- */
99
- addons?: Array<SubscriptionsAPI.AttachAddon> | null;
100
- /**
101
- * Amount the customer pays if pay_what_you_want is enabled. If disabled then
102
- * amount will be ignored Represented in the lowest denomination of the currency
103
- * (e.g., cents for USD). For example, to charge $1.00, pass `100`. Only applicable
104
- * for one time payments
105
- *
106
- * If amount is not set for pay_what_you_want product, customer is allowed to
107
- * select the amount.
108
- */
109
- amount?: number | null;
110
- }
111
- /**
112
- * Billing address information for the session
113
- */
114
- interface BillingAddress {
115
- /**
116
- * Two-letter ISO country code (ISO 3166-1 alpha-2)
117
- */
118
- country: MiscAPI.CountryCode;
119
- /**
120
- * City name
121
- */
122
- city?: string | null;
123
- /**
124
- * State or province name
125
- */
126
- state?: string | null;
127
- /**
128
- * Street address including house number and unit/apartment if applicable
129
- */
130
- street?: string | null;
131
- /**
132
- * Postal code or ZIP code
133
- */
134
- zipcode?: string | null;
135
- }
136
- /**
137
- * Definition of a custom field for checkout
138
- */
139
- interface CustomField {
140
- /**
141
- * Type of field determining validation rules
142
- */
143
- field_type: 'text' | 'number' | 'email' | 'url' | 'phone' | 'date' | 'datetime' | 'dropdown' | 'boolean';
144
- /**
145
- * Unique identifier for this field (used as key in responses)
146
- */
147
- key: string;
148
- /**
149
- * Display label shown to customer
150
- */
151
- label: string;
152
- /**
153
- * Options for dropdown type (required for dropdown, ignored for others)
154
- */
155
- options?: Array<string> | null;
156
- /**
157
- * Placeholder text for the input
158
- */
159
- placeholder?: string | null;
160
- /**
161
- * Whether this field is required
162
- */
163
- required?: boolean;
164
- }
165
- /**
166
- * Customization for the checkout session page
167
- */
168
- interface Customization {
169
- /**
170
- * Force the checkout interface to render in a specific language (e.g. `en`, `es`)
171
- */
172
- force_language?: string | null;
173
- /**
174
- * Show on demand tag
175
- *
176
- * Default is true
177
- */
178
- show_on_demand_tag?: boolean;
179
- /**
180
- * Show order details by default
181
- *
182
- * Default is true
183
- */
184
- show_order_details?: boolean;
185
- /**
186
- * Theme of the page
187
- *
188
- * Default is `System`.
189
- */
190
- theme?: 'dark' | 'light' | 'system';
191
- }
192
- interface FeatureFlags {
193
- /**
194
- * if customer is allowed to change currency, set it to true
195
- *
196
- * Default is true
197
- */
198
- allow_currency_selection?: boolean;
199
- allow_customer_editing_city?: boolean;
200
- allow_customer_editing_country?: boolean;
201
- allow_customer_editing_email?: boolean;
202
- allow_customer_editing_name?: boolean;
203
- allow_customer_editing_state?: boolean;
204
- allow_customer_editing_street?: boolean;
205
- allow_customer_editing_zipcode?: boolean;
206
- /**
207
- * If the customer is allowed to apply discount code, set it to true.
208
- *
209
- * Default is true
210
- */
211
- allow_discount_code?: boolean;
212
- /**
213
- * If phone number is collected from customer, set it to rue
214
- *
215
- * Default is true
216
- */
217
- allow_phone_number_collection?: boolean;
218
- /**
219
- * If the customer is allowed to add tax id, set it to true
220
- *
221
- * Default is true
222
- */
223
- allow_tax_id?: boolean;
224
- /**
225
- * Set to true if a new customer object should be created. By default email is used
226
- * to find an existing customer to attach the session to
227
- *
228
- * Default is false
229
- */
230
- always_create_new_customer?: boolean;
231
- /**
232
- * If true, redirects the customer immediately after payment completion
233
- *
234
- * Default is false
235
- */
236
- redirect_immediately?: boolean;
237
- }
238
- interface SubscriptionData {
239
- on_demand?: SubscriptionsAPI.OnDemandSubscription | null;
240
- /**
241
- * Optional trial period in days If specified, this value overrides the trial
242
- * period set in the product's price Must be between 0 and 10000 days
243
- */
244
- trial_period_days?: number | null;
245
- }
183
+ subscription_data?: SubscriptionData | null;
246
184
  }
247
185
  export interface CheckoutSessionResponse {
248
186
  /**
@@ -284,6 +222,180 @@ export interface CheckoutSessionStatus {
284
222
  */
285
223
  payment_status?: PaymentsAPI.IntentStatus | null;
286
224
  }
225
+ /**
226
+ * Definition of a custom field for checkout
227
+ */
228
+ export interface CustomField {
229
+ /**
230
+ * Type of field determining validation rules
231
+ */
232
+ field_type: 'text' | 'number' | 'email' | 'url' | 'date' | 'dropdown' | 'boolean';
233
+ /**
234
+ * Unique identifier for this field (used as key in responses)
235
+ */
236
+ key: string;
237
+ /**
238
+ * Display label shown to customer
239
+ */
240
+ label: string;
241
+ /**
242
+ * Options for dropdown type (required for dropdown, ignored for others)
243
+ */
244
+ options?: Array<string> | null;
245
+ /**
246
+ * Placeholder text for the input
247
+ */
248
+ placeholder?: string | null;
249
+ /**
250
+ * Whether this field is required
251
+ */
252
+ required?: boolean;
253
+ }
254
+ export interface ProductItemReq {
255
+ /**
256
+ * unique id of the product
257
+ */
258
+ product_id: string;
259
+ quantity: number;
260
+ /**
261
+ * only valid if product is a subscription
262
+ */
263
+ addons?: Array<SubscriptionsAPI.AttachAddon> | null;
264
+ /**
265
+ * Amount the customer pays if pay_what_you_want is enabled. If disabled then
266
+ * amount will be ignored Represented in the lowest denomination of the currency
267
+ * (e.g., cents for USD). For example, to charge $1.00, pass `100`. Only applicable
268
+ * for one time payments
269
+ *
270
+ * If amount is not set for pay_what_you_want product, customer is allowed to
271
+ * select the amount.
272
+ */
273
+ amount?: number | null;
274
+ }
275
+ export interface SubscriptionData {
276
+ on_demand?: SubscriptionsAPI.OnDemandSubscription | null;
277
+ /**
278
+ * Optional trial period in days If specified, this value overrides the trial
279
+ * period set in the product's price Must be between 0 and 10000 days
280
+ */
281
+ trial_period_days?: number | null;
282
+ }
283
+ /**
284
+ * Custom theme configuration with colors for light and dark modes.
285
+ */
286
+ export interface ThemeConfig {
287
+ /**
288
+ * Dark mode color configuration
289
+ */
290
+ dark?: ThemeModeConfig | null;
291
+ /**
292
+ * URL for the primary font
293
+ */
294
+ font_primary_url?: string | null;
295
+ /**
296
+ * URL for the secondary font
297
+ */
298
+ font_secondary_url?: string | null;
299
+ /**
300
+ * Font size for the checkout UI
301
+ */
302
+ font_size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | null;
303
+ /**
304
+ * Font weight for the checkout UI
305
+ */
306
+ font_weight?: 'normal' | 'medium' | 'bold' | 'extraBold' | null;
307
+ /**
308
+ * Light mode color configuration
309
+ */
310
+ light?: ThemeModeConfig | null;
311
+ /**
312
+ * Custom text for the pay button (e.g., "Complete Purchase", "Subscribe Now")
313
+ */
314
+ pay_button_text?: string | null;
315
+ /**
316
+ * Border radius for UI elements (e.g., "4px", "0.5rem", "8px")
317
+ */
318
+ radius?: string | null;
319
+ }
320
+ /**
321
+ * Color configuration for a single theme mode (light or dark).
322
+ *
323
+ * All color fields accept standard CSS color formats:
324
+ *
325
+ * - Hex: `#fff`, `#ffffff`, `#ffffffff` (with or without # prefix)
326
+ * - RGB/RGBA: `rgb(255, 255, 255)`, `rgba(255, 255, 255, 0.5)`
327
+ * - HSL/HSLA: `hsl(120, 100%, 50%)`, `hsla(120, 100%, 50%, 0.5)`
328
+ * - Named colors: `red`, `blue`, `transparent`, etc.
329
+ * - Advanced: `hwb()`, `lab()`, `lch()`, `oklab()`, `oklch()`, `color()`
330
+ */
331
+ export interface ThemeModeConfig {
332
+ /**
333
+ * Background primary color
334
+ *
335
+ * Examples: `"#ffffff"`, `"rgb(255, 255, 255)"`, `"white"`
336
+ */
337
+ bg_primary?: string | null;
338
+ /**
339
+ * Background secondary color
340
+ */
341
+ bg_secondary?: string | null;
342
+ /**
343
+ * Border primary color
344
+ */
345
+ border_primary?: string | null;
346
+ /**
347
+ * Border secondary color
348
+ */
349
+ border_secondary?: string | null;
350
+ /**
351
+ * Primary button background color
352
+ */
353
+ button_primary?: string | null;
354
+ /**
355
+ * Primary button hover color
356
+ */
357
+ button_primary_hover?: string | null;
358
+ /**
359
+ * Secondary button background color
360
+ */
361
+ button_secondary?: string | null;
362
+ /**
363
+ * Secondary button hover color
364
+ */
365
+ button_secondary_hover?: string | null;
366
+ /**
367
+ * Primary button text color
368
+ */
369
+ button_text_primary?: string | null;
370
+ /**
371
+ * Secondary button text color
372
+ */
373
+ button_text_secondary?: string | null;
374
+ /**
375
+ * Input focus border color
376
+ */
377
+ input_focus_border?: string | null;
378
+ /**
379
+ * Text error color
380
+ */
381
+ text_error?: string | null;
382
+ /**
383
+ * Text placeholder color
384
+ */
385
+ text_placeholder?: string | null;
386
+ /**
387
+ * Text primary color
388
+ */
389
+ text_primary?: string | null;
390
+ /**
391
+ * Text secondary color
392
+ */
393
+ text_secondary?: string | null;
394
+ /**
395
+ * Text success color
396
+ */
397
+ text_success?: string | null;
398
+ }
287
399
  /**
288
400
  * Data returned by the calculate checkout session API
289
401
  */
@@ -452,7 +564,7 @@ export declare namespace CheckoutSessionPreviewResponse {
452
564
  }
453
565
  }
454
566
  export interface CheckoutSessionCreateParams {
455
- product_cart: Array<CheckoutSessionCreateParams.ProductCart>;
567
+ product_cart: Array<ProductItemReq>;
456
568
  /**
457
569
  * Customers will never see payment methods that are not in this list. However,
458
570
  * adding a method here does not guarantee customers will see it. Availability
@@ -465,7 +577,7 @@ export interface CheckoutSessionCreateParams {
465
577
  /**
466
578
  * Billing address information for the session
467
579
  */
468
- billing_address?: CheckoutSessionCreateParams.BillingAddress | null;
580
+ billing_address?: CheckoutSessionBillingAddress | null;
469
581
  /**
470
582
  * This field is ingored if adaptive pricing is disabled
471
583
  */
@@ -478,7 +590,7 @@ export interface CheckoutSessionCreateParams {
478
590
  /**
479
591
  * Custom fields to collect from customer during checkout (max 5 fields)
480
592
  */
481
- custom_fields?: Array<CheckoutSessionCreateParams.CustomField> | null;
593
+ custom_fields?: Array<CustomField> | null;
482
594
  /**
483
595
  * Customer details for the session
484
596
  */
@@ -486,9 +598,9 @@ export interface CheckoutSessionCreateParams {
486
598
  /**
487
599
  * Customization for the checkout session page
488
600
  */
489
- customization?: CheckoutSessionCreateParams.Customization;
601
+ customization?: CheckoutSessionCustomization;
490
602
  discount_code?: string | null;
491
- feature_flags?: CheckoutSessionCreateParams.FeatureFlags;
603
+ feature_flags?: CheckoutSessionFlags;
492
604
  /**
493
605
  * Override merchant default 3DS behaviour for this session
494
606
  */
@@ -526,168 +638,10 @@ export interface CheckoutSessionCreateParams {
526
638
  * Display saved payment methods of a returning customer False by default
527
639
  */
528
640
  show_saved_payment_methods?: boolean;
529
- subscription_data?: CheckoutSessionCreateParams.SubscriptionData | null;
530
- }
531
- export declare namespace CheckoutSessionCreateParams {
532
- interface ProductCart {
533
- /**
534
- * unique id of the product
535
- */
536
- product_id: string;
537
- quantity: number;
538
- /**
539
- * only valid if product is a subscription
540
- */
541
- addons?: Array<SubscriptionsAPI.AttachAddon> | null;
542
- /**
543
- * Amount the customer pays if pay_what_you_want is enabled. If disabled then
544
- * amount will be ignored Represented in the lowest denomination of the currency
545
- * (e.g., cents for USD). For example, to charge $1.00, pass `100`. Only applicable
546
- * for one time payments
547
- *
548
- * If amount is not set for pay_what_you_want product, customer is allowed to
549
- * select the amount.
550
- */
551
- amount?: number | null;
552
- }
553
- /**
554
- * Billing address information for the session
555
- */
556
- interface BillingAddress {
557
- /**
558
- * Two-letter ISO country code (ISO 3166-1 alpha-2)
559
- */
560
- country: MiscAPI.CountryCode;
561
- /**
562
- * City name
563
- */
564
- city?: string | null;
565
- /**
566
- * State or province name
567
- */
568
- state?: string | null;
569
- /**
570
- * Street address including house number and unit/apartment if applicable
571
- */
572
- street?: string | null;
573
- /**
574
- * Postal code or ZIP code
575
- */
576
- zipcode?: string | null;
577
- }
578
- /**
579
- * Definition of a custom field for checkout
580
- */
581
- interface CustomField {
582
- /**
583
- * Type of field determining validation rules
584
- */
585
- field_type: 'text' | 'number' | 'email' | 'url' | 'phone' | 'date' | 'datetime' | 'dropdown' | 'boolean';
586
- /**
587
- * Unique identifier for this field (used as key in responses)
588
- */
589
- key: string;
590
- /**
591
- * Display label shown to customer
592
- */
593
- label: string;
594
- /**
595
- * Options for dropdown type (required for dropdown, ignored for others)
596
- */
597
- options?: Array<string> | null;
598
- /**
599
- * Placeholder text for the input
600
- */
601
- placeholder?: string | null;
602
- /**
603
- * Whether this field is required
604
- */
605
- required?: boolean;
606
- }
607
- /**
608
- * Customization for the checkout session page
609
- */
610
- interface Customization {
611
- /**
612
- * Force the checkout interface to render in a specific language (e.g. `en`, `es`)
613
- */
614
- force_language?: string | null;
615
- /**
616
- * Show on demand tag
617
- *
618
- * Default is true
619
- */
620
- show_on_demand_tag?: boolean;
621
- /**
622
- * Show order details by default
623
- *
624
- * Default is true
625
- */
626
- show_order_details?: boolean;
627
- /**
628
- * Theme of the page
629
- *
630
- * Default is `System`.
631
- */
632
- theme?: 'dark' | 'light' | 'system';
633
- }
634
- interface FeatureFlags {
635
- /**
636
- * if customer is allowed to change currency, set it to true
637
- *
638
- * Default is true
639
- */
640
- allow_currency_selection?: boolean;
641
- allow_customer_editing_city?: boolean;
642
- allow_customer_editing_country?: boolean;
643
- allow_customer_editing_email?: boolean;
644
- allow_customer_editing_name?: boolean;
645
- allow_customer_editing_state?: boolean;
646
- allow_customer_editing_street?: boolean;
647
- allow_customer_editing_zipcode?: boolean;
648
- /**
649
- * If the customer is allowed to apply discount code, set it to true.
650
- *
651
- * Default is true
652
- */
653
- allow_discount_code?: boolean;
654
- /**
655
- * If phone number is collected from customer, set it to rue
656
- *
657
- * Default is true
658
- */
659
- allow_phone_number_collection?: boolean;
660
- /**
661
- * If the customer is allowed to add tax id, set it to true
662
- *
663
- * Default is true
664
- */
665
- allow_tax_id?: boolean;
666
- /**
667
- * Set to true if a new customer object should be created. By default email is used
668
- * to find an existing customer to attach the session to
669
- *
670
- * Default is false
671
- */
672
- always_create_new_customer?: boolean;
673
- /**
674
- * If true, redirects the customer immediately after payment completion
675
- *
676
- * Default is false
677
- */
678
- redirect_immediately?: boolean;
679
- }
680
- interface SubscriptionData {
681
- on_demand?: SubscriptionsAPI.OnDemandSubscription | null;
682
- /**
683
- * Optional trial period in days If specified, this value overrides the trial
684
- * period set in the product's price Must be between 0 and 10000 days
685
- */
686
- trial_period_days?: number | null;
687
- }
641
+ subscription_data?: SubscriptionData | null;
688
642
  }
689
643
  export interface CheckoutSessionPreviewParams {
690
- product_cart: Array<CheckoutSessionPreviewParams.ProductCart>;
644
+ product_cart: Array<ProductItemReq>;
691
645
  /**
692
646
  * Customers will never see payment methods that are not in this list. However,
693
647
  * adding a method here does not guarantee customers will see it. Availability
@@ -700,7 +654,7 @@ export interface CheckoutSessionPreviewParams {
700
654
  /**
701
655
  * Billing address information for the session
702
656
  */
703
- billing_address?: CheckoutSessionPreviewParams.BillingAddress | null;
657
+ billing_address?: CheckoutSessionBillingAddress | null;
704
658
  /**
705
659
  * This field is ingored if adaptive pricing is disabled
706
660
  */
@@ -713,7 +667,7 @@ export interface CheckoutSessionPreviewParams {
713
667
  /**
714
668
  * Custom fields to collect from customer during checkout (max 5 fields)
715
669
  */
716
- custom_fields?: Array<CheckoutSessionPreviewParams.CustomField> | null;
670
+ custom_fields?: Array<CustomField> | null;
717
671
  /**
718
672
  * Customer details for the session
719
673
  */
@@ -721,9 +675,9 @@ export interface CheckoutSessionPreviewParams {
721
675
  /**
722
676
  * Customization for the checkout session page
723
677
  */
724
- customization?: CheckoutSessionPreviewParams.Customization;
678
+ customization?: CheckoutSessionCustomization;
725
679
  discount_code?: string | null;
726
- feature_flags?: CheckoutSessionPreviewParams.FeatureFlags;
680
+ feature_flags?: CheckoutSessionFlags;
727
681
  /**
728
682
  * Override merchant default 3DS behaviour for this session
729
683
  */
@@ -761,167 +715,9 @@ export interface CheckoutSessionPreviewParams {
761
715
  * Display saved payment methods of a returning customer False by default
762
716
  */
763
717
  show_saved_payment_methods?: boolean;
764
- subscription_data?: CheckoutSessionPreviewParams.SubscriptionData | null;
765
- }
766
- export declare namespace CheckoutSessionPreviewParams {
767
- interface ProductCart {
768
- /**
769
- * unique id of the product
770
- */
771
- product_id: string;
772
- quantity: number;
773
- /**
774
- * only valid if product is a subscription
775
- */
776
- addons?: Array<SubscriptionsAPI.AttachAddon> | null;
777
- /**
778
- * Amount the customer pays if pay_what_you_want is enabled. If disabled then
779
- * amount will be ignored Represented in the lowest denomination of the currency
780
- * (e.g., cents for USD). For example, to charge $1.00, pass `100`. Only applicable
781
- * for one time payments
782
- *
783
- * If amount is not set for pay_what_you_want product, customer is allowed to
784
- * select the amount.
785
- */
786
- amount?: number | null;
787
- }
788
- /**
789
- * Billing address information for the session
790
- */
791
- interface BillingAddress {
792
- /**
793
- * Two-letter ISO country code (ISO 3166-1 alpha-2)
794
- */
795
- country: MiscAPI.CountryCode;
796
- /**
797
- * City name
798
- */
799
- city?: string | null;
800
- /**
801
- * State or province name
802
- */
803
- state?: string | null;
804
- /**
805
- * Street address including house number and unit/apartment if applicable
806
- */
807
- street?: string | null;
808
- /**
809
- * Postal code or ZIP code
810
- */
811
- zipcode?: string | null;
812
- }
813
- /**
814
- * Definition of a custom field for checkout
815
- */
816
- interface CustomField {
817
- /**
818
- * Type of field determining validation rules
819
- */
820
- field_type: 'text' | 'number' | 'email' | 'url' | 'phone' | 'date' | 'datetime' | 'dropdown' | 'boolean';
821
- /**
822
- * Unique identifier for this field (used as key in responses)
823
- */
824
- key: string;
825
- /**
826
- * Display label shown to customer
827
- */
828
- label: string;
829
- /**
830
- * Options for dropdown type (required for dropdown, ignored for others)
831
- */
832
- options?: Array<string> | null;
833
- /**
834
- * Placeholder text for the input
835
- */
836
- placeholder?: string | null;
837
- /**
838
- * Whether this field is required
839
- */
840
- required?: boolean;
841
- }
842
- /**
843
- * Customization for the checkout session page
844
- */
845
- interface Customization {
846
- /**
847
- * Force the checkout interface to render in a specific language (e.g. `en`, `es`)
848
- */
849
- force_language?: string | null;
850
- /**
851
- * Show on demand tag
852
- *
853
- * Default is true
854
- */
855
- show_on_demand_tag?: boolean;
856
- /**
857
- * Show order details by default
858
- *
859
- * Default is true
860
- */
861
- show_order_details?: boolean;
862
- /**
863
- * Theme of the page
864
- *
865
- * Default is `System`.
866
- */
867
- theme?: 'dark' | 'light' | 'system';
868
- }
869
- interface FeatureFlags {
870
- /**
871
- * if customer is allowed to change currency, set it to true
872
- *
873
- * Default is true
874
- */
875
- allow_currency_selection?: boolean;
876
- allow_customer_editing_city?: boolean;
877
- allow_customer_editing_country?: boolean;
878
- allow_customer_editing_email?: boolean;
879
- allow_customer_editing_name?: boolean;
880
- allow_customer_editing_state?: boolean;
881
- allow_customer_editing_street?: boolean;
882
- allow_customer_editing_zipcode?: boolean;
883
- /**
884
- * If the customer is allowed to apply discount code, set it to true.
885
- *
886
- * Default is true
887
- */
888
- allow_discount_code?: boolean;
889
- /**
890
- * If phone number is collected from customer, set it to rue
891
- *
892
- * Default is true
893
- */
894
- allow_phone_number_collection?: boolean;
895
- /**
896
- * If the customer is allowed to add tax id, set it to true
897
- *
898
- * Default is true
899
- */
900
- allow_tax_id?: boolean;
901
- /**
902
- * Set to true if a new customer object should be created. By default email is used
903
- * to find an existing customer to attach the session to
904
- *
905
- * Default is false
906
- */
907
- always_create_new_customer?: boolean;
908
- /**
909
- * If true, redirects the customer immediately after payment completion
910
- *
911
- * Default is false
912
- */
913
- redirect_immediately?: boolean;
914
- }
915
- interface SubscriptionData {
916
- on_demand?: SubscriptionsAPI.OnDemandSubscription | null;
917
- /**
918
- * Optional trial period in days If specified, this value overrides the trial
919
- * period set in the product's price Must be between 0 and 10000 days
920
- */
921
- trial_period_days?: number | null;
922
- }
718
+ subscription_data?: SubscriptionData | null;
923
719
  }
924
720
  export declare namespace CheckoutSessions {
925
- export { type CheckoutSessionRequest as CheckoutSessionRequest, type CheckoutSessionResponse as CheckoutSessionResponse, type CheckoutSessionStatus as CheckoutSessionStatus, type CheckoutSessionPreviewResponse as CheckoutSessionPreviewResponse, type CheckoutSessionCreateParams as CheckoutSessionCreateParams, type CheckoutSessionPreviewParams as CheckoutSessionPreviewParams, };
721
+ export { type CheckoutSessionBillingAddress as CheckoutSessionBillingAddress, type CheckoutSessionCustomization as CheckoutSessionCustomization, type CheckoutSessionFlags as CheckoutSessionFlags, type CheckoutSessionRequest as CheckoutSessionRequest, type CheckoutSessionResponse as CheckoutSessionResponse, type CheckoutSessionStatus as CheckoutSessionStatus, type CustomField as CustomField, type ProductItemReq as ProductItemReq, type SubscriptionData as SubscriptionData, type ThemeConfig as ThemeConfig, type ThemeModeConfig as ThemeModeConfig, type CheckoutSessionPreviewResponse as CheckoutSessionPreviewResponse, type CheckoutSessionCreateParams as CheckoutSessionCreateParams, type CheckoutSessionPreviewParams as CheckoutSessionPreviewParams, };
926
722
  }
927
723
  //# sourceMappingURL=checkout-sessions.d.ts.map