@stripe/stripe-js 4.10.0 → 5.0.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 (33) hide show
  1. package/dist/api/confirmation-tokens.d.mts +0 -3
  2. package/dist/api/confirmation-tokens.d.ts +0 -3
  3. package/dist/index.js +1 -1
  4. package/dist/index.mjs +1 -1
  5. package/dist/pure.js +1 -1
  6. package/dist/pure.mjs +1 -1
  7. package/dist/stripe-js/checkout.d.mts +462 -126
  8. package/dist/stripe-js/checkout.d.ts +462 -126
  9. package/dist/stripe-js/elements/currency-selector.d.mts +93 -0
  10. package/dist/stripe-js/elements/currency-selector.d.ts +93 -0
  11. package/dist/stripe-js/elements/express-checkout.d.mts +3 -0
  12. package/dist/stripe-js/elements/express-checkout.d.ts +3 -0
  13. package/dist/stripe-js/elements/index.d.mts +1 -0
  14. package/dist/stripe-js/elements/index.d.ts +1 -0
  15. package/dist/stripe-js/elements/payment.d.mts +136 -0
  16. package/dist/stripe-js/elements/payment.d.ts +136 -0
  17. package/dist/stripe-js/elements-group.d.mts +37 -7
  18. package/dist/stripe-js/elements-group.d.ts +37 -7
  19. package/dist/stripe-js/embedded-checkout.d.mts +30 -0
  20. package/dist/stripe-js/embedded-checkout.d.ts +30 -0
  21. package/dist/stripe-js/hosted-checkout.d.mts +153 -0
  22. package/dist/stripe-js/hosted-checkout.d.ts +153 -0
  23. package/dist/stripe-js/index.d.mts +1 -1
  24. package/dist/stripe-js/index.d.ts +1 -1
  25. package/dist/stripe-js/payment-intents.d.mts +79 -3
  26. package/dist/stripe-js/payment-intents.d.ts +79 -3
  27. package/dist/stripe-js/setup-intents.d.mts +0 -3
  28. package/dist/stripe-js/setup-intents.d.ts +0 -3
  29. package/dist/stripe-js/stripe.d.mts +38 -8
  30. package/dist/stripe-js/stripe.d.ts +38 -8
  31. package/package.json +1 -1
  32. package/dist/stripe-js/custom-checkout.d.mts +0 -437
  33. package/dist/stripe-js/custom-checkout.d.ts +0 -437
@@ -1,437 +0,0 @@
1
- import {
2
- LayoutObject,
3
- Layout,
4
- TermsOption,
5
- StripePaymentElement,
6
- } from './elements/payment';
7
- import {
8
- AddressMode,
9
- ContactOption,
10
- StripeAddressElement,
11
- } from './elements/address';
12
- import {Appearance, CssFontSource, CustomFontSource} from './elements-group';
13
- import {StripeError} from './stripe';
14
- import {
15
- StripeElementBase,
16
- StripeExpressCheckoutElement,
17
- StripeExpressCheckoutElementConfirmEvent,
18
- StripeExpressCheckoutElementOptions,
19
- StripeExpressCheckoutElementReadyEvent,
20
- } from './elements';
21
-
22
- /**
23
- * Requires beta access:
24
- * Contact [Stripe support](https://support.stripe.com/) for more information.
25
- */
26
-
27
- export interface StripeCustomCheckoutElementsOptions {
28
- appearance?: Appearance;
29
- loader?: 'auto' | 'always' | 'never';
30
- fonts?: Array<CssFontSource | CustomFontSource>;
31
- }
32
-
33
- export interface StripeCustomCheckoutOptions {
34
- clientSecret: string;
35
- elementsOptions?: StripeCustomCheckoutElementsOptions;
36
- }
37
-
38
- /* Custom Checkout types */
39
- export type StripeCustomCheckoutAddress = {
40
- country: string;
41
- line1?: string | null;
42
- line2?: string | null;
43
- city?: string | null;
44
- postal_code?: string | null;
45
- state?: string | null;
46
- };
47
-
48
- export type StripeCustomCheckoutAdjustableQuantity = {
49
- maximum: number;
50
- minimum: number;
51
- };
52
-
53
- export type StripeCustomCheckoutBillingInterval =
54
- | 'day'
55
- | 'month'
56
- | 'week'
57
- | 'year';
58
-
59
- export type StripeCustomCheckoutConfirmationRequirement =
60
- | 'phoneNumber'
61
- | 'shippingAddress'
62
- | 'billingAddress'
63
- | 'paymentDetails'
64
- | 'email';
65
-
66
- export type StripeCustomCheckoutContact = {
67
- name?: string | null;
68
- address: StripeCustomCheckoutAddress;
69
- };
70
-
71
- export type StripeCustomCheckoutDeliveryEstimate = {
72
- maximum: StripeCustomCheckoutEstimate | null;
73
- minimum: StripeCustomCheckoutEstimate | null;
74
- };
75
-
76
- export type StripeCustomCheckoutDiscountAmount = {
77
- amount: number;
78
- displayName: string;
79
- promotionCode: string | null;
80
- recurring:
81
- | {type: 'forever'}
82
- | {type: 'repeating'; durationInMonths: number}
83
- | null;
84
- };
85
-
86
- export type StripeCustomCheckoutDueNext = {
87
- amountSubtotal: number;
88
- amountDiscount: number;
89
- amountTaxInclusive: number;
90
- amountTaxExclusive: number;
91
- billingCycleAnchor: number | null;
92
- };
93
-
94
- export type StripeCustomCheckoutEstimate = {
95
- unit: 'business_day' | 'day' | 'hour' | 'week' | 'month';
96
- value: number;
97
- };
98
-
99
- export type StripeCustomCheckoutLastPaymentError = {
100
- message: string;
101
- };
102
-
103
- export type StripeCustomCheckoutRedirectBehavior = 'always' | 'if_required';
104
-
105
- export type StripeCustomCheckoutSavedPaymentMethod = {
106
- id: string;
107
- type: 'card';
108
- card: {
109
- brand: string;
110
- expMonth: number;
111
- expYear: number;
112
- last4: string;
113
- };
114
- billingDetails: {
115
- email?: string | null;
116
- name?: string | null;
117
- phone?: string | null;
118
- address?: {
119
- line1?: string | null;
120
- line2?: string | null;
121
- city?: string | null;
122
- postal_code?: string | null;
123
- state?: string | null;
124
- country?: string | null;
125
- } | null;
126
- };
127
- };
128
-
129
- export type StripeCustomCheckoutTaxAmount = {
130
- amount: number;
131
- inclusive: boolean;
132
- displayName: string;
133
- };
134
-
135
- export type StripeCustomCheckoutLineItem = {
136
- id: string;
137
- name: string;
138
- amountDiscount: number;
139
- amountSubtotal: number;
140
- amountTaxExclusive: number;
141
- amountTaxInclusive: number;
142
- unitAmount: number;
143
- description: string | null;
144
- quantity: number;
145
- discountAmounts: Array<StripeCustomCheckoutDiscountAmount> | null;
146
- taxAmounts: Array<StripeCustomCheckoutTaxAmount> | null;
147
- recurring: {
148
- interval: StripeCustomCheckoutBillingInterval;
149
- intervalCount: number;
150
- isProrated: boolean;
151
- usageType: 'metered' | 'licensed';
152
- } | null;
153
- adjustableQuantity: StripeCustomCheckoutAdjustableQuantity | null;
154
- };
155
-
156
- export type StripeCustomCheckoutRecurring = {
157
- interval: StripeCustomCheckoutBillingInterval;
158
- intervalCount: number;
159
- dueNext: StripeCustomCheckoutDueNext;
160
- trial: StripeCustomCheckoutTrial | null;
161
- };
162
-
163
- export type StripeCustomCheckoutShipping = {
164
- shippingOption: StripeCustomCheckoutShippingOption;
165
- taxAmounts: Array<StripeCustomCheckoutTaxAmount> | null;
166
- };
167
-
168
- export type StripeCustomCheckoutShippingOption = {
169
- id: string;
170
- amount: number;
171
- currency: string;
172
- displayName: string | null;
173
- deliveryEstimate: StripeCustomCheckoutDeliveryEstimate | null;
174
- };
175
-
176
- export type StripeCustomCheckoutStatus =
177
- | {type: 'open'}
178
- | {type: 'expired'}
179
- | {
180
- type: 'complete';
181
- paymentStatus: 'paid' | 'unpaid' | 'no_payment_required';
182
- };
183
-
184
- export type StripeCustomCheckoutTaxStatus =
185
- | {status: 'ready'}
186
- | {status: 'requires_shipping_address'}
187
- | {status: 'requires_billing_address'};
188
-
189
- export type StripeCustomCheckoutTotalSummary = {
190
- appliedBalance: number;
191
- balanceAppliedToNextInvoice: boolean;
192
- discount: number;
193
- shippingRate: number;
194
- subtotal: number;
195
- taxExclusive: number;
196
- taxInclusive: number;
197
- total: number;
198
- };
199
-
200
- export type StripeCustomCheckoutTrial = {
201
- trialEnd: number;
202
- trialPeriodDays: number;
203
- };
204
-
205
- /* Custom Checkout session */
206
- export interface StripeCustomCheckoutSession {
207
- billingAddress: StripeCustomCheckoutContact | null;
208
- businessName: string | null;
209
- canConfirm: boolean;
210
- confirmationRequirements: StripeCustomCheckoutConfirmationRequirement[];
211
- currency: string;
212
- discountAmounts: Array<StripeCustomCheckoutDiscountAmount> | null;
213
- email: string | null;
214
- id: string;
215
- lastPaymentError: StripeCustomCheckoutLastPaymentError | null;
216
- lineItems: Array<StripeCustomCheckoutLineItem>;
217
- livemode: boolean;
218
- phoneNumber: string | null;
219
- recurring: StripeCustomCheckoutRecurring | null;
220
- savedPaymentMethods: Array<StripeCustomCheckoutSavedPaymentMethod> | null;
221
- shipping: StripeCustomCheckoutShipping | null;
222
- shippingAddress: StripeCustomCheckoutContact | null;
223
- shippingOptions: Array<StripeCustomCheckoutShippingOption>;
224
- status: StripeCustomCheckoutStatus;
225
- tax: StripeCustomCheckoutTaxStatus;
226
- taxAmounts: Array<StripeCustomCheckoutTaxAmount> | null;
227
- total: StripeCustomCheckoutTotalSummary;
228
- }
229
-
230
- export type StripeCustomCheckoutResult =
231
- | {session: StripeCustomCheckoutSession; error?: undefined}
232
- | {session?: undefined; error: StripeError};
233
-
234
- export type StripeCustomCheckoutPaymentElementOptions = {
235
- layout?: Layout | LayoutObject;
236
- paymentMethodOrder?: Array<string>;
237
- readonly?: boolean;
238
- terms?: TermsOption;
239
- };
240
-
241
- export type StripeCustomCheckoutAddressElementOptions = {
242
- mode: AddressMode;
243
- contacts?: ContactOption[];
244
- display?: {
245
- name?: 'full' | 'split' | 'organization';
246
- };
247
- };
248
-
249
- export type StripeCustomCheckoutExpressCheckoutElementOptions = {
250
- buttonHeight: StripeExpressCheckoutElementOptions['buttonHeight'];
251
- buttonTheme: StripeExpressCheckoutElementOptions['buttonTheme'];
252
- buttonType: StripeExpressCheckoutElementOptions['buttonType'];
253
- layout: StripeExpressCheckoutElementOptions['layout'];
254
- paymentMethodOrder: StripeExpressCheckoutElementOptions['paymentMethodOrder'];
255
- };
256
-
257
- export type StripeCustomCheckoutUpdateHandler = (
258
- session: StripeCustomCheckoutSession
259
- ) => void;
260
-
261
- export type StripeCustomCheckoutExpressCheckoutElementConfirmEvent = StripeExpressCheckoutElementConfirmEvent & {
262
- confirm: () => Promise<StripeCustomCheckoutResult>;
263
- };
264
-
265
- export type StripeCustomCheckoutExpressCheckoutElement = StripeElementBase & {
266
- /**
267
- * Triggered when the element is fully rendered.
268
- */
269
- on(
270
- eventType: 'ready',
271
- handler: (event: StripeExpressCheckoutElementReadyEvent) => any
272
- ): StripeCustomCheckoutExpressCheckoutElement;
273
- once(
274
- eventType: 'ready',
275
- handler: (event: StripeExpressCheckoutElementReadyEvent) => any
276
- ): StripeCustomCheckoutExpressCheckoutElement;
277
- off(
278
- eventType: 'ready',
279
- handler?: (event: StripeExpressCheckoutElementReadyEvent) => any
280
- ): StripeCustomCheckoutExpressCheckoutElement;
281
-
282
- /**
283
- * Triggered when the element gains focus.
284
- */
285
- on(
286
- eventType: 'focus',
287
- handler: (event: {elementType: 'expressCheckout'}) => any
288
- ): StripeCustomCheckoutExpressCheckoutElement;
289
- once(
290
- eventType: 'focus',
291
- handler: (event: {elementType: 'expressCheckout'}) => any
292
- ): StripeCustomCheckoutExpressCheckoutElement;
293
- off(
294
- eventType: 'focus',
295
- handler?: (event: {elementType: 'expressCheckout'}) => any
296
- ): StripeCustomCheckoutExpressCheckoutElement;
297
-
298
- /**
299
- * Triggered when the element loses focus.
300
- */
301
- on(
302
- eventType: 'blur',
303
- handler: (event: {elementType: 'expressCheckout'}) => any
304
- ): StripeCustomCheckoutExpressCheckoutElement;
305
- once(
306
- eventType: 'blur',
307
- handler: (event: {elementType: 'expressCheckout'}) => any
308
- ): StripeCustomCheckoutExpressCheckoutElement;
309
- off(
310
- eventType: 'blur',
311
- handler?: (event: {elementType: 'expressCheckout'}) => any
312
- ): StripeCustomCheckoutExpressCheckoutElement;
313
-
314
- /**
315
- * Triggered when the escape key is pressed within the element.
316
- */
317
- on(
318
- eventType: 'escape',
319
- handler: (event: {elementType: 'expressCheckout'}) => any
320
- ): StripeCustomCheckoutExpressCheckoutElement;
321
- once(
322
- eventType: 'escape',
323
- handler: (event: {elementType: 'expressCheckout'}) => any
324
- ): StripeCustomCheckoutExpressCheckoutElement;
325
- off(
326
- eventType: 'escape',
327
- handler?: (event: {elementType: 'expressCheckout'}) => any
328
- ): StripeCustomCheckoutExpressCheckoutElement;
329
-
330
- /**
331
- * Triggered when the element fails to load.
332
- */
333
- on(
334
- eventType: 'loaderror',
335
- handler: (event: {
336
- elementType: 'expressCheckout';
337
- error: StripeError;
338
- }) => any
339
- ): StripeCustomCheckoutExpressCheckoutElement;
340
- once(
341
- eventType: 'loaderror',
342
- handler: (event: {
343
- elementType: 'expressCheckout';
344
- error: StripeError;
345
- }) => any
346
- ): StripeCustomCheckoutExpressCheckoutElement;
347
- off(
348
- eventType: 'loaderror',
349
- handler?: (event: {
350
- elementType: 'expressCheckout';
351
- error: StripeError;
352
- }) => any
353
- ): StripeCustomCheckoutExpressCheckoutElement;
354
-
355
- /**
356
- * Triggered when a buyer authorizes a payment within a supported payment method.
357
- */
358
- on(
359
- eventType: 'confirm',
360
- handler: (
361
- event: StripeCustomCheckoutExpressCheckoutElementConfirmEvent
362
- ) => any
363
- ): StripeCustomCheckoutExpressCheckoutElement;
364
- once(
365
- eventType: 'confirm',
366
- handler: (
367
- event: StripeCustomCheckoutExpressCheckoutElementConfirmEvent
368
- ) => any
369
- ): StripeCustomCheckoutExpressCheckoutElement;
370
- off(
371
- eventType: 'confirm',
372
- handler?: (
373
- event: StripeCustomCheckoutExpressCheckoutElementConfirmEvent
374
- ) => any
375
- ): StripeCustomCheckoutExpressCheckoutElement;
376
-
377
- /**
378
- * Updates the options the `ExpressCheckoutElement` was initialized with.
379
- * Updates are merged into the existing configuration.
380
- */
381
- update: StripeExpressCheckoutElement['update'];
382
- };
383
-
384
- export interface StripeCustomCheckout {
385
- /* Custom Checkout methods */
386
- applyPromotionCode: (
387
- promotionCode: string
388
- ) => Promise<StripeCustomCheckoutResult>;
389
- removePromotionCode: () => Promise<StripeCustomCheckoutResult>;
390
- updateShippingAddress: (
391
- shippingAddress: StripeCustomCheckoutContact | null
392
- ) => Promise<StripeCustomCheckoutResult>;
393
- updateBillingAddress: (
394
- billingAddress: StripeCustomCheckoutContact | null
395
- ) => Promise<StripeCustomCheckoutResult>;
396
- updatePhoneNumber: (phoneNumber: string) => void;
397
- updateEmail: (email: string) => void;
398
- updateLineItemQuantity: (args: {
399
- lineItem: string;
400
- quantity: number;
401
- }) => Promise<StripeCustomCheckoutResult>;
402
- updateShippingOption: (
403
- shippingOption: string
404
- ) => Promise<StripeCustomCheckoutResult>;
405
- confirm: (args?: {
406
- return_url?: string;
407
- returnUrl?: string;
408
- redirect?: StripeCustomCheckoutRedirectBehavior;
409
- paymentMethod?: string;
410
- savePaymentMethod?: boolean;
411
- }) => Promise<StripeCustomCheckoutResult>;
412
- session: () => StripeCustomCheckoutSession;
413
- on: (event: 'change', handler: StripeCustomCheckoutUpdateHandler) => void;
414
-
415
- /* Elements methods */
416
- changeAppearance: (appearance: Appearance) => void;
417
- getElement(elementType: 'payment'): StripePaymentElement | null;
418
- getElement(
419
- elementType: 'address',
420
- mode: AddressMode
421
- ): StripeAddressElement | null;
422
- getElement(
423
- elementType: 'expressCheckout'
424
- ): StripeCustomCheckoutExpressCheckoutElement | null;
425
- createElement(
426
- elementType: 'payment',
427
- options?: StripeCustomCheckoutPaymentElementOptions
428
- ): StripePaymentElement;
429
- createElement(
430
- elementType: 'address',
431
- options: StripeCustomCheckoutAddressElementOptions
432
- ): StripeAddressElement;
433
- createElement(
434
- elementType: 'expressCheckout',
435
- options: StripeCustomCheckoutExpressCheckoutElementOptions
436
- ): StripeCustomCheckoutExpressCheckoutElement;
437
- }