@stripe/stripe-js 6.0.0 → 6.1.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
@@ -55,7 +55,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
55
55
 
56
56
  stripe._registerWrapper({
57
57
  name: 'stripe-js',
58
- version: "6.0.0",
58
+ version: "6.1.0",
59
59
  startTime: startTime
60
60
  });
61
61
  };
@@ -151,7 +151,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
151
151
  var expectedVersion = RELEASE_TRAIN;
152
152
 
153
153
  if (isTestKey && version !== expectedVersion) {
154
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("6.0.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
154
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("6.1.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
155
155
  }
156
156
 
157
157
  var stripe = maybeStripe.apply(undefined, args);
package/dist/index.mjs CHANGED
@@ -51,7 +51,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
51
51
 
52
52
  stripe._registerWrapper({
53
53
  name: 'stripe-js',
54
- version: "6.0.0",
54
+ version: "6.1.0",
55
55
  startTime: startTime
56
56
  });
57
57
  };
@@ -147,7 +147,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
147
147
  var expectedVersion = RELEASE_TRAIN;
148
148
 
149
149
  if (isTestKey && version !== expectedVersion) {
150
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("6.0.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
150
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("6.1.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
151
151
  }
152
152
 
153
153
  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: "6.0.0",
74
+ version: "6.1.0",
75
75
  startTime: startTime
76
76
  });
77
77
  };
@@ -167,7 +167,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
167
167
  var expectedVersion = RELEASE_TRAIN;
168
168
 
169
169
  if (isTestKey && version !== expectedVersion) {
170
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("6.0.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
170
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("6.1.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
171
171
  }
172
172
 
173
173
  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: "6.0.0",
70
+ version: "6.1.0",
71
71
  startTime: startTime
72
72
  });
73
73
  };
@@ -163,7 +163,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
163
163
  var expectedVersion = RELEASE_TRAIN;
164
164
 
165
165
  if (isTestKey && version !== expectedVersion) {
166
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("6.0.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
166
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("6.1.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
167
167
  }
168
168
 
169
169
  var stripe = maybeStripe.apply(undefined, args);
@@ -4,11 +4,7 @@ import {
4
4
  TermsOption,
5
5
  StripePaymentElement,
6
6
  } from './elements/payment';
7
- import {
8
- AddressMode,
9
- ContactOption,
10
- StripeAddressElement,
11
- } from './elements/address';
7
+ import {ContactOption, StripeAddressElement} from './elements/address';
12
8
  import {Appearance, CssFontSource, CustomFontSource} from './elements-group';
13
9
  import {StripeError} from './stripe';
14
10
  import {
@@ -33,7 +29,7 @@ export interface StripeCheckoutElementsOptions {
33
29
  }
34
30
 
35
31
  export interface StripeCheckoutOptions {
36
- clientSecret: string;
32
+ fetchClientSecret: () => Promise<string>;
37
33
  elementsOptions?: StripeCheckoutElementsOptions;
38
34
  }
39
35
 
@@ -54,13 +50,6 @@ export type StripeCheckoutAdjustableQuantity = {
54
50
 
55
51
  export type StripeCheckoutBillingInterval = 'day' | 'month' | 'week' | 'year';
56
52
 
57
- export type StripeCheckoutConfirmationRequirement =
58
- | 'phoneNumber'
59
- | 'shippingAddress'
60
- | 'billingAddress'
61
- | 'paymentDetails'
62
- | 'email';
63
-
64
53
  export type StripeCheckoutContact = {
65
54
  name?: string | null;
66
55
  address: StripeCheckoutAddress;
@@ -71,8 +60,9 @@ export type StripeCheckoutDeliveryEstimate = {
71
60
  minimum: StripeCheckoutEstimate | null;
72
61
  };
73
62
 
74
- export type StripeCheckoutDiscountAmount = {
75
- amount: number;
63
+ export type StripeCheckoutAmount = {minorUnitsAmount: number; amount: string};
64
+
65
+ export type StripeCheckoutDiscountAmount = StripeCheckoutAmount & {
76
66
  displayName: string;
77
67
  promotionCode: string | null;
78
68
  recurring:
@@ -82,10 +72,10 @@ export type StripeCheckoutDiscountAmount = {
82
72
  };
83
73
 
84
74
  export type StripeCheckoutDueNext = {
85
- amountSubtotal: number;
86
- amountDiscount: number;
87
- amountTaxInclusive: number;
88
- amountTaxExclusive: number;
75
+ subtotal: StripeCheckoutAmount;
76
+ discount: StripeCheckoutAmount;
77
+ taxInclusive: StripeCheckoutAmount;
78
+ taxExclusive: StripeCheckoutAmount;
89
79
  billingCycleAnchor: number | null;
90
80
  };
91
81
 
@@ -124,8 +114,7 @@ export type StripeCheckoutSavedPaymentMethod = {
124
114
  };
125
115
  };
126
116
 
127
- export type StripeCheckoutTaxAmount = {
128
- amount: number;
117
+ export type StripeCheckoutTaxAmount = StripeCheckoutAmount & {
129
118
  inclusive: boolean;
130
119
  displayName: string;
131
120
  };
@@ -133,11 +122,12 @@ export type StripeCheckoutTaxAmount = {
133
122
  export type StripeCheckoutLineItem = {
134
123
  id: string;
135
124
  name: string;
136
- amountDiscount: number;
137
- amountSubtotal: number;
138
- amountTaxExclusive: number;
139
- amountTaxInclusive: number;
140
- unitAmount: number;
125
+ discount: StripeCheckoutAmount;
126
+ subtotal: StripeCheckoutAmount;
127
+ total: StripeCheckoutAmount;
128
+ taxExclusive: StripeCheckoutAmount;
129
+ taxInclusive: StripeCheckoutAmount;
130
+ unitAmount: StripeCheckoutAmount;
141
131
  description: string | null;
142
132
  quantity: number;
143
133
  discountAmounts: Array<StripeCheckoutDiscountAmount> | null;
@@ -164,9 +154,8 @@ export type StripeCheckoutShipping = {
164
154
  taxAmounts: Array<StripeCheckoutTaxAmount> | null;
165
155
  };
166
156
 
167
- export type StripeCheckoutShippingOption = {
157
+ export type StripeCheckoutShippingOption = StripeCheckoutAmount & {
168
158
  id: string;
169
- amount: number;
170
159
  currency: string;
171
160
  displayName: string | null;
172
161
  deliveryEstimate: StripeCheckoutDeliveryEstimate | null;
@@ -186,14 +175,14 @@ export type StripeCheckoutTaxStatus =
186
175
  | {status: 'requires_billing_address'};
187
176
 
188
177
  export type StripeCheckoutTotalSummary = {
189
- appliedBalance: number;
178
+ appliedBalance: StripeCheckoutAmount;
190
179
  balanceAppliedToNextInvoice: boolean;
191
- discount: number;
192
- shippingRate: number;
193
- subtotal: number;
194
- taxExclusive: number;
195
- taxInclusive: number;
196
- total: number;
180
+ discount: StripeCheckoutAmount;
181
+ shippingRate: StripeCheckoutAmount;
182
+ subtotal: StripeCheckoutAmount;
183
+ taxExclusive: StripeCheckoutAmount;
184
+ taxInclusive: StripeCheckoutAmount;
185
+ total: StripeCheckoutAmount;
197
186
  };
198
187
 
199
188
  export type StripeCheckoutTrial = {
@@ -201,8 +190,7 @@ export type StripeCheckoutTrial = {
201
190
  trialPeriodDays: number;
202
191
  };
203
192
 
204
- export type StripeCheckoutCurrencyOption = {
205
- amount: number;
193
+ export type StripeCheckoutCurrencyOption = StripeCheckoutAmount & {
206
194
  currency: string;
207
195
  currencyConversion?: {fxRate: number; sourceCurrency: string};
208
196
  };
@@ -324,7 +312,6 @@ export interface StripeCheckoutSession {
324
312
  billingAddress: StripeCheckoutContact | null;
325
313
  businessName: string | null;
326
314
  canConfirm: boolean;
327
- confirmationRequirements: StripeCheckoutConfirmationRequirement[];
328
315
  currency: string;
329
316
  currencyOptions: Array<StripeCheckoutCurrencyOption> | null;
330
317
  discountAmounts: Array<StripeCheckoutDiscountAmount> | null;
@@ -333,6 +320,7 @@ export interface StripeCheckoutSession {
333
320
  lastPaymentError: StripeCheckoutLastPaymentError | null;
334
321
  lineItems: Array<StripeCheckoutLineItem>;
335
322
  livemode: boolean;
323
+ minorUnitsAmountDivisor: number;
336
324
  phoneNumber: string | null;
337
325
  recurring: StripeCheckoutRecurring | null;
338
326
  savedPaymentMethods: Array<StripeCheckoutSavedPaymentMethod> | null;
@@ -355,7 +343,6 @@ export type StripeCheckoutPaymentElementOptions = {
355
343
  };
356
344
 
357
345
  export type StripeCheckoutAddressElementOptions = {
358
- mode: AddressMode;
359
346
  contacts?: ContactOption[];
360
347
  display?: {
361
348
  name?: 'full' | 'split' | 'organization';
@@ -593,30 +580,24 @@ export interface StripeCheckout {
593
580
 
594
581
  /* Elements methods */
595
582
  changeAppearance: (appearance: Appearance) => void;
596
- getElement(elementType: 'payment'): StripePaymentElement | null;
597
- getElement(
598
- elementType: 'address',
599
- mode: AddressMode
600
- ): StripeAddressElement | null;
601
- getElement(
602
- elementType: 'expressCheckout'
603
- ): StripeCheckoutExpressCheckoutElement | null;
583
+ getPaymentElement(): StripePaymentElement | null;
584
+ getBillingAddressElement(): StripeAddressElement | null;
585
+ getShippingAddressElement(): StripeAddressElement | null;
586
+ getExpressCheckoutElement(): StripeCheckoutExpressCheckoutElement | null;
604
587
  /* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */
605
- getElement(
606
- elementType: 'currencySelector'
607
- ): StripeCurrencySelectorElement | null;
608
- createElement(
609
- elementType: 'payment',
588
+ getCurrencySelectorElement(): StripeCurrencySelectorElement | null;
589
+ createPaymentElement(
610
590
  options?: StripeCheckoutPaymentElementOptions
611
591
  ): StripePaymentElement;
612
- createElement(
613
- elementType: 'address',
614
- options: StripeCheckoutAddressElementOptions
592
+ createBillingAddressElement(
593
+ options?: StripeCheckoutAddressElementOptions
594
+ ): StripeAddressElement;
595
+ createShippingAddressElement(
596
+ options?: StripeCheckoutAddressElementOptions
615
597
  ): StripeAddressElement;
616
- createElement(
617
- elementType: 'expressCheckout',
618
- options: StripeCheckoutExpressCheckoutElementOptions
598
+ createExpressCheckoutElement(
599
+ options?: StripeCheckoutExpressCheckoutElementOptions
619
600
  ): StripeCheckoutExpressCheckoutElement;
620
601
  /* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */
621
- createElement(elementType: 'currencySelector'): StripeCurrencySelectorElement;
602
+ createCurrencySelectorElement(): StripeCurrencySelectorElement;
622
603
  }
@@ -4,11 +4,7 @@ import {
4
4
  TermsOption,
5
5
  StripePaymentElement,
6
6
  } from './elements/payment';
7
- import {
8
- AddressMode,
9
- ContactOption,
10
- StripeAddressElement,
11
- } from './elements/address';
7
+ import {ContactOption, StripeAddressElement} from './elements/address';
12
8
  import {Appearance, CssFontSource, CustomFontSource} from './elements-group';
13
9
  import {StripeError} from './stripe';
14
10
  import {
@@ -33,7 +29,7 @@ export interface StripeCheckoutElementsOptions {
33
29
  }
34
30
 
35
31
  export interface StripeCheckoutOptions {
36
- clientSecret: string;
32
+ fetchClientSecret: () => Promise<string>;
37
33
  elementsOptions?: StripeCheckoutElementsOptions;
38
34
  }
39
35
 
@@ -54,13 +50,6 @@ export type StripeCheckoutAdjustableQuantity = {
54
50
 
55
51
  export type StripeCheckoutBillingInterval = 'day' | 'month' | 'week' | 'year';
56
52
 
57
- export type StripeCheckoutConfirmationRequirement =
58
- | 'phoneNumber'
59
- | 'shippingAddress'
60
- | 'billingAddress'
61
- | 'paymentDetails'
62
- | 'email';
63
-
64
53
  export type StripeCheckoutContact = {
65
54
  name?: string | null;
66
55
  address: StripeCheckoutAddress;
@@ -71,8 +60,9 @@ export type StripeCheckoutDeliveryEstimate = {
71
60
  minimum: StripeCheckoutEstimate | null;
72
61
  };
73
62
 
74
- export type StripeCheckoutDiscountAmount = {
75
- amount: number;
63
+ export type StripeCheckoutAmount = {minorUnitsAmount: number; amount: string};
64
+
65
+ export type StripeCheckoutDiscountAmount = StripeCheckoutAmount & {
76
66
  displayName: string;
77
67
  promotionCode: string | null;
78
68
  recurring:
@@ -82,10 +72,10 @@ export type StripeCheckoutDiscountAmount = {
82
72
  };
83
73
 
84
74
  export type StripeCheckoutDueNext = {
85
- amountSubtotal: number;
86
- amountDiscount: number;
87
- amountTaxInclusive: number;
88
- amountTaxExclusive: number;
75
+ subtotal: StripeCheckoutAmount;
76
+ discount: StripeCheckoutAmount;
77
+ taxInclusive: StripeCheckoutAmount;
78
+ taxExclusive: StripeCheckoutAmount;
89
79
  billingCycleAnchor: number | null;
90
80
  };
91
81
 
@@ -124,8 +114,7 @@ export type StripeCheckoutSavedPaymentMethod = {
124
114
  };
125
115
  };
126
116
 
127
- export type StripeCheckoutTaxAmount = {
128
- amount: number;
117
+ export type StripeCheckoutTaxAmount = StripeCheckoutAmount & {
129
118
  inclusive: boolean;
130
119
  displayName: string;
131
120
  };
@@ -133,11 +122,12 @@ export type StripeCheckoutTaxAmount = {
133
122
  export type StripeCheckoutLineItem = {
134
123
  id: string;
135
124
  name: string;
136
- amountDiscount: number;
137
- amountSubtotal: number;
138
- amountTaxExclusive: number;
139
- amountTaxInclusive: number;
140
- unitAmount: number;
125
+ discount: StripeCheckoutAmount;
126
+ subtotal: StripeCheckoutAmount;
127
+ total: StripeCheckoutAmount;
128
+ taxExclusive: StripeCheckoutAmount;
129
+ taxInclusive: StripeCheckoutAmount;
130
+ unitAmount: StripeCheckoutAmount;
141
131
  description: string | null;
142
132
  quantity: number;
143
133
  discountAmounts: Array<StripeCheckoutDiscountAmount> | null;
@@ -164,9 +154,8 @@ export type StripeCheckoutShipping = {
164
154
  taxAmounts: Array<StripeCheckoutTaxAmount> | null;
165
155
  };
166
156
 
167
- export type StripeCheckoutShippingOption = {
157
+ export type StripeCheckoutShippingOption = StripeCheckoutAmount & {
168
158
  id: string;
169
- amount: number;
170
159
  currency: string;
171
160
  displayName: string | null;
172
161
  deliveryEstimate: StripeCheckoutDeliveryEstimate | null;
@@ -186,14 +175,14 @@ export type StripeCheckoutTaxStatus =
186
175
  | {status: 'requires_billing_address'};
187
176
 
188
177
  export type StripeCheckoutTotalSummary = {
189
- appliedBalance: number;
178
+ appliedBalance: StripeCheckoutAmount;
190
179
  balanceAppliedToNextInvoice: boolean;
191
- discount: number;
192
- shippingRate: number;
193
- subtotal: number;
194
- taxExclusive: number;
195
- taxInclusive: number;
196
- total: number;
180
+ discount: StripeCheckoutAmount;
181
+ shippingRate: StripeCheckoutAmount;
182
+ subtotal: StripeCheckoutAmount;
183
+ taxExclusive: StripeCheckoutAmount;
184
+ taxInclusive: StripeCheckoutAmount;
185
+ total: StripeCheckoutAmount;
197
186
  };
198
187
 
199
188
  export type StripeCheckoutTrial = {
@@ -201,8 +190,7 @@ export type StripeCheckoutTrial = {
201
190
  trialPeriodDays: number;
202
191
  };
203
192
 
204
- export type StripeCheckoutCurrencyOption = {
205
- amount: number;
193
+ export type StripeCheckoutCurrencyOption = StripeCheckoutAmount & {
206
194
  currency: string;
207
195
  currencyConversion?: {fxRate: number; sourceCurrency: string};
208
196
  };
@@ -324,7 +312,6 @@ export interface StripeCheckoutSession {
324
312
  billingAddress: StripeCheckoutContact | null;
325
313
  businessName: string | null;
326
314
  canConfirm: boolean;
327
- confirmationRequirements: StripeCheckoutConfirmationRequirement[];
328
315
  currency: string;
329
316
  currencyOptions: Array<StripeCheckoutCurrencyOption> | null;
330
317
  discountAmounts: Array<StripeCheckoutDiscountAmount> | null;
@@ -333,6 +320,7 @@ export interface StripeCheckoutSession {
333
320
  lastPaymentError: StripeCheckoutLastPaymentError | null;
334
321
  lineItems: Array<StripeCheckoutLineItem>;
335
322
  livemode: boolean;
323
+ minorUnitsAmountDivisor: number;
336
324
  phoneNumber: string | null;
337
325
  recurring: StripeCheckoutRecurring | null;
338
326
  savedPaymentMethods: Array<StripeCheckoutSavedPaymentMethod> | null;
@@ -355,7 +343,6 @@ export type StripeCheckoutPaymentElementOptions = {
355
343
  };
356
344
 
357
345
  export type StripeCheckoutAddressElementOptions = {
358
- mode: AddressMode;
359
346
  contacts?: ContactOption[];
360
347
  display?: {
361
348
  name?: 'full' | 'split' | 'organization';
@@ -593,30 +580,24 @@ export interface StripeCheckout {
593
580
 
594
581
  /* Elements methods */
595
582
  changeAppearance: (appearance: Appearance) => void;
596
- getElement(elementType: 'payment'): StripePaymentElement | null;
597
- getElement(
598
- elementType: 'address',
599
- mode: AddressMode
600
- ): StripeAddressElement | null;
601
- getElement(
602
- elementType: 'expressCheckout'
603
- ): StripeCheckoutExpressCheckoutElement | null;
583
+ getPaymentElement(): StripePaymentElement | null;
584
+ getBillingAddressElement(): StripeAddressElement | null;
585
+ getShippingAddressElement(): StripeAddressElement | null;
586
+ getExpressCheckoutElement(): StripeCheckoutExpressCheckoutElement | null;
604
587
  /* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */
605
- getElement(
606
- elementType: 'currencySelector'
607
- ): StripeCurrencySelectorElement | null;
608
- createElement(
609
- elementType: 'payment',
588
+ getCurrencySelectorElement(): StripeCurrencySelectorElement | null;
589
+ createPaymentElement(
610
590
  options?: StripeCheckoutPaymentElementOptions
611
591
  ): StripePaymentElement;
612
- createElement(
613
- elementType: 'address',
614
- options: StripeCheckoutAddressElementOptions
592
+ createBillingAddressElement(
593
+ options?: StripeCheckoutAddressElementOptions
594
+ ): StripeAddressElement;
595
+ createShippingAddressElement(
596
+ options?: StripeCheckoutAddressElementOptions
615
597
  ): StripeAddressElement;
616
- createElement(
617
- elementType: 'expressCheckout',
618
- options: StripeCheckoutExpressCheckoutElementOptions
598
+ createExpressCheckoutElement(
599
+ options?: StripeCheckoutExpressCheckoutElementOptions
619
600
  ): StripeCheckoutExpressCheckoutElement;
620
601
  /* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */
621
- createElement(elementType: 'currencySelector'): StripeCurrencySelectorElement;
602
+ createCurrencySelectorElement(): StripeCurrencySelectorElement;
622
603
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/stripe-js",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "Stripe.js loading utility",
5
5
  "repository": "github:stripe/stripe-js",
6
6
  "main": "lib/index.js",