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.
- package/CHANGELOG.md +37 -0
- package/client.d.mts +8 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +8 -4
- package/client.d.ts.map +1 -1
- package/client.js +14 -3
- package/client.js.map +1 -1
- package/client.mjs +14 -3
- package/client.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +5 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -0
- package/internal/parse.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/balances.d.mts +52 -0
- package/resources/balances.d.mts.map +1 -0
- package/resources/balances.d.ts +52 -0
- package/resources/balances.d.ts.map +1 -0
- package/resources/balances.js +16 -0
- package/resources/balances.js.map +1 -0
- package/resources/balances.mjs +12 -0
- package/resources/balances.mjs.map +1 -0
- package/resources/checkout-sessions.d.mts +289 -493
- package/resources/checkout-sessions.d.mts.map +1 -1
- package/resources/checkout-sessions.d.ts +289 -493
- package/resources/checkout-sessions.d.ts.map +1 -1
- package/resources/index.d.mts +2 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/payments.d.mts +5 -0
- package/resources/payments.d.mts.map +1 -1
- package/resources/payments.d.ts +5 -0
- package/resources/payments.d.ts.map +1 -1
- package/resources/subscriptions.d.mts +20 -0
- package/resources/subscriptions.d.mts.map +1 -1
- package/resources/subscriptions.d.ts +20 -0
- package/resources/subscriptions.d.ts.map +1 -1
- package/resources/webhook-events.d.mts +1 -1
- package/resources/webhook-events.d.mts.map +1 -1
- package/resources/webhook-events.d.ts +1 -1
- package/resources/webhook-events.d.ts.map +1 -1
- package/src/client.ts +48 -5
- package/src/internal/parse.ts +6 -0
- package/src/resources/balances.ts +271 -0
- package/src/resources/checkout-sessions.ts +338 -577
- package/src/resources/index.ts +14 -0
- package/src/resources/payments.ts +6 -0
- package/src/resources/subscriptions.ts +22 -0
- package/src/resources/webhook-events.ts +6 -1
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -25,8 +25,127 @@ export class CheckoutSessions extends APIResource {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
export interface CheckoutSessionBillingAddress {
|
|
29
|
+
/**
|
|
30
|
+
* Two-letter ISO country code (ISO 3166-1 alpha-2)
|
|
31
|
+
*/
|
|
32
|
+
country: MiscAPI.CountryCode;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* City name
|
|
36
|
+
*/
|
|
37
|
+
city?: string | null;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* State or province name
|
|
41
|
+
*/
|
|
42
|
+
state?: string | null;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Street address including house number and unit/apartment if applicable
|
|
46
|
+
*/
|
|
47
|
+
street?: string | null;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Postal code or ZIP code
|
|
51
|
+
*/
|
|
52
|
+
zipcode?: string | null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface CheckoutSessionCustomization {
|
|
56
|
+
/**
|
|
57
|
+
* Force the checkout interface to render in a specific language (e.g. `en`, `es`)
|
|
58
|
+
*/
|
|
59
|
+
force_language?: string | null;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Show on demand tag
|
|
63
|
+
*
|
|
64
|
+
* Default is true
|
|
65
|
+
*/
|
|
66
|
+
show_on_demand_tag?: boolean;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Show order details by default
|
|
70
|
+
*
|
|
71
|
+
* Default is true
|
|
72
|
+
*/
|
|
73
|
+
show_order_details?: boolean;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Theme of the page (determines which mode - light/dark/system - to use)
|
|
77
|
+
*
|
|
78
|
+
* Default is `System`.
|
|
79
|
+
*/
|
|
80
|
+
theme?: 'dark' | 'light' | 'system';
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Optional custom theme configuration with colors for light and dark modes
|
|
84
|
+
*/
|
|
85
|
+
theme_config?: ThemeConfig | null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface CheckoutSessionFlags {
|
|
89
|
+
/**
|
|
90
|
+
* if customer is allowed to change currency, set it to true
|
|
91
|
+
*
|
|
92
|
+
* Default is true
|
|
93
|
+
*/
|
|
94
|
+
allow_currency_selection?: boolean;
|
|
95
|
+
|
|
96
|
+
allow_customer_editing_city?: boolean;
|
|
97
|
+
|
|
98
|
+
allow_customer_editing_country?: boolean;
|
|
99
|
+
|
|
100
|
+
allow_customer_editing_email?: boolean;
|
|
101
|
+
|
|
102
|
+
allow_customer_editing_name?: boolean;
|
|
103
|
+
|
|
104
|
+
allow_customer_editing_state?: boolean;
|
|
105
|
+
|
|
106
|
+
allow_customer_editing_street?: boolean;
|
|
107
|
+
|
|
108
|
+
allow_customer_editing_zipcode?: boolean;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* If the customer is allowed to apply discount code, set it to true.
|
|
112
|
+
*
|
|
113
|
+
* Default is true
|
|
114
|
+
*/
|
|
115
|
+
allow_discount_code?: boolean;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* If phone number is collected from customer, set it to rue
|
|
119
|
+
*
|
|
120
|
+
* Default is true
|
|
121
|
+
*/
|
|
122
|
+
allow_phone_number_collection?: boolean;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* If the customer is allowed to add tax id, set it to true
|
|
126
|
+
*
|
|
127
|
+
* Default is true
|
|
128
|
+
*/
|
|
129
|
+
allow_tax_id?: boolean;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Set to true if a new customer object should be created. By default email is used
|
|
133
|
+
* to find an existing customer to attach the session to
|
|
134
|
+
*
|
|
135
|
+
* Default is false
|
|
136
|
+
*/
|
|
137
|
+
always_create_new_customer?: boolean;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* If true, redirects the customer immediately after payment completion
|
|
141
|
+
*
|
|
142
|
+
* Default is false
|
|
143
|
+
*/
|
|
144
|
+
redirect_immediately?: boolean;
|
|
145
|
+
}
|
|
146
|
+
|
|
28
147
|
export interface CheckoutSessionRequest {
|
|
29
|
-
product_cart: Array<
|
|
148
|
+
product_cart: Array<ProductItemReq>;
|
|
30
149
|
|
|
31
150
|
/**
|
|
32
151
|
* Customers will never see payment methods that are not in this list. However,
|
|
@@ -41,7 +160,7 @@ export interface CheckoutSessionRequest {
|
|
|
41
160
|
/**
|
|
42
161
|
* Billing address information for the session
|
|
43
162
|
*/
|
|
44
|
-
billing_address?:
|
|
163
|
+
billing_address?: CheckoutSessionBillingAddress | null;
|
|
45
164
|
|
|
46
165
|
/**
|
|
47
166
|
* This field is ingored if adaptive pricing is disabled
|
|
@@ -57,7 +176,7 @@ export interface CheckoutSessionRequest {
|
|
|
57
176
|
/**
|
|
58
177
|
* Custom fields to collect from customer during checkout (max 5 fields)
|
|
59
178
|
*/
|
|
60
|
-
custom_fields?: Array<
|
|
179
|
+
custom_fields?: Array<CustomField> | null;
|
|
61
180
|
|
|
62
181
|
/**
|
|
63
182
|
* Customer details for the session
|
|
@@ -67,11 +186,11 @@ export interface CheckoutSessionRequest {
|
|
|
67
186
|
/**
|
|
68
187
|
* Customization for the checkout session page
|
|
69
188
|
*/
|
|
70
|
-
customization?:
|
|
189
|
+
customization?: CheckoutSessionCustomization;
|
|
71
190
|
|
|
72
191
|
discount_code?: string | null;
|
|
73
192
|
|
|
74
|
-
feature_flags?:
|
|
193
|
+
feature_flags?: CheckoutSessionFlags;
|
|
75
194
|
|
|
76
195
|
/**
|
|
77
196
|
* Override merchant default 3DS behaviour for this session
|
|
@@ -116,247 +235,265 @@ export interface CheckoutSessionRequest {
|
|
|
116
235
|
*/
|
|
117
236
|
show_saved_payment_methods?: boolean;
|
|
118
237
|
|
|
119
|
-
subscription_data?:
|
|
238
|
+
subscription_data?: SubscriptionData | null;
|
|
120
239
|
}
|
|
121
240
|
|
|
122
|
-
export
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
product_id: string;
|
|
241
|
+
export interface CheckoutSessionResponse {
|
|
242
|
+
/**
|
|
243
|
+
* The ID of the created checkout session
|
|
244
|
+
*/
|
|
245
|
+
session_id: string;
|
|
128
246
|
|
|
129
|
-
|
|
247
|
+
/**
|
|
248
|
+
* Checkout url (None when payment_method_id is provided)
|
|
249
|
+
*/
|
|
250
|
+
checkout_url?: string | null;
|
|
251
|
+
}
|
|
130
252
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
253
|
+
export interface CheckoutSessionStatus {
|
|
254
|
+
/**
|
|
255
|
+
* Id of the checkout session
|
|
256
|
+
*/
|
|
257
|
+
id: string;
|
|
135
258
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
* for one time payments
|
|
141
|
-
*
|
|
142
|
-
* If amount is not set for pay_what_you_want product, customer is allowed to
|
|
143
|
-
* select the amount.
|
|
144
|
-
*/
|
|
145
|
-
amount?: number | null;
|
|
146
|
-
}
|
|
259
|
+
/**
|
|
260
|
+
* Created at timestamp
|
|
261
|
+
*/
|
|
262
|
+
created_at: string;
|
|
147
263
|
|
|
148
264
|
/**
|
|
149
|
-
*
|
|
265
|
+
* Customer email: prefers payment's customer, falls back to session
|
|
150
266
|
*/
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Two-letter ISO country code (ISO 3166-1 alpha-2)
|
|
154
|
-
*/
|
|
155
|
-
country: MiscAPI.CountryCode;
|
|
267
|
+
customer_email?: string | null;
|
|
156
268
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
269
|
+
/**
|
|
270
|
+
* Customer name: prefers payment's customer, falls back to session
|
|
271
|
+
*/
|
|
272
|
+
customer_name?: string | null;
|
|
161
273
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
274
|
+
/**
|
|
275
|
+
* Id of the payment created by the checkout sessions.
|
|
276
|
+
*
|
|
277
|
+
* Null if checkout sessions is still at the details collection stage.
|
|
278
|
+
*/
|
|
279
|
+
payment_id?: string | null;
|
|
166
280
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
281
|
+
/**
|
|
282
|
+
* status of the payment.
|
|
283
|
+
*
|
|
284
|
+
* Null if checkout sessions is still at the details collection stage.
|
|
285
|
+
*/
|
|
286
|
+
payment_status?: PaymentsAPI.IntentStatus | null;
|
|
287
|
+
}
|
|
171
288
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
289
|
+
/**
|
|
290
|
+
* Definition of a custom field for checkout
|
|
291
|
+
*/
|
|
292
|
+
export interface CustomField {
|
|
293
|
+
/**
|
|
294
|
+
* Type of field determining validation rules
|
|
295
|
+
*/
|
|
296
|
+
field_type: 'text' | 'number' | 'email' | 'url' | 'date' | 'dropdown' | 'boolean';
|
|
177
297
|
|
|
178
298
|
/**
|
|
179
|
-
*
|
|
299
|
+
* Unique identifier for this field (used as key in responses)
|
|
180
300
|
*/
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Type of field determining validation rules
|
|
184
|
-
*/
|
|
185
|
-
field_type: 'text' | 'number' | 'email' | 'url' | 'phone' | 'date' | 'datetime' | 'dropdown' | 'boolean';
|
|
301
|
+
key: string;
|
|
186
302
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
303
|
+
/**
|
|
304
|
+
* Display label shown to customer
|
|
305
|
+
*/
|
|
306
|
+
label: string;
|
|
191
307
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
308
|
+
/**
|
|
309
|
+
* Options for dropdown type (required for dropdown, ignored for others)
|
|
310
|
+
*/
|
|
311
|
+
options?: Array<string> | null;
|
|
196
312
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
313
|
+
/**
|
|
314
|
+
* Placeholder text for the input
|
|
315
|
+
*/
|
|
316
|
+
placeholder?: string | null;
|
|
201
317
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
318
|
+
/**
|
|
319
|
+
* Whether this field is required
|
|
320
|
+
*/
|
|
321
|
+
required?: boolean;
|
|
322
|
+
}
|
|
206
323
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
324
|
+
export interface ProductItemReq {
|
|
325
|
+
/**
|
|
326
|
+
* unique id of the product
|
|
327
|
+
*/
|
|
328
|
+
product_id: string;
|
|
329
|
+
|
|
330
|
+
quantity: number;
|
|
212
331
|
|
|
213
332
|
/**
|
|
214
|
-
*
|
|
333
|
+
* only valid if product is a subscription
|
|
215
334
|
*/
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Force the checkout interface to render in a specific language (e.g. `en`, `es`)
|
|
219
|
-
*/
|
|
220
|
-
force_language?: string | null;
|
|
335
|
+
addons?: Array<SubscriptionsAPI.AttachAddon> | null;
|
|
221
336
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
337
|
+
/**
|
|
338
|
+
* Amount the customer pays if pay_what_you_want is enabled. If disabled then
|
|
339
|
+
* amount will be ignored Represented in the lowest denomination of the currency
|
|
340
|
+
* (e.g., cents for USD). For example, to charge $1.00, pass `100`. Only applicable
|
|
341
|
+
* for one time payments
|
|
342
|
+
*
|
|
343
|
+
* If amount is not set for pay_what_you_want product, customer is allowed to
|
|
344
|
+
* select the amount.
|
|
345
|
+
*/
|
|
346
|
+
amount?: number | null;
|
|
347
|
+
}
|
|
228
348
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
*
|
|
232
|
-
* Default is true
|
|
233
|
-
*/
|
|
234
|
-
show_order_details?: boolean;
|
|
349
|
+
export interface SubscriptionData {
|
|
350
|
+
on_demand?: SubscriptionsAPI.OnDemandSubscription | null;
|
|
235
351
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
352
|
+
/**
|
|
353
|
+
* Optional trial period in days If specified, this value overrides the trial
|
|
354
|
+
* period set in the product's price Must be between 0 and 10000 days
|
|
355
|
+
*/
|
|
356
|
+
trial_period_days?: number | null;
|
|
357
|
+
}
|
|
243
358
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
359
|
+
/**
|
|
360
|
+
* Custom theme configuration with colors for light and dark modes.
|
|
361
|
+
*/
|
|
362
|
+
export interface ThemeConfig {
|
|
363
|
+
/**
|
|
364
|
+
* Dark mode color configuration
|
|
365
|
+
*/
|
|
366
|
+
dark?: ThemeModeConfig | null;
|
|
251
367
|
|
|
252
|
-
|
|
368
|
+
/**
|
|
369
|
+
* URL for the primary font
|
|
370
|
+
*/
|
|
371
|
+
font_primary_url?: string | null;
|
|
253
372
|
|
|
254
|
-
|
|
373
|
+
/**
|
|
374
|
+
* URL for the secondary font
|
|
375
|
+
*/
|
|
376
|
+
font_secondary_url?: string | null;
|
|
255
377
|
|
|
256
|
-
|
|
378
|
+
/**
|
|
379
|
+
* Font size for the checkout UI
|
|
380
|
+
*/
|
|
381
|
+
font_size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | null;
|
|
257
382
|
|
|
258
|
-
|
|
383
|
+
/**
|
|
384
|
+
* Font weight for the checkout UI
|
|
385
|
+
*/
|
|
386
|
+
font_weight?: 'normal' | 'medium' | 'bold' | 'extraBold' | null;
|
|
259
387
|
|
|
260
|
-
|
|
388
|
+
/**
|
|
389
|
+
* Light mode color configuration
|
|
390
|
+
*/
|
|
391
|
+
light?: ThemeModeConfig | null;
|
|
261
392
|
|
|
262
|
-
|
|
393
|
+
/**
|
|
394
|
+
* Custom text for the pay button (e.g., "Complete Purchase", "Subscribe Now")
|
|
395
|
+
*/
|
|
396
|
+
pay_button_text?: string | null;
|
|
263
397
|
|
|
264
|
-
|
|
398
|
+
/**
|
|
399
|
+
* Border radius for UI elements (e.g., "4px", "0.5rem", "8px")
|
|
400
|
+
*/
|
|
401
|
+
radius?: string | null;
|
|
402
|
+
}
|
|
265
403
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
404
|
+
/**
|
|
405
|
+
* Color configuration for a single theme mode (light or dark).
|
|
406
|
+
*
|
|
407
|
+
* All color fields accept standard CSS color formats:
|
|
408
|
+
*
|
|
409
|
+
* - Hex: `#fff`, `#ffffff`, `#ffffffff` (with or without # prefix)
|
|
410
|
+
* - RGB/RGBA: `rgb(255, 255, 255)`, `rgba(255, 255, 255, 0.5)`
|
|
411
|
+
* - HSL/HSLA: `hsl(120, 100%, 50%)`, `hsla(120, 100%, 50%, 0.5)`
|
|
412
|
+
* - Named colors: `red`, `blue`, `transparent`, etc.
|
|
413
|
+
* - Advanced: `hwb()`, `lab()`, `lch()`, `oklab()`, `oklch()`, `color()`
|
|
414
|
+
*/
|
|
415
|
+
export interface ThemeModeConfig {
|
|
416
|
+
/**
|
|
417
|
+
* Background primary color
|
|
418
|
+
*
|
|
419
|
+
* Examples: `"#ffffff"`, `"rgb(255, 255, 255)"`, `"white"`
|
|
420
|
+
*/
|
|
421
|
+
bg_primary?: string | null;
|
|
272
422
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
*/
|
|
278
|
-
allow_phone_number_collection?: boolean;
|
|
423
|
+
/**
|
|
424
|
+
* Background secondary color
|
|
425
|
+
*/
|
|
426
|
+
bg_secondary?: string | null;
|
|
279
427
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
*/
|
|
285
|
-
allow_tax_id?: boolean;
|
|
428
|
+
/**
|
|
429
|
+
* Border primary color
|
|
430
|
+
*/
|
|
431
|
+
border_primary?: string | null;
|
|
286
432
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
* Default is false
|
|
292
|
-
*/
|
|
293
|
-
always_create_new_customer?: boolean;
|
|
433
|
+
/**
|
|
434
|
+
* Border secondary color
|
|
435
|
+
*/
|
|
436
|
+
border_secondary?: string | null;
|
|
294
437
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
*/
|
|
300
|
-
redirect_immediately?: boolean;
|
|
301
|
-
}
|
|
438
|
+
/**
|
|
439
|
+
* Primary button background color
|
|
440
|
+
*/
|
|
441
|
+
button_primary?: string | null;
|
|
302
442
|
|
|
303
|
-
|
|
304
|
-
|
|
443
|
+
/**
|
|
444
|
+
* Primary button hover color
|
|
445
|
+
*/
|
|
446
|
+
button_primary_hover?: string | null;
|
|
305
447
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
trial_period_days?: number | null;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
448
|
+
/**
|
|
449
|
+
* Secondary button background color
|
|
450
|
+
*/
|
|
451
|
+
button_secondary?: string | null;
|
|
313
452
|
|
|
314
|
-
export interface CheckoutSessionResponse {
|
|
315
453
|
/**
|
|
316
|
-
*
|
|
454
|
+
* Secondary button hover color
|
|
317
455
|
*/
|
|
318
|
-
|
|
456
|
+
button_secondary_hover?: string | null;
|
|
319
457
|
|
|
320
458
|
/**
|
|
321
|
-
*
|
|
459
|
+
* Primary button text color
|
|
322
460
|
*/
|
|
323
|
-
|
|
324
|
-
}
|
|
461
|
+
button_text_primary?: string | null;
|
|
325
462
|
|
|
326
|
-
export interface CheckoutSessionStatus {
|
|
327
463
|
/**
|
|
328
|
-
*
|
|
464
|
+
* Secondary button text color
|
|
329
465
|
*/
|
|
330
|
-
|
|
466
|
+
button_text_secondary?: string | null;
|
|
331
467
|
|
|
332
468
|
/**
|
|
333
|
-
*
|
|
469
|
+
* Input focus border color
|
|
334
470
|
*/
|
|
335
|
-
|
|
471
|
+
input_focus_border?: string | null;
|
|
336
472
|
|
|
337
473
|
/**
|
|
338
|
-
*
|
|
474
|
+
* Text error color
|
|
339
475
|
*/
|
|
340
|
-
|
|
476
|
+
text_error?: string | null;
|
|
341
477
|
|
|
342
478
|
/**
|
|
343
|
-
*
|
|
479
|
+
* Text placeholder color
|
|
344
480
|
*/
|
|
345
|
-
|
|
481
|
+
text_placeholder?: string | null;
|
|
346
482
|
|
|
347
483
|
/**
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
* Null if checkout sessions is still at the details collection stage.
|
|
484
|
+
* Text primary color
|
|
351
485
|
*/
|
|
352
|
-
|
|
486
|
+
text_primary?: string | null;
|
|
353
487
|
|
|
354
488
|
/**
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
* Null if checkout sessions is still at the details collection stage.
|
|
489
|
+
* Text secondary color
|
|
358
490
|
*/
|
|
359
|
-
|
|
491
|
+
text_secondary?: string | null;
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Text success color
|
|
495
|
+
*/
|
|
496
|
+
text_success?: string | null;
|
|
360
497
|
}
|
|
361
498
|
|
|
362
499
|
/**
|
|
@@ -578,7 +715,7 @@ export namespace CheckoutSessionPreviewResponse {
|
|
|
578
715
|
}
|
|
579
716
|
|
|
580
717
|
export interface CheckoutSessionCreateParams {
|
|
581
|
-
product_cart: Array<
|
|
718
|
+
product_cart: Array<ProductItemReq>;
|
|
582
719
|
|
|
583
720
|
/**
|
|
584
721
|
* Customers will never see payment methods that are not in this list. However,
|
|
@@ -593,7 +730,7 @@ export interface CheckoutSessionCreateParams {
|
|
|
593
730
|
/**
|
|
594
731
|
* Billing address information for the session
|
|
595
732
|
*/
|
|
596
|
-
billing_address?:
|
|
733
|
+
billing_address?: CheckoutSessionBillingAddress | null;
|
|
597
734
|
|
|
598
735
|
/**
|
|
599
736
|
* This field is ingored if adaptive pricing is disabled
|
|
@@ -609,7 +746,7 @@ export interface CheckoutSessionCreateParams {
|
|
|
609
746
|
/**
|
|
610
747
|
* Custom fields to collect from customer during checkout (max 5 fields)
|
|
611
748
|
*/
|
|
612
|
-
custom_fields?: Array<
|
|
749
|
+
custom_fields?: Array<CustomField> | null;
|
|
613
750
|
|
|
614
751
|
/**
|
|
615
752
|
* Customer details for the session
|
|
@@ -619,11 +756,11 @@ export interface CheckoutSessionCreateParams {
|
|
|
619
756
|
/**
|
|
620
757
|
* Customization for the checkout session page
|
|
621
758
|
*/
|
|
622
|
-
customization?:
|
|
759
|
+
customization?: CheckoutSessionCustomization;
|
|
623
760
|
|
|
624
761
|
discount_code?: string | null;
|
|
625
762
|
|
|
626
|
-
feature_flags?:
|
|
763
|
+
feature_flags?: CheckoutSessionFlags;
|
|
627
764
|
|
|
628
765
|
/**
|
|
629
766
|
* Override merchant default 3DS behaviour for this session
|
|
@@ -668,203 +805,11 @@ export interface CheckoutSessionCreateParams {
|
|
|
668
805
|
*/
|
|
669
806
|
show_saved_payment_methods?: boolean;
|
|
670
807
|
|
|
671
|
-
subscription_data?:
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
export namespace CheckoutSessionCreateParams {
|
|
675
|
-
export interface ProductCart {
|
|
676
|
-
/**
|
|
677
|
-
* unique id of the product
|
|
678
|
-
*/
|
|
679
|
-
product_id: string;
|
|
680
|
-
|
|
681
|
-
quantity: number;
|
|
682
|
-
|
|
683
|
-
/**
|
|
684
|
-
* only valid if product is a subscription
|
|
685
|
-
*/
|
|
686
|
-
addons?: Array<SubscriptionsAPI.AttachAddon> | null;
|
|
687
|
-
|
|
688
|
-
/**
|
|
689
|
-
* Amount the customer pays if pay_what_you_want is enabled. If disabled then
|
|
690
|
-
* amount will be ignored Represented in the lowest denomination of the currency
|
|
691
|
-
* (e.g., cents for USD). For example, to charge $1.00, pass `100`. Only applicable
|
|
692
|
-
* for one time payments
|
|
693
|
-
*
|
|
694
|
-
* If amount is not set for pay_what_you_want product, customer is allowed to
|
|
695
|
-
* select the amount.
|
|
696
|
-
*/
|
|
697
|
-
amount?: number | null;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
/**
|
|
701
|
-
* Billing address information for the session
|
|
702
|
-
*/
|
|
703
|
-
export interface BillingAddress {
|
|
704
|
-
/**
|
|
705
|
-
* Two-letter ISO country code (ISO 3166-1 alpha-2)
|
|
706
|
-
*/
|
|
707
|
-
country: MiscAPI.CountryCode;
|
|
708
|
-
|
|
709
|
-
/**
|
|
710
|
-
* City name
|
|
711
|
-
*/
|
|
712
|
-
city?: string | null;
|
|
713
|
-
|
|
714
|
-
/**
|
|
715
|
-
* State or province name
|
|
716
|
-
*/
|
|
717
|
-
state?: string | null;
|
|
718
|
-
|
|
719
|
-
/**
|
|
720
|
-
* Street address including house number and unit/apartment if applicable
|
|
721
|
-
*/
|
|
722
|
-
street?: string | null;
|
|
723
|
-
|
|
724
|
-
/**
|
|
725
|
-
* Postal code or ZIP code
|
|
726
|
-
*/
|
|
727
|
-
zipcode?: string | null;
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
/**
|
|
731
|
-
* Definition of a custom field for checkout
|
|
732
|
-
*/
|
|
733
|
-
export interface CustomField {
|
|
734
|
-
/**
|
|
735
|
-
* Type of field determining validation rules
|
|
736
|
-
*/
|
|
737
|
-
field_type: 'text' | 'number' | 'email' | 'url' | 'phone' | 'date' | 'datetime' | 'dropdown' | 'boolean';
|
|
738
|
-
|
|
739
|
-
/**
|
|
740
|
-
* Unique identifier for this field (used as key in responses)
|
|
741
|
-
*/
|
|
742
|
-
key: string;
|
|
743
|
-
|
|
744
|
-
/**
|
|
745
|
-
* Display label shown to customer
|
|
746
|
-
*/
|
|
747
|
-
label: string;
|
|
748
|
-
|
|
749
|
-
/**
|
|
750
|
-
* Options for dropdown type (required for dropdown, ignored for others)
|
|
751
|
-
*/
|
|
752
|
-
options?: Array<string> | null;
|
|
753
|
-
|
|
754
|
-
/**
|
|
755
|
-
* Placeholder text for the input
|
|
756
|
-
*/
|
|
757
|
-
placeholder?: string | null;
|
|
758
|
-
|
|
759
|
-
/**
|
|
760
|
-
* Whether this field is required
|
|
761
|
-
*/
|
|
762
|
-
required?: boolean;
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
/**
|
|
766
|
-
* Customization for the checkout session page
|
|
767
|
-
*/
|
|
768
|
-
export interface Customization {
|
|
769
|
-
/**
|
|
770
|
-
* Force the checkout interface to render in a specific language (e.g. `en`, `es`)
|
|
771
|
-
*/
|
|
772
|
-
force_language?: string | null;
|
|
773
|
-
|
|
774
|
-
/**
|
|
775
|
-
* Show on demand tag
|
|
776
|
-
*
|
|
777
|
-
* Default is true
|
|
778
|
-
*/
|
|
779
|
-
show_on_demand_tag?: boolean;
|
|
780
|
-
|
|
781
|
-
/**
|
|
782
|
-
* Show order details by default
|
|
783
|
-
*
|
|
784
|
-
* Default is true
|
|
785
|
-
*/
|
|
786
|
-
show_order_details?: boolean;
|
|
787
|
-
|
|
788
|
-
/**
|
|
789
|
-
* Theme of the page
|
|
790
|
-
*
|
|
791
|
-
* Default is `System`.
|
|
792
|
-
*/
|
|
793
|
-
theme?: 'dark' | 'light' | 'system';
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
export interface FeatureFlags {
|
|
797
|
-
/**
|
|
798
|
-
* if customer is allowed to change currency, set it to true
|
|
799
|
-
*
|
|
800
|
-
* Default is true
|
|
801
|
-
*/
|
|
802
|
-
allow_currency_selection?: boolean;
|
|
803
|
-
|
|
804
|
-
allow_customer_editing_city?: boolean;
|
|
805
|
-
|
|
806
|
-
allow_customer_editing_country?: boolean;
|
|
807
|
-
|
|
808
|
-
allow_customer_editing_email?: boolean;
|
|
809
|
-
|
|
810
|
-
allow_customer_editing_name?: boolean;
|
|
811
|
-
|
|
812
|
-
allow_customer_editing_state?: boolean;
|
|
813
|
-
|
|
814
|
-
allow_customer_editing_street?: boolean;
|
|
815
|
-
|
|
816
|
-
allow_customer_editing_zipcode?: boolean;
|
|
817
|
-
|
|
818
|
-
/**
|
|
819
|
-
* If the customer is allowed to apply discount code, set it to true.
|
|
820
|
-
*
|
|
821
|
-
* Default is true
|
|
822
|
-
*/
|
|
823
|
-
allow_discount_code?: boolean;
|
|
824
|
-
|
|
825
|
-
/**
|
|
826
|
-
* If phone number is collected from customer, set it to rue
|
|
827
|
-
*
|
|
828
|
-
* Default is true
|
|
829
|
-
*/
|
|
830
|
-
allow_phone_number_collection?: boolean;
|
|
831
|
-
|
|
832
|
-
/**
|
|
833
|
-
* If the customer is allowed to add tax id, set it to true
|
|
834
|
-
*
|
|
835
|
-
* Default is true
|
|
836
|
-
*/
|
|
837
|
-
allow_tax_id?: boolean;
|
|
838
|
-
|
|
839
|
-
/**
|
|
840
|
-
* Set to true if a new customer object should be created. By default email is used
|
|
841
|
-
* to find an existing customer to attach the session to
|
|
842
|
-
*
|
|
843
|
-
* Default is false
|
|
844
|
-
*/
|
|
845
|
-
always_create_new_customer?: boolean;
|
|
846
|
-
|
|
847
|
-
/**
|
|
848
|
-
* If true, redirects the customer immediately after payment completion
|
|
849
|
-
*
|
|
850
|
-
* Default is false
|
|
851
|
-
*/
|
|
852
|
-
redirect_immediately?: boolean;
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
export interface SubscriptionData {
|
|
856
|
-
on_demand?: SubscriptionsAPI.OnDemandSubscription | null;
|
|
857
|
-
|
|
858
|
-
/**
|
|
859
|
-
* Optional trial period in days If specified, this value overrides the trial
|
|
860
|
-
* period set in the product's price Must be between 0 and 10000 days
|
|
861
|
-
*/
|
|
862
|
-
trial_period_days?: number | null;
|
|
863
|
-
}
|
|
808
|
+
subscription_data?: SubscriptionData | null;
|
|
864
809
|
}
|
|
865
810
|
|
|
866
811
|
export interface CheckoutSessionPreviewParams {
|
|
867
|
-
product_cart: Array<
|
|
812
|
+
product_cart: Array<ProductItemReq>;
|
|
868
813
|
|
|
869
814
|
/**
|
|
870
815
|
* Customers will never see payment methods that are not in this list. However,
|
|
@@ -879,7 +824,7 @@ export interface CheckoutSessionPreviewParams {
|
|
|
879
824
|
/**
|
|
880
825
|
* Billing address information for the session
|
|
881
826
|
*/
|
|
882
|
-
billing_address?:
|
|
827
|
+
billing_address?: CheckoutSessionBillingAddress | null;
|
|
883
828
|
|
|
884
829
|
/**
|
|
885
830
|
* This field is ingored if adaptive pricing is disabled
|
|
@@ -895,7 +840,7 @@ export interface CheckoutSessionPreviewParams {
|
|
|
895
840
|
/**
|
|
896
841
|
* Custom fields to collect from customer during checkout (max 5 fields)
|
|
897
842
|
*/
|
|
898
|
-
custom_fields?: Array<
|
|
843
|
+
custom_fields?: Array<CustomField> | null;
|
|
899
844
|
|
|
900
845
|
/**
|
|
901
846
|
* Customer details for the session
|
|
@@ -905,11 +850,11 @@ export interface CheckoutSessionPreviewParams {
|
|
|
905
850
|
/**
|
|
906
851
|
* Customization for the checkout session page
|
|
907
852
|
*/
|
|
908
|
-
customization?:
|
|
853
|
+
customization?: CheckoutSessionCustomization;
|
|
909
854
|
|
|
910
855
|
discount_code?: string | null;
|
|
911
856
|
|
|
912
|
-
feature_flags?:
|
|
857
|
+
feature_flags?: CheckoutSessionFlags;
|
|
913
858
|
|
|
914
859
|
/**
|
|
915
860
|
* Override merchant default 3DS behaviour for this session
|
|
@@ -954,206 +899,22 @@ export interface CheckoutSessionPreviewParams {
|
|
|
954
899
|
*/
|
|
955
900
|
show_saved_payment_methods?: boolean;
|
|
956
901
|
|
|
957
|
-
subscription_data?:
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
export namespace CheckoutSessionPreviewParams {
|
|
961
|
-
export interface ProductCart {
|
|
962
|
-
/**
|
|
963
|
-
* unique id of the product
|
|
964
|
-
*/
|
|
965
|
-
product_id: string;
|
|
966
|
-
|
|
967
|
-
quantity: number;
|
|
968
|
-
|
|
969
|
-
/**
|
|
970
|
-
* only valid if product is a subscription
|
|
971
|
-
*/
|
|
972
|
-
addons?: Array<SubscriptionsAPI.AttachAddon> | null;
|
|
973
|
-
|
|
974
|
-
/**
|
|
975
|
-
* Amount the customer pays if pay_what_you_want is enabled. If disabled then
|
|
976
|
-
* amount will be ignored Represented in the lowest denomination of the currency
|
|
977
|
-
* (e.g., cents for USD). For example, to charge $1.00, pass `100`. Only applicable
|
|
978
|
-
* for one time payments
|
|
979
|
-
*
|
|
980
|
-
* If amount is not set for pay_what_you_want product, customer is allowed to
|
|
981
|
-
* select the amount.
|
|
982
|
-
*/
|
|
983
|
-
amount?: number | null;
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
/**
|
|
987
|
-
* Billing address information for the session
|
|
988
|
-
*/
|
|
989
|
-
export interface BillingAddress {
|
|
990
|
-
/**
|
|
991
|
-
* Two-letter ISO country code (ISO 3166-1 alpha-2)
|
|
992
|
-
*/
|
|
993
|
-
country: MiscAPI.CountryCode;
|
|
994
|
-
|
|
995
|
-
/**
|
|
996
|
-
* City name
|
|
997
|
-
*/
|
|
998
|
-
city?: string | null;
|
|
999
|
-
|
|
1000
|
-
/**
|
|
1001
|
-
* State or province name
|
|
1002
|
-
*/
|
|
1003
|
-
state?: string | null;
|
|
1004
|
-
|
|
1005
|
-
/**
|
|
1006
|
-
* Street address including house number and unit/apartment if applicable
|
|
1007
|
-
*/
|
|
1008
|
-
street?: string | null;
|
|
1009
|
-
|
|
1010
|
-
/**
|
|
1011
|
-
* Postal code or ZIP code
|
|
1012
|
-
*/
|
|
1013
|
-
zipcode?: string | null;
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
/**
|
|
1017
|
-
* Definition of a custom field for checkout
|
|
1018
|
-
*/
|
|
1019
|
-
export interface CustomField {
|
|
1020
|
-
/**
|
|
1021
|
-
* Type of field determining validation rules
|
|
1022
|
-
*/
|
|
1023
|
-
field_type: 'text' | 'number' | 'email' | 'url' | 'phone' | 'date' | 'datetime' | 'dropdown' | 'boolean';
|
|
1024
|
-
|
|
1025
|
-
/**
|
|
1026
|
-
* Unique identifier for this field (used as key in responses)
|
|
1027
|
-
*/
|
|
1028
|
-
key: string;
|
|
1029
|
-
|
|
1030
|
-
/**
|
|
1031
|
-
* Display label shown to customer
|
|
1032
|
-
*/
|
|
1033
|
-
label: string;
|
|
1034
|
-
|
|
1035
|
-
/**
|
|
1036
|
-
* Options for dropdown type (required for dropdown, ignored for others)
|
|
1037
|
-
*/
|
|
1038
|
-
options?: Array<string> | null;
|
|
1039
|
-
|
|
1040
|
-
/**
|
|
1041
|
-
* Placeholder text for the input
|
|
1042
|
-
*/
|
|
1043
|
-
placeholder?: string | null;
|
|
1044
|
-
|
|
1045
|
-
/**
|
|
1046
|
-
* Whether this field is required
|
|
1047
|
-
*/
|
|
1048
|
-
required?: boolean;
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
/**
|
|
1052
|
-
* Customization for the checkout session page
|
|
1053
|
-
*/
|
|
1054
|
-
export interface Customization {
|
|
1055
|
-
/**
|
|
1056
|
-
* Force the checkout interface to render in a specific language (e.g. `en`, `es`)
|
|
1057
|
-
*/
|
|
1058
|
-
force_language?: string | null;
|
|
1059
|
-
|
|
1060
|
-
/**
|
|
1061
|
-
* Show on demand tag
|
|
1062
|
-
*
|
|
1063
|
-
* Default is true
|
|
1064
|
-
*/
|
|
1065
|
-
show_on_demand_tag?: boolean;
|
|
1066
|
-
|
|
1067
|
-
/**
|
|
1068
|
-
* Show order details by default
|
|
1069
|
-
*
|
|
1070
|
-
* Default is true
|
|
1071
|
-
*/
|
|
1072
|
-
show_order_details?: boolean;
|
|
1073
|
-
|
|
1074
|
-
/**
|
|
1075
|
-
* Theme of the page
|
|
1076
|
-
*
|
|
1077
|
-
* Default is `System`.
|
|
1078
|
-
*/
|
|
1079
|
-
theme?: 'dark' | 'light' | 'system';
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
export interface FeatureFlags {
|
|
1083
|
-
/**
|
|
1084
|
-
* if customer is allowed to change currency, set it to true
|
|
1085
|
-
*
|
|
1086
|
-
* Default is true
|
|
1087
|
-
*/
|
|
1088
|
-
allow_currency_selection?: boolean;
|
|
1089
|
-
|
|
1090
|
-
allow_customer_editing_city?: boolean;
|
|
1091
|
-
|
|
1092
|
-
allow_customer_editing_country?: boolean;
|
|
1093
|
-
|
|
1094
|
-
allow_customer_editing_email?: boolean;
|
|
1095
|
-
|
|
1096
|
-
allow_customer_editing_name?: boolean;
|
|
1097
|
-
|
|
1098
|
-
allow_customer_editing_state?: boolean;
|
|
1099
|
-
|
|
1100
|
-
allow_customer_editing_street?: boolean;
|
|
1101
|
-
|
|
1102
|
-
allow_customer_editing_zipcode?: boolean;
|
|
1103
|
-
|
|
1104
|
-
/**
|
|
1105
|
-
* If the customer is allowed to apply discount code, set it to true.
|
|
1106
|
-
*
|
|
1107
|
-
* Default is true
|
|
1108
|
-
*/
|
|
1109
|
-
allow_discount_code?: boolean;
|
|
1110
|
-
|
|
1111
|
-
/**
|
|
1112
|
-
* If phone number is collected from customer, set it to rue
|
|
1113
|
-
*
|
|
1114
|
-
* Default is true
|
|
1115
|
-
*/
|
|
1116
|
-
allow_phone_number_collection?: boolean;
|
|
1117
|
-
|
|
1118
|
-
/**
|
|
1119
|
-
* If the customer is allowed to add tax id, set it to true
|
|
1120
|
-
*
|
|
1121
|
-
* Default is true
|
|
1122
|
-
*/
|
|
1123
|
-
allow_tax_id?: boolean;
|
|
1124
|
-
|
|
1125
|
-
/**
|
|
1126
|
-
* Set to true if a new customer object should be created. By default email is used
|
|
1127
|
-
* to find an existing customer to attach the session to
|
|
1128
|
-
*
|
|
1129
|
-
* Default is false
|
|
1130
|
-
*/
|
|
1131
|
-
always_create_new_customer?: boolean;
|
|
1132
|
-
|
|
1133
|
-
/**
|
|
1134
|
-
* If true, redirects the customer immediately after payment completion
|
|
1135
|
-
*
|
|
1136
|
-
* Default is false
|
|
1137
|
-
*/
|
|
1138
|
-
redirect_immediately?: boolean;
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
export interface SubscriptionData {
|
|
1142
|
-
on_demand?: SubscriptionsAPI.OnDemandSubscription | null;
|
|
1143
|
-
|
|
1144
|
-
/**
|
|
1145
|
-
* Optional trial period in days If specified, this value overrides the trial
|
|
1146
|
-
* period set in the product's price Must be between 0 and 10000 days
|
|
1147
|
-
*/
|
|
1148
|
-
trial_period_days?: number | null;
|
|
1149
|
-
}
|
|
902
|
+
subscription_data?: SubscriptionData | null;
|
|
1150
903
|
}
|
|
1151
904
|
|
|
1152
905
|
export declare namespace CheckoutSessions {
|
|
1153
906
|
export {
|
|
907
|
+
type CheckoutSessionBillingAddress as CheckoutSessionBillingAddress,
|
|
908
|
+
type CheckoutSessionCustomization as CheckoutSessionCustomization,
|
|
909
|
+
type CheckoutSessionFlags as CheckoutSessionFlags,
|
|
1154
910
|
type CheckoutSessionRequest as CheckoutSessionRequest,
|
|
1155
911
|
type CheckoutSessionResponse as CheckoutSessionResponse,
|
|
1156
912
|
type CheckoutSessionStatus as CheckoutSessionStatus,
|
|
913
|
+
type CustomField as CustomField,
|
|
914
|
+
type ProductItemReq as ProductItemReq,
|
|
915
|
+
type SubscriptionData as SubscriptionData,
|
|
916
|
+
type ThemeConfig as ThemeConfig,
|
|
917
|
+
type ThemeModeConfig as ThemeModeConfig,
|
|
1157
918
|
type CheckoutSessionPreviewResponse as CheckoutSessionPreviewResponse,
|
|
1158
919
|
type CheckoutSessionCreateParams as CheckoutSessionCreateParams,
|
|
1159
920
|
type CheckoutSessionPreviewParams as CheckoutSessionPreviewParams,
|