@stripe/stripe-js 1.20.3 → 1.21.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 (53) hide show
  1. package/dist/pure.esm.js +1 -1
  2. package/dist/pure.js +1 -1
  3. package/dist/stripe.esm.js +1 -1
  4. package/dist/stripe.js +1 -1
  5. package/package.json +5 -5
  6. package/src/shared.ts +1 -2
  7. package/types/api/bank-accounts.d.ts +61 -0
  8. package/types/api/cards.d.ts +130 -0
  9. package/types/api/index.d.ts +9 -9
  10. package/types/api/payment-intents.d.ts +330 -0
  11. package/types/api/payment-methods.d.ts +349 -0
  12. package/types/api/setup-intents.d.ts +184 -0
  13. package/types/api/shared.d.ts +124 -126
  14. package/types/api/sources.d.ts +1045 -0
  15. package/types/api/tokens.d.ts +634 -0
  16. package/types/api/verification-sessions.d.ts +9 -0
  17. package/types/index.d.ts +14 -12
  18. package/types/stripe-js/checkout.d.ts +134 -136
  19. package/types/stripe-js/elements/affirm-message.d.ts +59 -61
  20. package/types/stripe-js/elements/afterpay-clearpay-message.d.ts +118 -120
  21. package/types/stripe-js/elements/au-bank-account.d.ts +123 -120
  22. package/types/stripe-js/elements/base.d.ts +263 -263
  23. package/types/stripe-js/elements/card-cvc.d.ts +107 -103
  24. package/types/stripe-js/elements/card-expiry.d.ts +107 -104
  25. package/types/stripe-js/elements/card-number.d.ts +128 -125
  26. package/types/stripe-js/elements/card.d.ts +157 -154
  27. package/types/stripe-js/elements/eps-bank.d.ts +125 -121
  28. package/types/stripe-js/elements/fpx-bank.d.ts +120 -116
  29. package/types/stripe-js/elements/iban.d.ts +134 -131
  30. package/types/stripe-js/elements/ideal-bank.d.ts +125 -121
  31. package/types/stripe-js/elements/index.d.ts +17 -0
  32. package/types/stripe-js/elements/link-authentication.d.ts +92 -94
  33. package/types/stripe-js/elements/p24-bank.d.ts +125 -121
  34. package/types/stripe-js/elements/payment-request-button.d.ts +127 -127
  35. package/types/stripe-js/elements/payment.d.ts +190 -180
  36. package/types/stripe-js/elements/shipping-address.d.ts +123 -125
  37. package/types/stripe-js/elements-group.d.ts +617 -0
  38. package/types/stripe-js/index.d.ts +7 -1069
  39. package/types/stripe-js/payment-intents.d.ts +951 -919
  40. package/types/stripe-js/payment-request.d.ts +503 -503
  41. package/types/stripe-js/setup-intents.d.ts +149 -135
  42. package/types/stripe-js/stripe.d.ts +1070 -0
  43. package/types/stripe-js/token-and-sources.d.ts +80 -80
  44. package/types/utils.d.ts +2 -0
  45. package/types/api/BankAccounts.d.ts +0 -63
  46. package/types/api/Cards.d.ts +0 -130
  47. package/types/api/PaymentIntents.d.ts +0 -329
  48. package/types/api/PaymentMethods.d.ts +0 -349
  49. package/types/api/SetupIntents.d.ts +0 -184
  50. package/types/api/Sources.d.ts +0 -1045
  51. package/types/api/Tokens.d.ts +0 -632
  52. package/types/api/VerificationSessions.d.ts +0 -11
  53. package/types/stripe-js/elements.d.ts +0 -604
@@ -0,0 +1,617 @@
1
+ import {
2
+ StripeShippingAddressElement,
3
+ StripeShippingAddressElementOptions,
4
+ StripePaymentRequestButtonElement,
5
+ StripePaymentRequestButtonElementOptions,
6
+ StripePaymentElement,
7
+ StripePaymentElementOptions,
8
+ StripeLinkAuthenticationElement,
9
+ StripeIdealBankElement,
10
+ StripeIdealBankElementOptions,
11
+ StripeIbanElement,
12
+ StripeIbanElementOptions,
13
+ StripeP24BankElement,
14
+ StripeP24BankElementOptions,
15
+ StripeEpsBankElement,
16
+ StripeEpsBankElementOptions,
17
+ StripeFpxBankElement,
18
+ StripeFpxBankElementOptions,
19
+ StripeCardCvcElement,
20
+ StripeCardCvcElementOptions,
21
+ StripeCardExpiryElement,
22
+ StripeCardExpiryElementOptions,
23
+ StripeCardNumberElement,
24
+ StripeCardNumberElementOptions,
25
+ StripeCardElement,
26
+ StripeCardElementOptions,
27
+ StripeAuBankAccountElement,
28
+ StripeAfterpayClearpayMessageElementOptions,
29
+ StripeAffirmMessageElement,
30
+ StripeAffirmMessageElementOptions,
31
+ StripeAfterpayClearpayMessageElement,
32
+ StripeAuBankAccountElementOptions,
33
+ } from './elements';
34
+
35
+ export interface StripeElements {
36
+ /**
37
+ * Updates the options that `Elements` was initialized with.
38
+ * Updates are shallowly merged into the existing configuration.
39
+ */
40
+ update(options: StripeElementsUpdateOptions): void;
41
+
42
+ /////////////////////////////
43
+ /// affirmMessage
44
+ /////////////////////////////
45
+
46
+ /**
47
+ * Creates an `AffirmMessageElement`.
48
+ */
49
+ create(
50
+ elementType: 'affirmMessage',
51
+ options: StripeAffirmMessageElementOptions
52
+ ): StripeAffirmMessageElement;
53
+
54
+ /**
55
+ * Looks up a previously created `Element` by its type.
56
+ */
57
+ getElement(elementType: 'affirmMessage'): StripeAffirmMessageElement | null;
58
+
59
+ /////////////////////////////
60
+ /// afterpayClearpayMessage
61
+ /////////////////////////////
62
+
63
+ /**
64
+ * Creates an `AfterpayClearpayMessageElement`.
65
+ */
66
+ create(
67
+ elementType: 'afterpayClearpayMessage',
68
+ options: StripeAfterpayClearpayMessageElementOptions
69
+ ): StripeAfterpayClearpayMessageElement;
70
+
71
+ /**
72
+ * Looks up a previously created `Element` by its type.
73
+ */
74
+ getElement(
75
+ elementType: 'afterpayClearpayMessage'
76
+ ): StripeAfterpayClearpayMessageElement | null;
77
+
78
+ /////////////////////////////
79
+ /// auBankAccount
80
+ /////////////////////////////
81
+
82
+ /**
83
+ * Requires beta access:
84
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
85
+ *
86
+ * Creates an `AuBankAccountElement`.
87
+ */
88
+ create(
89
+ elementType: 'auBankAccount',
90
+ options?: StripeAuBankAccountElementOptions
91
+ ): StripeAuBankAccountElement;
92
+
93
+ /**
94
+ * Requires beta access:
95
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
96
+ *
97
+ * Looks up a previously created `Element` by its type.
98
+ */
99
+ getElement(elementType: 'auBankAccount'): StripeAuBankAccountElement | null;
100
+
101
+ /////////////////////////////
102
+ /// card
103
+ /////////////////////////////
104
+
105
+ /**
106
+ * Creates a `CardElement`.
107
+ */
108
+ create(
109
+ elementType: 'card',
110
+ options?: StripeCardElementOptions
111
+ ): StripeCardElement;
112
+
113
+ /**
114
+ * Looks up a previously created `Element` by its type.
115
+ */
116
+ getElement(elementType: 'card'): StripeCardElement | null;
117
+
118
+ /////////////////////////////
119
+ /// cardNumber
120
+ /////////////////////////////
121
+
122
+ /**
123
+ * Creates a `CardNumberElement`.
124
+ */
125
+ create(
126
+ elementType: 'cardNumber',
127
+ options?: StripeCardNumberElementOptions
128
+ ): StripeCardNumberElement;
129
+
130
+ /**
131
+ * Looks up a previously created `Element` by its type.
132
+ */
133
+ getElement(elementType: 'cardNumber'): StripeCardNumberElement | null;
134
+
135
+ /////////////////////////////
136
+ /// cardExpiry
137
+ /////////////////////////////
138
+
139
+ /**
140
+ * Creates a `CardExpiryElement`.
141
+ */
142
+ create(
143
+ elementType: 'cardExpiry',
144
+ options?: StripeCardExpiryElementOptions
145
+ ): StripeCardExpiryElement;
146
+
147
+ /**
148
+ * Looks up a previously created `Element` by its type.
149
+ */
150
+ getElement(elementType: 'cardExpiry'): StripeCardExpiryElement | null;
151
+
152
+ /////////////////////////////
153
+ /// cardCvc
154
+ /////////////////////////////
155
+
156
+ /**
157
+ * Creates a `CardCvcElement`.
158
+ */
159
+ create(
160
+ elementType: 'cardCvc',
161
+ options?: StripeCardCvcElementOptions
162
+ ): StripeCardCvcElement;
163
+
164
+ /**
165
+ * Looks up a previously created `Element` by its type.
166
+ */
167
+ getElement(elementType: 'cardCvc'): StripeCardCvcElement | null;
168
+
169
+ /////////////////////////////
170
+ /// fpxBank
171
+ /////////////////////////////
172
+
173
+ /**
174
+ * Creates an `FpxBankElement`.
175
+ */
176
+ create(
177
+ elementType: 'fpxBank',
178
+ options: StripeFpxBankElementOptions
179
+ ): StripeFpxBankElement;
180
+
181
+ /**
182
+ * Looks up a previously created `Element` by its type.
183
+ */
184
+ getElement(elementType: 'fpxBank'): StripeFpxBankElement | null;
185
+
186
+ /////////////////////////////
187
+ /// epsBank
188
+ /////////////////////////////
189
+
190
+ /**
191
+ *
192
+ * Creates an `EpsBankElement`.
193
+ */
194
+ create(
195
+ elementType: 'epsBank',
196
+ options: StripeEpsBankElementOptions
197
+ ): StripeEpsBankElement;
198
+
199
+ /**
200
+ * Requires beta access:
201
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
202
+ *
203
+ * Looks up a previously created `Element` by its type.
204
+ */
205
+ getElement(elementType: 'epsBank'): StripeEpsBankElement | null;
206
+
207
+ /////////////////////////////
208
+ /// p24Bank
209
+ /////////////////////////////
210
+
211
+ /**
212
+ *
213
+ * Creates an `P24BankElement`.
214
+ */
215
+ create(
216
+ elementType: 'p24Bank',
217
+ options: StripeP24BankElementOptions
218
+ ): StripeP24BankElement;
219
+
220
+ /**
221
+ *
222
+ * Looks up a previously created `Element` by its type.
223
+ */
224
+ getElement(elementType: 'p24Bank'): StripeP24BankElement | null;
225
+
226
+ /////////////////////////////
227
+ /// iban
228
+ /////////////////////////////
229
+
230
+ /**
231
+ * Creates an `IbanElement`.
232
+ */
233
+ create(
234
+ elementType: 'iban',
235
+ options?: StripeIbanElementOptions
236
+ ): StripeIbanElement;
237
+
238
+ /**
239
+ * Looks up a previously created `Element` by its type.
240
+ */
241
+ getElement(elementType: 'iban'): StripeIbanElement | null;
242
+
243
+ /////////////////////////////
244
+ /// idealBank
245
+ /////////////////////////////
246
+
247
+ /**
248
+ * Creates an `IdealBankElement`.
249
+ */
250
+ create(
251
+ elementType: 'idealBank',
252
+ options?: StripeIdealBankElementOptions
253
+ ): StripeIdealBankElement;
254
+
255
+ /**
256
+ * Looks up a previously created `Element` by its type.
257
+ */
258
+ getElement(elementType: 'idealBank'): StripeIdealBankElement | null;
259
+
260
+ /////////////////////////////
261
+ /// linkAuthentication
262
+ /////////////////////////////
263
+
264
+ /**
265
+ * Requires beta access:
266
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
267
+ *
268
+ * Creates a `LinkAuthenticationElement`.
269
+ */
270
+ create(elementType: 'linkAuthentication'): StripeLinkAuthenticationElement;
271
+
272
+ /**
273
+ * Requires beta access:
274
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
275
+ *
276
+ * Looks up a previously created `Element` by its type.
277
+ */
278
+ getElement(
279
+ elementType: 'linkAuthentication'
280
+ ): StripeLinkAuthenticationElement | null;
281
+
282
+ /////////////////////////////
283
+ /// payment
284
+ /////////////////////////////
285
+
286
+ /**
287
+ * Creates a `PaymentElement`.
288
+ *
289
+ * @docs https://stripe.com/docs/payments/payment-element
290
+ */
291
+ create(
292
+ elementType: 'payment',
293
+ options?: StripePaymentElementOptions
294
+ ): StripePaymentElement;
295
+
296
+ /**
297
+ * Looks up a previously created `Element` by its type.
298
+ */
299
+ getElement(elementType: 'payment'): StripePaymentElement | null;
300
+
301
+ /////////////////////////////
302
+ /// paymentRequestButton
303
+ /////////////////////////////
304
+
305
+ /**
306
+ * Creates a `PaymentRequestButtonElement`.
307
+ *
308
+ * @docs https://stripe.com/docs/stripe-js/elements/payment-request-button
309
+ */
310
+ create(
311
+ elementType: 'paymentRequestButton',
312
+ options: StripePaymentRequestButtonElementOptions
313
+ ): StripePaymentRequestButtonElement;
314
+
315
+ /**
316
+ * Looks up a previously created `Element` by its type.
317
+ */
318
+ getElement(
319
+ elementType: 'paymentRequestButton'
320
+ ): StripePaymentRequestButtonElement | null;
321
+
322
+ /**
323
+ * Requires beta access:
324
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
325
+ *
326
+ * Creates a `ShippingAddressElement`.
327
+ */
328
+ create(
329
+ elementType: 'shippingAddress',
330
+ options?: StripeShippingAddressElementOptions
331
+ ): StripeShippingAddressElement;
332
+
333
+ /**
334
+ * Requires beta access:
335
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
336
+ *
337
+ * Looks up a previously created `Element` by its type.
338
+ */
339
+ getElement(
340
+ elementType: 'shippingAddress'
341
+ ): StripeShippingAddressElement | null;
342
+ }
343
+
344
+ export type StripeElementType =
345
+ | 'affirmMessage'
346
+ | 'afterpayClearpayMessage'
347
+ | 'auBankAccount'
348
+ | 'card'
349
+ | 'cardNumber'
350
+ | 'cardExpiry'
351
+ | 'cardCvc'
352
+ | 'epsBank'
353
+ | 'fpxBank'
354
+ | 'iban'
355
+ | 'idealBank'
356
+ | 'p24Bank'
357
+ | 'payment'
358
+ | 'paymentRequestButton'
359
+ | 'linkAuthentication'
360
+ | 'shippingAddress';
361
+
362
+ export type StripeElement =
363
+ | StripeAffirmMessageElement
364
+ | StripeAfterpayClearpayMessageElement
365
+ | StripeAuBankAccountElement
366
+ | StripeCardElement
367
+ | StripeCardNumberElement
368
+ | StripeCardExpiryElement
369
+ | StripeCardCvcElement
370
+ | StripeEpsBankElement
371
+ | StripeFpxBankElement
372
+ | StripeIbanElement
373
+ | StripeIdealBankElement
374
+ | StripeP24BankElement
375
+ | StripePaymentElement
376
+ | StripePaymentRequestButtonElement;
377
+
378
+ export type StripeElementLocale =
379
+ | 'auto'
380
+ | 'ar'
381
+ | 'bg'
382
+ | 'cs'
383
+ | 'da'
384
+ | 'de'
385
+ | 'el'
386
+ | 'en'
387
+ | 'en-AU'
388
+ | 'en-CA'
389
+ | 'en-NZ'
390
+ | 'en-GB'
391
+ | 'es'
392
+ | 'es-ES'
393
+ | 'es-419'
394
+ | 'et'
395
+ | 'fi'
396
+ | 'fr'
397
+ | 'fr-FR'
398
+ | 'hu'
399
+ | 'he'
400
+ | 'id'
401
+ | 'it'
402
+ | 'it-IT'
403
+ | 'ja'
404
+ | 'lt'
405
+ | 'lv'
406
+ | 'ms'
407
+ | 'mt'
408
+ | 'nb'
409
+ | 'nl'
410
+ | 'no'
411
+ | 'pl'
412
+ | 'pt'
413
+ | 'pt-BR'
414
+ | 'ro'
415
+ | 'ru'
416
+ | 'sk'
417
+ | 'sl'
418
+ | 'sv'
419
+ | 'th'
420
+ | 'tr'
421
+ | 'zh'
422
+ | 'zh-HK'
423
+ | 'zh-TW';
424
+
425
+ /**
426
+ * Options to create an `Elements` instance with.
427
+ */
428
+ export interface StripeElementsOptions {
429
+ /**
430
+ * An array of custom fonts, which elements created from the `Elements` object can use.
431
+ */
432
+ fonts?: Array<CssFontSource | CustomFontSource>;
433
+
434
+ /**
435
+ * The [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) of the locale to display placeholders and error strings in.
436
+ * Default is `auto` (Stripe detects the locale of the browser).
437
+ * Setting the locale does not affect the behavior of postal code validation—a valid postal code for the billing country of the card is still required.
438
+ */
439
+ locale?: StripeElementLocale;
440
+
441
+ /**
442
+ * Match the Payment Element with the design of your site with the appearance option.
443
+ * The layout of the Payment Element stays consistent, but you can modify colors, fonts, borders, padding, and more.
444
+ *
445
+ * @docs https://stripe.com/docs/stripe-js/appearance-api
446
+ */
447
+ appearance?: Appearance;
448
+
449
+ /**
450
+ * The client secret for a PaymentIntent or SetupIntent used by the Payment Element.
451
+ *
452
+ * @docs https://stripe.com/docs/api/payment_intents/object#payment_intent_object-client_secret
453
+ */
454
+ clientSecret?: string;
455
+ }
456
+
457
+ /*
458
+ * Updatable options for an `Elements` instance
459
+ */
460
+ export interface StripeElementsUpdateOptions {
461
+ /**
462
+ * The [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) of the locale to display placeholders and error strings in.
463
+ * Default is `auto` (Stripe detects the locale of the browser).
464
+ * Setting the locale does not affect the behavior of postal code validation—a valid postal code for the billing country of the card is still required.
465
+ */
466
+ locale?: StripeElementLocale;
467
+
468
+ /**
469
+ * Used with the Payment Element, requires beta access:
470
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
471
+ *
472
+ * Match the design of your site with the appearance option.
473
+ * The layout of each Element stays consistent, but you can modify colors, fonts, borders, padding, and more.
474
+ *
475
+ * @docs https://stripe.com/docs/stripe-js/appearance-api
476
+ */
477
+ appearance?: Appearance;
478
+ }
479
+
480
+ /*
481
+ * Use a `CssFontSource` to pass custom fonts via a stylesheet URL when creating an `Elements` object.
482
+ */
483
+ export interface CssFontSource {
484
+ /**
485
+ * A relative or absolute URL pointing to a CSS file with [@font-face](https://developer.mozilla.org/en/docs/Web/CSS/@font-face) definitions, for example:
486
+ *
487
+ * https://fonts.googleapis.com/css?family=Open+Sans
488
+ *
489
+ * Note that if you are using a [content security policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy) (CSP), [additional directives](https://stripe.com/docs/security#content-security-policy) may be necessary.
490
+ */
491
+ cssSrc: string;
492
+ }
493
+
494
+ /*
495
+ * Use a `CustomFontSource` to pass custom fonts when creating an `Elements` object.
496
+ */
497
+ export interface CustomFontSource {
498
+ /**
499
+ * The name to give the font
500
+ */
501
+ family: string;
502
+
503
+ /**
504
+ * A valid [src](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src) value pointing to your custom font file.
505
+ * This is usually (though not always) a link to a file with a `.woff` , `.otf`, or `.svg` suffix.
506
+ */
507
+ src: string;
508
+
509
+ /**
510
+ * A valid [font-display](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display) value.
511
+ */
512
+ display?: string;
513
+
514
+ /**
515
+ * Defaults to `normal`.
516
+ */
517
+ style?: 'normal' | 'italic' | 'oblique';
518
+
519
+ /**
520
+ * A valid [unicode-range](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range) value.
521
+ */
522
+ unicodeRange?: string;
523
+
524
+ /**
525
+ * A valid [font-weight](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight), as a string.
526
+ */
527
+ weight?: string;
528
+ }
529
+
530
+ /*
531
+ * @docs https://stripe.com/docs/stripe-js/appearance-api
532
+ */
533
+ export interface Appearance {
534
+ theme?: 'stripe' | 'night' | 'none';
535
+
536
+ variables?: {
537
+ // General font styles
538
+ fontFamily?: string;
539
+ fontSmooth?: string;
540
+ fontVariantLigatures?: string;
541
+ fontVariationSettings?: string;
542
+ fontLineHeight?: string;
543
+
544
+ // Font sizes
545
+ fontSizeBase?: string;
546
+ fontSizeSm?: string;
547
+ fontSizeXs?: string;
548
+ fontSize2Xs?: string;
549
+ fontSize3Xs?: string;
550
+ fontSizeLg?: string;
551
+ fontSizeXl?: string;
552
+
553
+ // Font weights
554
+ fontWeightLight?: string;
555
+ fontWeightNormal?: string;
556
+ fontWeightMedium?: string;
557
+ fontWeightBold?: string;
558
+
559
+ // Spacing
560
+ spacingUnit?: string;
561
+ spacingGridRow?: string;
562
+ spacingGridColumn?: string;
563
+ spacingTab?: string;
564
+
565
+ // Colors
566
+ colorPrimary?: string;
567
+ colorPrimaryText?: string;
568
+ colorBackground?: string;
569
+ colorBackgroundText?: string;
570
+ colorText?: string;
571
+ colorSuccess?: string;
572
+ colorSuccessText?: string;
573
+ colorDanger?: string;
574
+ colorDangerText?: string;
575
+ colorWarning?: string;
576
+ colorWarningText?: string;
577
+
578
+ // Text variations
579
+ colorTextSecondary?: string;
580
+ colorTextPlaceholder?: string;
581
+
582
+ // Icons
583
+ colorIcon?: string;
584
+ colorIconHover?: string;
585
+ colorIconCardError?: string;
586
+ colorIconCardCvc?: string;
587
+ colorIconCardCvcError?: string;
588
+ colorIconCheckmark?: string;
589
+ colorIconChevronDown?: string;
590
+ colorIconChevronDownHover?: string;
591
+ colorIconRedirect?: string;
592
+ colorIconTab?: string;
593
+ colorIconTabHover?: string;
594
+ colorIconTabSelected?: string;
595
+ colorIconTabMore?: string;
596
+ colorIconTabMoreHover?: string;
597
+
598
+ // Logos
599
+ colorLogo?: string;
600
+ colorLogoTab?: string;
601
+ colorLogoTabSelected?: string;
602
+ colorLogoBlock?: string;
603
+
604
+ // Focus
605
+ focusBoxShadow?: string;
606
+ focusOutline?: string;
607
+
608
+ // Radius
609
+ borderRadius?: string;
610
+ };
611
+
612
+ rules?: {
613
+ [selector: string]: {
614
+ [cssPropertyName: string]: string;
615
+ };
616
+ };
617
+ }