@stripe/stripe-js 8.7.0 → 8.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.
package/dist/index.js CHANGED
@@ -71,7 +71,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
71
71
 
72
72
  stripe._registerWrapper({
73
73
  name: 'stripe-js',
74
- version: "8.7.0",
74
+ version: "8.8.0",
75
75
  startTime: startTime
76
76
  });
77
77
  };
@@ -172,7 +172,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
172
172
  var expectedVersion = RELEASE_TRAIN;
173
173
 
174
174
  if (isTestKey && version !== expectedVersion) {
175
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.7.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
175
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.8.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
176
176
  }
177
177
 
178
178
  var stripe = maybeStripe.apply(undefined, args);
package/dist/index.mjs CHANGED
@@ -67,7 +67,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
67
67
 
68
68
  stripe._registerWrapper({
69
69
  name: 'stripe-js',
70
- version: "8.7.0",
70
+ version: "8.8.0",
71
71
  startTime: startTime
72
72
  });
73
73
  };
@@ -168,7 +168,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
168
168
  var expectedVersion = RELEASE_TRAIN;
169
169
 
170
170
  if (isTestKey && version !== expectedVersion) {
171
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.7.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
171
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.8.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
172
172
  }
173
173
 
174
174
  var stripe = maybeStripe.apply(undefined, args);
package/dist/pure.js CHANGED
@@ -71,7 +71,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
71
71
 
72
72
  stripe._registerWrapper({
73
73
  name: 'stripe-js',
74
- version: "8.7.0",
74
+ version: "8.8.0",
75
75
  startTime: startTime
76
76
  });
77
77
  };
@@ -172,7 +172,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
172
172
  var expectedVersion = RELEASE_TRAIN;
173
173
 
174
174
  if (isTestKey && version !== expectedVersion) {
175
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.7.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
175
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.8.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
176
176
  }
177
177
 
178
178
  var stripe = maybeStripe.apply(undefined, args);
package/dist/pure.mjs CHANGED
@@ -67,7 +67,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
67
67
 
68
68
  stripe._registerWrapper({
69
69
  name: 'stripe-js',
70
- version: "8.7.0",
70
+ version: "8.8.0",
71
71
  startTime: startTime
72
72
  });
73
73
  };
@@ -168,7 +168,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
168
168
  var expectedVersion = RELEASE_TRAIN;
169
169
 
170
170
  if (isTestKey && version !== expectedVersion) {
171
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.7.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
171
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.8.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
172
172
  }
173
173
 
174
174
  var stripe = maybeStripe.apply(undefined, args);
@@ -19,6 +19,7 @@ import {
19
19
  StripeTaxIdElement,
20
20
  StripeTaxIdElementOptions,
21
21
  PaymentWalletsOption,
22
+ StripePaymentFormElementConfirmEvent,
22
23
  } from './elements';
23
24
 
24
25
  type SavedPaymentMethodOption = {
@@ -267,6 +268,7 @@ export type StripeCheckoutTaxIdType =
267
268
  | 'kz_bin'
268
269
  | 'li_uid'
269
270
  | 'li_vat'
271
+ | 'lk_vat'
270
272
  | 'ma_vat'
271
273
  | 'md_vat'
272
274
  | 'me_pib'
@@ -637,6 +639,7 @@ type LoadActionsSuccess = {
637
639
  billingAddress?: StripeCheckoutContact;
638
640
  shippingAddress?: StripeCheckoutContact;
639
641
  expressCheckoutConfirmEvent?: StripeExpressCheckoutElementConfirmEvent;
642
+ paymentFormConfirmEvent?: StripePaymentFormElementConfirmEvent;
640
643
  onRequiresApproval?: () => Promise<void>;
641
644
  }) => Promise<StripeCheckoutConfirmResult>;
642
645
  getSession: () => StripeCheckoutSession;
@@ -19,6 +19,7 @@ import {
19
19
  StripeTaxIdElement,
20
20
  StripeTaxIdElementOptions,
21
21
  PaymentWalletsOption,
22
+ StripePaymentFormElementConfirmEvent,
22
23
  } from './elements';
23
24
 
24
25
  type SavedPaymentMethodOption = {
@@ -267,6 +268,7 @@ export type StripeCheckoutTaxIdType =
267
268
  | 'kz_bin'
268
269
  | 'li_uid'
269
270
  | 'li_vat'
271
+ | 'lk_vat'
270
272
  | 'ma_vat'
271
273
  | 'md_vat'
272
274
  | 'me_pib'
@@ -637,6 +639,7 @@ type LoadActionsSuccess = {
637
639
  billingAddress?: StripeCheckoutContact;
638
640
  shippingAddress?: StripeCheckoutContact;
639
641
  expressCheckoutConfirmEvent?: StripeExpressCheckoutElementConfirmEvent;
642
+ paymentFormConfirmEvent?: StripePaymentFormElementConfirmEvent;
640
643
  onRequiresApproval?: () => Promise<void>;
641
644
  }) => Promise<StripeCheckoutConfirmResult>;
642
645
  getSession: () => StripeCheckoutSession;
@@ -1,6 +1,7 @@
1
1
  import {StripeError} from '../stripe';
2
2
  import {StripeElementBase} from './base';
3
3
  import {StripeExpressCheckoutElementConfirmEvent} from './express-checkout';
4
+ import {TaxIdType, ExternalTaxIdType} from './tax-id';
4
5
 
5
6
  /**
6
7
  * Address type used in PaymentFormElement change events.
@@ -39,6 +40,8 @@ export interface StripePaymentFormElementChangeEvent {
39
40
  value: {
40
41
  customerDetails: {
41
42
  email: string;
43
+ name?: string;
44
+ businessName?: string;
42
45
  };
43
46
  shippingOption?: {
44
47
  id: string;
@@ -54,10 +57,10 @@ export interface StripePaymentFormElementChangeEvent {
54
57
  address: PaymentFormAddress;
55
58
  };
56
59
  tax?: {
57
- businessName: string;
60
+ businessName?: string;
58
61
  taxId: string;
59
- taxIdType: string;
60
- externalTaxIdType: string;
62
+ taxIdType: TaxIdType;
63
+ externalTaxIdType: ExternalTaxIdType;
61
64
  };
62
65
  customFields?: Record<string, string | number>;
63
66
  payment?: {
@@ -191,6 +194,22 @@ export type StripePaymentFormElement = StripeElementBase & {
191
194
  handler?: (event: {elementType: 'paymentForm'; error: StripeError}) => any
192
195
  ): StripePaymentFormElement;
193
196
 
197
+ /**
198
+ * Triggered when the loader UI is mounted to the DOM and ready to be displayed.
199
+ */
200
+ on(
201
+ eventType: 'loaderstart',
202
+ handler: (event: {elementType: 'paymentForm'}) => any
203
+ ): StripePaymentFormElement;
204
+ once(
205
+ eventType: 'loaderstart',
206
+ handler: (event: {elementType: 'paymentForm'}) => any
207
+ ): StripePaymentFormElement;
208
+ off(
209
+ eventType: 'loaderstart',
210
+ handler?: (event: {elementType: 'paymentForm'}) => any
211
+ ): StripePaymentFormElement;
212
+
194
213
  /**
195
214
  * Triggered when the element's value changes.
196
215
  */
@@ -1,6 +1,7 @@
1
1
  import {StripeError} from '../stripe';
2
2
  import {StripeElementBase} from './base';
3
3
  import {StripeExpressCheckoutElementConfirmEvent} from './express-checkout';
4
+ import {TaxIdType, ExternalTaxIdType} from './tax-id';
4
5
 
5
6
  /**
6
7
  * Address type used in PaymentFormElement change events.
@@ -39,6 +40,8 @@ export interface StripePaymentFormElementChangeEvent {
39
40
  value: {
40
41
  customerDetails: {
41
42
  email: string;
43
+ name?: string;
44
+ businessName?: string;
42
45
  };
43
46
  shippingOption?: {
44
47
  id: string;
@@ -54,10 +57,10 @@ export interface StripePaymentFormElementChangeEvent {
54
57
  address: PaymentFormAddress;
55
58
  };
56
59
  tax?: {
57
- businessName: string;
60
+ businessName?: string;
58
61
  taxId: string;
59
- taxIdType: string;
60
- externalTaxIdType: string;
62
+ taxIdType: TaxIdType;
63
+ externalTaxIdType: ExternalTaxIdType;
61
64
  };
62
65
  customFields?: Record<string, string | number>;
63
66
  payment?: {
@@ -191,6 +194,22 @@ export type StripePaymentFormElement = StripeElementBase & {
191
194
  handler?: (event: {elementType: 'paymentForm'; error: StripeError}) => any
192
195
  ): StripePaymentFormElement;
193
196
 
197
+ /**
198
+ * Triggered when the loader UI is mounted to the DOM and ready to be displayed.
199
+ */
200
+ on(
201
+ eventType: 'loaderstart',
202
+ handler: (event: {elementType: 'paymentForm'}) => any
203
+ ): StripePaymentFormElement;
204
+ once(
205
+ eventType: 'loaderstart',
206
+ handler: (event: {elementType: 'paymentForm'}) => any
207
+ ): StripePaymentFormElement;
208
+ off(
209
+ eventType: 'loaderstart',
210
+ handler?: (event: {elementType: 'paymentForm'}) => any
211
+ ): StripePaymentFormElement;
212
+
194
213
  /**
195
214
  * Triggered when the element's value changes.
196
215
  */
@@ -220,11 +220,12 @@ export interface PaymentWalletsOption {
220
220
  }
221
221
 
222
222
  export type Layout = 'tabs' | 'accordion' | 'auto';
223
+ type RadiosOption = 'auto' | 'never' | 'always' | 'if_multiple' | boolean;
223
224
 
224
225
  export interface LayoutObject {
225
226
  type: Layout;
226
227
  defaultCollapsed?: boolean;
227
- radios?: boolean;
228
+ radios?: RadiosOption;
228
229
  spacedAccordionItems?: boolean;
229
230
  visibleAccordionItemsCount?: number;
230
231
  /**
@@ -312,6 +313,7 @@ export interface StripePaymentElementChangeEvent {
312
313
  */
313
314
  value: {
314
315
  type: string;
316
+ savePaymentMethod?: boolean;
315
317
  billingDetails?: {
316
318
  address: {
317
319
  country?: null | string;
@@ -220,11 +220,12 @@ export interface PaymentWalletsOption {
220
220
  }
221
221
 
222
222
  export type Layout = 'tabs' | 'accordion' | 'auto';
223
+ type RadiosOption = 'auto' | 'never' | 'always' | 'if_multiple' | boolean;
223
224
 
224
225
  export interface LayoutObject {
225
226
  type: Layout;
226
227
  defaultCollapsed?: boolean;
227
- radios?: boolean;
228
+ radios?: RadiosOption;
228
229
  spacedAccordionItems?: boolean;
229
230
  visibleAccordionItemsCount?: number;
230
231
  /**
@@ -312,6 +313,7 @@ export interface StripePaymentElementChangeEvent {
312
313
  */
313
314
  value: {
314
315
  type: string;
316
+ savePaymentMethod?: boolean;
315
317
  billingDetails?: {
316
318
  address: {
317
319
  country?: null | string;
@@ -155,6 +155,7 @@ export type TaxIdType =
155
155
  | 'it_vat'
156
156
  | 'kh_tin'
157
157
  | 'lt_vat'
158
+ | 'lk_vat'
158
159
  | 'lu_vat'
159
160
  | 'lv_vat'
160
161
  | 'me_pib'
@@ -299,6 +300,7 @@ export type ExternalTaxIdType =
299
300
  | 'ma_vat'
300
301
  | 'by_tin'
301
302
  | 'li_vat'
303
+ | 'lk_vat'
302
304
  | 'aw_tin'
303
305
  | 'az_tin'
304
306
  | 'bd_bin'
@@ -155,6 +155,7 @@ export type TaxIdType =
155
155
  | 'it_vat'
156
156
  | 'kh_tin'
157
157
  | 'lt_vat'
158
+ | 'lk_vat'
158
159
  | 'lu_vat'
159
160
  | 'lv_vat'
160
161
  | 'me_pib'
@@ -299,6 +300,7 @@ export type ExternalTaxIdType =
299
300
  | 'ma_vat'
300
301
  | 'by_tin'
301
302
  | 'li_vat'
303
+ | 'lk_vat'
302
304
  | 'aw_tin'
303
305
  | 'az_tin'
304
306
  | 'bd_bin'
@@ -13,6 +13,7 @@ export type CreatePaymentMethodData =
13
13
  | CreatePaymentMethodAffirmData
14
14
  | CreatePaymentMethodAfterpayClearpayData
15
15
  | CreatePaymentMethodAlipayData
16
+ | CreatePaymentMethodAmazonPayData
16
17
  | CreatePaymentMethodAuBecsDebitData
17
18
  | CreatePaymentMethodBacsDebitData
18
19
  | CreatePaymentMethodBancontactData
@@ -49,6 +50,11 @@ export interface CreatePaymentMethodAlipayData
49
50
  type: 'alipay';
50
51
  }
51
52
 
53
+ export interface CreatePaymentMethodAmazonPayData
54
+ extends PaymentMethodCreateParams {
55
+ type: 'amazon_pay';
56
+ }
57
+
52
58
  export interface CreatePaymentMethodWechatPayData
53
59
  extends PaymentMethodCreateParams {
54
60
  /**
@@ -13,6 +13,7 @@ export type CreatePaymentMethodData =
13
13
  | CreatePaymentMethodAffirmData
14
14
  | CreatePaymentMethodAfterpayClearpayData
15
15
  | CreatePaymentMethodAlipayData
16
+ | CreatePaymentMethodAmazonPayData
16
17
  | CreatePaymentMethodAuBecsDebitData
17
18
  | CreatePaymentMethodBacsDebitData
18
19
  | CreatePaymentMethodBancontactData
@@ -49,6 +50,11 @@ export interface CreatePaymentMethodAlipayData
49
50
  type: 'alipay';
50
51
  }
51
52
 
53
+ export interface CreatePaymentMethodAmazonPayData
54
+ extends PaymentMethodCreateParams {
55
+ type: 'amazon_pay';
56
+ }
57
+
52
58
  export interface CreatePaymentMethodWechatPayData
53
59
  extends PaymentMethodCreateParams {
54
60
  /**
@@ -2,6 +2,7 @@ import {PaymentMethodCreateParams, SetupIntentConfirmParams} from '../api';
2
2
 
3
3
  import {
4
4
  CreatePaymentMethodAcssDebitData,
5
+ CreatePaymentMethodAmazonPayData,
5
6
  CreatePaymentMethodAuBecsDebitData,
6
7
  CreatePaymentMethodBancontactData,
7
8
  CreatePaymentMethodCardData,
@@ -139,6 +140,25 @@ export interface ConfirmIdealSetupData extends SetupIntentConfirmParams {
139
140
  payment_method?: string | Omit<CreatePaymentMethodIdealData, 'type'>;
140
141
  }
141
142
 
143
+ /**
144
+ * Data to be sent with a `stripe.confirmAmazonPaySetup` request.
145
+ * Refer to the [Setup Intents API](https://stripe.com/docs/api/setup_intents/confirm) for a full list of parameters.
146
+ */
147
+ export interface ConfirmAmazonPaySetupData extends SetupIntentConfirmParams {
148
+ /*
149
+ * Either the `id` of an existing [PaymentMethod](https://stripe.com/docs/api/payment_methods), or an object containing data to create a `PaymentMethod` with.
150
+ * This field is optional if a `PaymentMethod` has already been attached to this `SetupIntent`.
151
+ *
152
+ * @recommended
153
+ */
154
+ payment_method?: string | Omit<CreatePaymentMethodAmazonPayData, 'type'>;
155
+
156
+ /**
157
+ * The required url your customer will be directed to after they complete authentication.
158
+ */
159
+ return_url: string;
160
+ }
161
+
142
162
  /**
143
163
  * Data to be sent with a `stripe.confirmIdealSetup` request.
144
164
  * Refer to the [Setup Intents API](https://stripe.com/docs/api/setup_intents/confirm) for a full list of parameters.
@@ -2,6 +2,7 @@ import {PaymentMethodCreateParams, SetupIntentConfirmParams} from '../api';
2
2
 
3
3
  import {
4
4
  CreatePaymentMethodAcssDebitData,
5
+ CreatePaymentMethodAmazonPayData,
5
6
  CreatePaymentMethodAuBecsDebitData,
6
7
  CreatePaymentMethodBancontactData,
7
8
  CreatePaymentMethodCardData,
@@ -139,6 +140,25 @@ export interface ConfirmIdealSetupData extends SetupIntentConfirmParams {
139
140
  payment_method?: string | Omit<CreatePaymentMethodIdealData, 'type'>;
140
141
  }
141
142
 
143
+ /**
144
+ * Data to be sent with a `stripe.confirmAmazonPaySetup` request.
145
+ * Refer to the [Setup Intents API](https://stripe.com/docs/api/setup_intents/confirm) for a full list of parameters.
146
+ */
147
+ export interface ConfirmAmazonPaySetupData extends SetupIntentConfirmParams {
148
+ /*
149
+ * Either the `id` of an existing [PaymentMethod](https://stripe.com/docs/api/payment_methods), or an object containing data to create a `PaymentMethod` with.
150
+ * This field is optional if a `PaymentMethod` has already been attached to this `SetupIntent`.
151
+ *
152
+ * @recommended
153
+ */
154
+ payment_method?: string | Omit<CreatePaymentMethodAmazonPayData, 'type'>;
155
+
156
+ /**
157
+ * The required url your customer will be directed to after they complete authentication.
158
+ */
159
+ return_url: string;
160
+ }
161
+
142
162
  /**
143
163
  * Data to be sent with a `stripe.confirmIdealSetup` request.
144
164
  * Refer to the [Setup Intents API](https://stripe.com/docs/api/setup_intents/confirm) for a full list of parameters.
@@ -945,6 +945,24 @@ export interface Stripe {
945
945
  data?: setupIntents.ConfirmIdealSetupData
946
946
  ): Promise<SetupIntentResult>;
947
947
 
948
+ /**
949
+ * Use `stripe.confirmAmazonPaySetup` in the [Set up future payments](https://stripe.com/docs/payments/amazon-pay/set-up-future-payments) flow when the customer submits your payment form.
950
+ * When called, it will confirm a `SetupIntent` with `data` you provide, and it will automatically redirect the customer to authorize the transaction.
951
+ * Once authorization is complete, the customer will be redirected back to your specified `return_url`.
952
+ * Note that there are some additional requirements to this flow that are not covered in this reference.
953
+ * Refer to our [integration guide](https://stripe.com/docs/payments/amazon-pay/set-up-future-payments) for more details.
954
+ *
955
+ * When you confirm a `SetupIntent`, it needs to have an attached [PaymentMethod](https://stripe.com/docs/api/payment_methods).
956
+ * In addition to confirming the `SetupIntent`, this method can automatically create and attach a new `PaymentMethod` for you.
957
+ * It can also be called with an existing `PaymentMethod`, or if you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data.
958
+ *
959
+ * @docs https://stripe.com/docs/js/setup_intents/confirm_amazon_pay_setup
960
+ */
961
+ confirmAmazonPaySetup(
962
+ clientSecret: string,
963
+ data?: setupIntents.ConfirmAmazonPaySetupData
964
+ ): Promise<SetupIntentResult>;
965
+
948
966
  /**
949
967
  * Use `stripe.confirmPayPalSetup` in the [Set up future payments](https://stripe.com/docs/payments/paypal/set-up-future-payments) flow when the customer submits your payment form.
950
968
  * When called, it will confirm a `SetupIntent` with `data` you provide, and it will automatically redirect the customer to authorize the transaction.
@@ -945,6 +945,24 @@ export interface Stripe {
945
945
  data?: setupIntents.ConfirmIdealSetupData
946
946
  ): Promise<SetupIntentResult>;
947
947
 
948
+ /**
949
+ * Use `stripe.confirmAmazonPaySetup` in the [Set up future payments](https://stripe.com/docs/payments/amazon-pay/set-up-future-payments) flow when the customer submits your payment form.
950
+ * When called, it will confirm a `SetupIntent` with `data` you provide, and it will automatically redirect the customer to authorize the transaction.
951
+ * Once authorization is complete, the customer will be redirected back to your specified `return_url`.
952
+ * Note that there are some additional requirements to this flow that are not covered in this reference.
953
+ * Refer to our [integration guide](https://stripe.com/docs/payments/amazon-pay/set-up-future-payments) for more details.
954
+ *
955
+ * When you confirm a `SetupIntent`, it needs to have an attached [PaymentMethod](https://stripe.com/docs/api/payment_methods).
956
+ * In addition to confirming the `SetupIntent`, this method can automatically create and attach a new `PaymentMethod` for you.
957
+ * It can also be called with an existing `PaymentMethod`, or if you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data.
958
+ *
959
+ * @docs https://stripe.com/docs/js/setup_intents/confirm_amazon_pay_setup
960
+ */
961
+ confirmAmazonPaySetup(
962
+ clientSecret: string,
963
+ data?: setupIntents.ConfirmAmazonPaySetupData
964
+ ): Promise<SetupIntentResult>;
965
+
948
966
  /**
949
967
  * Use `stripe.confirmPayPalSetup` in the [Set up future payments](https://stripe.com/docs/payments/paypal/set-up-future-payments) flow when the customer submits your payment form.
950
968
  * When called, it will confirm a `SetupIntent` with `data` you provide, and it will automatically redirect the customer to authorize the transaction.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/stripe-js",
3
- "version": "8.7.0",
3
+ "version": "8.8.0",
4
4
  "description": "Stripe.js loading utility",
5
5
  "repository": "github:stripe/stripe-js",
6
6
  "main": "lib/index.js",