@stripe/stripe-js 4.6.0 → 4.8.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.
@@ -131,17 +131,25 @@ export namespace SetupIntent {
131
131
  }
132
132
 
133
133
  export interface NextAction {
134
- redirect_to_url?: NextAction.RedirectToUrl;
135
-
136
134
  /**
137
- * Type of the next action to perform, one of `redirect_to_url` or `use_stripe_sdk`.
135
+ * Type of the next action to perform, one of `redirect_to_url`, `use_stripe_sdk`, or `verify_with_microdeposits`.
138
136
  */
139
137
  type: string;
140
138
 
139
+ /**
140
+ * Contains instructions for authenticating a payment by redirecting your customer to another page or application.
141
+ */
142
+ redirect_to_url?: NextAction.RedirectToUrl;
143
+
141
144
  /**
142
145
  * When confirming a SetupIntent with Stripe.js, Stripe.js depends on the contents of this dictionary to invoke authentication flows. The shape of the contents is subject to change and is only intended to be used by Stripe.js.
143
146
  */
144
147
  use_stripe_sdk?: NextAction.UseStripeSdk;
148
+
149
+ /**
150
+ * Contains details describing microdeposits verification flow.
151
+ */
152
+ verify_with_microdeposits?: NextAction.VerifyWithMicrodeposits;
145
153
  }
146
154
 
147
155
  export namespace NextAction {
@@ -158,6 +166,23 @@ export namespace SetupIntent {
158
166
  }
159
167
 
160
168
  export interface UseStripeSdk {}
169
+
170
+ export interface VerifyWithMicrodeposits {
171
+ /**
172
+ * The timestamp when the microdeposits are expected to land.
173
+ */
174
+ arrival_date: number;
175
+
176
+ /**
177
+ * The URL for the hosted verification page, which allows customers to verify their bank account.
178
+ */
179
+ hosted_verification_url: string;
180
+
181
+ /**
182
+ * The type of the microdeposit sent to the customer. Used to distinguish between different verification methods.
183
+ */
184
+ microdeposit_type: string | null;
185
+ }
161
186
  }
162
187
 
163
188
  export type Status =
@@ -131,17 +131,25 @@ export namespace SetupIntent {
131
131
  }
132
132
 
133
133
  export interface NextAction {
134
- redirect_to_url?: NextAction.RedirectToUrl;
135
-
136
134
  /**
137
- * Type of the next action to perform, one of `redirect_to_url` or `use_stripe_sdk`.
135
+ * Type of the next action to perform, one of `redirect_to_url`, `use_stripe_sdk`, or `verify_with_microdeposits`.
138
136
  */
139
137
  type: string;
140
138
 
139
+ /**
140
+ * Contains instructions for authenticating a payment by redirecting your customer to another page or application.
141
+ */
142
+ redirect_to_url?: NextAction.RedirectToUrl;
143
+
141
144
  /**
142
145
  * When confirming a SetupIntent with Stripe.js, Stripe.js depends on the contents of this dictionary to invoke authentication flows. The shape of the contents is subject to change and is only intended to be used by Stripe.js.
143
146
  */
144
147
  use_stripe_sdk?: NextAction.UseStripeSdk;
148
+
149
+ /**
150
+ * Contains details describing microdeposits verification flow.
151
+ */
152
+ verify_with_microdeposits?: NextAction.VerifyWithMicrodeposits;
145
153
  }
146
154
 
147
155
  export namespace NextAction {
@@ -158,6 +166,23 @@ export namespace SetupIntent {
158
166
  }
159
167
 
160
168
  export interface UseStripeSdk {}
169
+
170
+ export interface VerifyWithMicrodeposits {
171
+ /**
172
+ * The timestamp when the microdeposits are expected to land.
173
+ */
174
+ arrival_date: number;
175
+
176
+ /**
177
+ * The URL for the hosted verification page, which allows customers to verify their bank account.
178
+ */
179
+ hosted_verification_url: string;
180
+
181
+ /**
182
+ * The type of the microdeposit sent to the customer. Used to distinguish between different verification methods.
183
+ */
184
+ microdeposit_type: string | null;
185
+ }
161
186
  }
162
187
 
163
188
  export type Status =
package/dist/index.js CHANGED
@@ -42,7 +42,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
42
42
 
43
43
  stripe._registerWrapper({
44
44
  name: 'stripe-js',
45
- version: "4.4.0",
45
+ version: "4.7.0",
46
46
  startTime: startTime
47
47
  });
48
48
  };
package/dist/index.mjs CHANGED
@@ -38,7 +38,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
38
38
 
39
39
  stripe._registerWrapper({
40
40
  name: 'stripe-js',
41
- version: "4.4.0",
41
+ version: "4.7.0",
42
42
  startTime: startTime
43
43
  });
44
44
  };
package/dist/pure.js CHANGED
@@ -58,7 +58,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
58
58
 
59
59
  stripe._registerWrapper({
60
60
  name: 'stripe-js',
61
- version: "4.4.0",
61
+ version: "4.7.0",
62
62
  startTime: startTime
63
63
  });
64
64
  };
package/dist/pure.mjs CHANGED
@@ -54,7 +54,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
54
54
 
55
55
  stripe._registerWrapper({
56
56
  name: 'stripe-js',
57
- version: "4.4.0",
57
+ version: "4.7.0",
58
58
  startTime: startTime
59
59
  });
60
60
  };
@@ -116,6 +116,31 @@ export type StripePaymentElement = StripeElementBase & {
116
116
  handler?: (event: {elementType: 'payment'}) => any
117
117
  ): StripePaymentElement;
118
118
 
119
+ /**
120
+ * The change event is triggered when the `Element`'s value changes.
121
+ * Represents the details of a selected Card payment method.
122
+ */
123
+ on(
124
+ eventType: 'carddetailschange',
125
+ handler: (event: StripePaymentElementCardDetailsChangeEvent) => any
126
+ ): StripePaymentElement;
127
+
128
+ /**
129
+ * Triggered when a Saved Payment Method is updated.
130
+ */
131
+ on(
132
+ eventType: 'savedpaymentmethodupdate',
133
+ handler: (event: StripePaymentElementSavedPaymentMethodUpdateEvent) => any
134
+ ): StripePaymentElement;
135
+
136
+ /**
137
+ * Triggered when a Saved Payment Method is removed.
138
+ */
139
+ on(
140
+ eventType: 'savedpaymentmethodremove',
141
+ handler: (event: StripePaymentElementSavedPaymentMethodRemoveEvent) => any
142
+ ): StripePaymentElement;
143
+
119
144
  /**
120
145
  * Updates the options the `PaymentElement` was initialized with.
121
146
  * Updates are merged into the existing configuration.
@@ -158,6 +183,7 @@ export interface FieldsOption {
158
183
  phone?: FieldOption;
159
184
  address?:
160
185
  | FieldOption
186
+ | 'if_required'
161
187
  | {
162
188
  country?: FieldOption;
163
189
  postalCode?: FieldOption;
@@ -297,3 +323,112 @@ export interface StripePaymentElementChangeEvent {
297
323
  };
298
324
  };
299
325
  }
326
+
327
+ type CardBrand =
328
+ | 'amex'
329
+ | 'diners'
330
+ | 'discover'
331
+ | 'eftpos_au'
332
+ | 'jcb'
333
+ | 'mastercard'
334
+ | 'unionpay'
335
+ | 'visa'
336
+ | 'unknown';
337
+ type CardFunding = 'credit' | 'debit' | 'prepaid' | 'unknown';
338
+
339
+ export interface StripePaymentElementCardDetailsChangeEvent {
340
+ /**
341
+ * The type of element that emitted this event.
342
+ */
343
+ elementType: 'payment';
344
+
345
+ /**
346
+ * `true` when the card details are loading.
347
+ */
348
+ loading: boolean;
349
+
350
+ /**
351
+ * The card details for the selected payment method.
352
+ * Undefined while loading and for non card payment methods.
353
+ */
354
+ details?: {
355
+ brands: CardBrand[] | null;
356
+ funding: CardFunding | null;
357
+ };
358
+ }
359
+
360
+ export interface StripePaymentElementSavedPaymentMethodUpdateEvent {
361
+ /**
362
+ * The type of element that emitted this event.
363
+ */
364
+ elementType: 'payment';
365
+
366
+ /**
367
+ * `true` when the saved payment method is successfully updated.
368
+ */
369
+ success: boolean;
370
+
371
+ /**
372
+ * Error message if the saved payment method update fails.
373
+ */
374
+ error?: string;
375
+
376
+ /**
377
+ * The updated saved payment method.
378
+ */
379
+ payment_method: {
380
+ id: string;
381
+ type: string;
382
+ billing_details: {
383
+ address: {
384
+ city: null | string;
385
+ country: null | string;
386
+ line1: null | string;
387
+ line2: null | string;
388
+ postal_code: null | string;
389
+ state: null | string;
390
+ };
391
+ name: null | string;
392
+ email: null | string;
393
+ phone: null | string;
394
+ };
395
+ };
396
+ }
397
+
398
+ export interface StripePaymentElementSavedPaymentMethodRemoveEvent {
399
+ /**
400
+ * The type of element that emitted this event.
401
+ */
402
+ elementType: 'payment';
403
+
404
+ /**
405
+ * `true` when the saved payment method is successfully removed.
406
+ */
407
+ success: boolean;
408
+
409
+ /**
410
+ * Error message if the saved payment method removal fails.
411
+ */
412
+ error?: string;
413
+
414
+ /**
415
+ * The removed saved payment method.
416
+ */
417
+ payment_method: {
418
+ id: string;
419
+ type: string;
420
+ billing_details: {
421
+ address: {
422
+ city: null | string;
423
+ country: null | string;
424
+ line1: null | string;
425
+ line2: null | string;
426
+ postal_code: null | string;
427
+ state: null | string;
428
+ };
429
+ name: null | string;
430
+ email: null | string;
431
+ phone: null | string;
432
+ };
433
+ };
434
+ }
@@ -116,6 +116,31 @@ export type StripePaymentElement = StripeElementBase & {
116
116
  handler?: (event: {elementType: 'payment'}) => any
117
117
  ): StripePaymentElement;
118
118
 
119
+ /**
120
+ * The change event is triggered when the `Element`'s value changes.
121
+ * Represents the details of a selected Card payment method.
122
+ */
123
+ on(
124
+ eventType: 'carddetailschange',
125
+ handler: (event: StripePaymentElementCardDetailsChangeEvent) => any
126
+ ): StripePaymentElement;
127
+
128
+ /**
129
+ * Triggered when a Saved Payment Method is updated.
130
+ */
131
+ on(
132
+ eventType: 'savedpaymentmethodupdate',
133
+ handler: (event: StripePaymentElementSavedPaymentMethodUpdateEvent) => any
134
+ ): StripePaymentElement;
135
+
136
+ /**
137
+ * Triggered when a Saved Payment Method is removed.
138
+ */
139
+ on(
140
+ eventType: 'savedpaymentmethodremove',
141
+ handler: (event: StripePaymentElementSavedPaymentMethodRemoveEvent) => any
142
+ ): StripePaymentElement;
143
+
119
144
  /**
120
145
  * Updates the options the `PaymentElement` was initialized with.
121
146
  * Updates are merged into the existing configuration.
@@ -158,6 +183,7 @@ export interface FieldsOption {
158
183
  phone?: FieldOption;
159
184
  address?:
160
185
  | FieldOption
186
+ | 'if_required'
161
187
  | {
162
188
  country?: FieldOption;
163
189
  postalCode?: FieldOption;
@@ -297,3 +323,112 @@ export interface StripePaymentElementChangeEvent {
297
323
  };
298
324
  };
299
325
  }
326
+
327
+ type CardBrand =
328
+ | 'amex'
329
+ | 'diners'
330
+ | 'discover'
331
+ | 'eftpos_au'
332
+ | 'jcb'
333
+ | 'mastercard'
334
+ | 'unionpay'
335
+ | 'visa'
336
+ | 'unknown';
337
+ type CardFunding = 'credit' | 'debit' | 'prepaid' | 'unknown';
338
+
339
+ export interface StripePaymentElementCardDetailsChangeEvent {
340
+ /**
341
+ * The type of element that emitted this event.
342
+ */
343
+ elementType: 'payment';
344
+
345
+ /**
346
+ * `true` when the card details are loading.
347
+ */
348
+ loading: boolean;
349
+
350
+ /**
351
+ * The card details for the selected payment method.
352
+ * Undefined while loading and for non card payment methods.
353
+ */
354
+ details?: {
355
+ brands: CardBrand[] | null;
356
+ funding: CardFunding | null;
357
+ };
358
+ }
359
+
360
+ export interface StripePaymentElementSavedPaymentMethodUpdateEvent {
361
+ /**
362
+ * The type of element that emitted this event.
363
+ */
364
+ elementType: 'payment';
365
+
366
+ /**
367
+ * `true` when the saved payment method is successfully updated.
368
+ */
369
+ success: boolean;
370
+
371
+ /**
372
+ * Error message if the saved payment method update fails.
373
+ */
374
+ error?: string;
375
+
376
+ /**
377
+ * The updated saved payment method.
378
+ */
379
+ payment_method: {
380
+ id: string;
381
+ type: string;
382
+ billing_details: {
383
+ address: {
384
+ city: null | string;
385
+ country: null | string;
386
+ line1: null | string;
387
+ line2: null | string;
388
+ postal_code: null | string;
389
+ state: null | string;
390
+ };
391
+ name: null | string;
392
+ email: null | string;
393
+ phone: null | string;
394
+ };
395
+ };
396
+ }
397
+
398
+ export interface StripePaymentElementSavedPaymentMethodRemoveEvent {
399
+ /**
400
+ * The type of element that emitted this event.
401
+ */
402
+ elementType: 'payment';
403
+
404
+ /**
405
+ * `true` when the saved payment method is successfully removed.
406
+ */
407
+ success: boolean;
408
+
409
+ /**
410
+ * Error message if the saved payment method removal fails.
411
+ */
412
+ error?: string;
413
+
414
+ /**
415
+ * The removed saved payment method.
416
+ */
417
+ payment_method: {
418
+ id: string;
419
+ type: string;
420
+ billing_details: {
421
+ address: {
422
+ city: null | string;
423
+ country: null | string;
424
+ line1: null | string;
425
+ line2: null | string;
426
+ postal_code: null | string;
427
+ state: null | string;
428
+ };
429
+ name: null | string;
430
+ email: null | string;
431
+ phone: null | string;
432
+ };
433
+ };
434
+ }
@@ -900,6 +900,11 @@ export interface StripeElementsUpdateOptions {
900
900
  * @docs https://stripe.com/docs/js/elements_object/create_without_intent#stripe_elements_no_intent-options-onBehalfOf
901
901
  */
902
902
  on_behalf_of?: string;
903
+
904
+ /**
905
+ * Display saved PaymentMethods and Customer information.
906
+ */
907
+ customerSessionClientSecret?: string;
903
908
  }
904
909
 
905
910
  /*
@@ -900,6 +900,11 @@ export interface StripeElementsUpdateOptions {
900
900
  * @docs https://stripe.com/docs/js/elements_object/create_without_intent#stripe_elements_no_intent-options-onBehalfOf
901
901
  */
902
902
  on_behalf_of?: string;
903
+
904
+ /**
905
+ * Display saved PaymentMethods and Customer information.
906
+ */
907
+ customerSessionClientSecret?: string;
903
908
  }
904
909
 
905
910
  /*
@@ -17,6 +17,29 @@ export type StripeEmbeddedCheckoutShippingDetailsChangeEvent = {
17
17
  shippingDetails: StripeEmbeddedCheckoutShippingDetails;
18
18
  };
19
19
 
20
+ export type StripeEmbeddedCheckoutLineItem = {
21
+ id?: string;
22
+ quantity?: number;
23
+ price?: string;
24
+ display?: {
25
+ name?: string;
26
+ description?: string;
27
+ images?: string[];
28
+ };
29
+ pricingSpec?: {
30
+ unitAmount?: number;
31
+ unitAmountDecimal?: string;
32
+ currency?: string;
33
+ taxBehavior?: 'inclusive' | 'exclusive' | 'unspecified';
34
+ taxCode?: string;
35
+ };
36
+ };
37
+
38
+ export type StripeEmbeddedCheckoutLineItemsChangeEvent = {
39
+ checkoutSessionId: string;
40
+ lineItems: StripeEmbeddedCheckoutLineItem[];
41
+ };
42
+
20
43
  export type ResultAction =
21
44
  | {type: 'accept'}
22
45
  | {type: 'reject'; errorMessage?: string};
@@ -45,6 +68,13 @@ export interface StripeEmbeddedCheckoutOptions {
45
68
  onShippingDetailsChange?: (
46
69
  event: StripeEmbeddedCheckoutShippingDetailsChangeEvent
47
70
  ) => Promise<ResultAction>;
71
+ /**
72
+ * onLineItemsChange is called when the customer adds, removes, or modifies a line item.
73
+ * The callback is required when [permissions.update.line_items](https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-permissions-update-line_items) is set to `server_only`.
74
+ */
75
+ onLineItemsChange?: (
76
+ event: StripeEmbeddedCheckoutLineItemsChangeEvent
77
+ ) => Promise<ResultAction>;
48
78
  }
49
79
 
50
80
  export interface StripeEmbeddedCheckout {
@@ -17,6 +17,29 @@ export type StripeEmbeddedCheckoutShippingDetailsChangeEvent = {
17
17
  shippingDetails: StripeEmbeddedCheckoutShippingDetails;
18
18
  };
19
19
 
20
+ export type StripeEmbeddedCheckoutLineItem = {
21
+ id?: string;
22
+ quantity?: number;
23
+ price?: string;
24
+ display?: {
25
+ name?: string;
26
+ description?: string;
27
+ images?: string[];
28
+ };
29
+ pricingSpec?: {
30
+ unitAmount?: number;
31
+ unitAmountDecimal?: string;
32
+ currency?: string;
33
+ taxBehavior?: 'inclusive' | 'exclusive' | 'unspecified';
34
+ taxCode?: string;
35
+ };
36
+ };
37
+
38
+ export type StripeEmbeddedCheckoutLineItemsChangeEvent = {
39
+ checkoutSessionId: string;
40
+ lineItems: StripeEmbeddedCheckoutLineItem[];
41
+ };
42
+
20
43
  export type ResultAction =
21
44
  | {type: 'accept'}
22
45
  | {type: 'reject'; errorMessage?: string};
@@ -45,6 +68,13 @@ export interface StripeEmbeddedCheckoutOptions {
45
68
  onShippingDetailsChange?: (
46
69
  event: StripeEmbeddedCheckoutShippingDetailsChangeEvent
47
70
  ) => Promise<ResultAction>;
71
+ /**
72
+ * onLineItemsChange is called when the customer adds, removes, or modifies a line item.
73
+ * The callback is required when [permissions.update.line_items](https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-permissions-update-line_items) is set to `server_only`.
74
+ */
75
+ onLineItemsChange?: (
76
+ event: StripeEmbeddedCheckoutLineItemsChangeEvent
77
+ ) => Promise<ResultAction>;
48
78
  }
49
79
 
50
80
  export interface StripeEmbeddedCheckout {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/stripe-js",
3
- "version": "4.6.0",
3
+ "version": "4.8.0",
4
4
  "description": "Stripe.js loading utility",
5
5
  "repository": "github:stripe/stripe-js",
6
6
  "main": "lib/index.js",