@stripe/stripe-js 4.1.0 → 4.3.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.
@@ -150,6 +150,21 @@ export namespace PaymentMethod {
150
150
  */
151
151
  last4: string;
152
152
 
153
+ /**
154
+ * Contains information about card networks that can be used to process the payment.
155
+ */
156
+ networks: {
157
+ /**
158
+ * The preferred network for co-branded cards.
159
+ */
160
+ preferred: string | null;
161
+
162
+ /**
163
+ * All available networks for the card.
164
+ */
165
+ available: string[];
166
+ } | null;
167
+
153
168
  /**
154
169
  * Contains details on how this Card maybe be used for 3D Secure authentication.
155
170
  */
@@ -150,6 +150,21 @@ export namespace PaymentMethod {
150
150
  */
151
151
  last4: string;
152
152
 
153
+ /**
154
+ * Contains information about card networks that can be used to process the payment.
155
+ */
156
+ networks: {
157
+ /**
158
+ * The preferred network for co-branded cards.
159
+ */
160
+ preferred: string | null;
161
+
162
+ /**
163
+ * All available networks for the card.
164
+ */
165
+ available: string[];
166
+ } | null;
167
+
153
168
  /**
154
169
  * Contains details on how this Card maybe be used for 3D Secure authentication.
155
170
  */
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.0.0",
45
+ version: "4.2.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.0.0",
41
+ version: "4.2.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.0.0",
61
+ version: "4.2.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.0.0",
57
+ version: "4.2.0",
58
58
  startTime: startTime
59
59
  });
60
60
  };
@@ -100,6 +100,32 @@ export type StripeCustomCheckoutLastPaymentError = {
100
100
  message: string;
101
101
  };
102
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
+
103
129
  export type StripeCustomCheckoutTaxAmount = {
104
130
  amount: number;
105
131
  inclusive: boolean;
@@ -179,15 +205,19 @@ export type StripeCustomCheckoutTrial = {
179
205
  /* Custom Checkout session */
180
206
  export interface StripeCustomCheckoutSession {
181
207
  billingAddress: StripeCustomCheckoutContact | null;
208
+ businessName: string | null;
182
209
  canConfirm: boolean;
183
210
  confirmationRequirements: StripeCustomCheckoutConfirmationRequirement[];
184
211
  currency: string;
185
212
  discountAmounts: Array<StripeCustomCheckoutDiscountAmount> | null;
186
213
  email: string | null;
214
+ id: string;
187
215
  lastPaymentError: StripeCustomCheckoutLastPaymentError | null;
188
216
  lineItems: Array<StripeCustomCheckoutLineItem>;
217
+ livemode: boolean;
189
218
  phoneNumber: string | null;
190
219
  recurring: StripeCustomCheckoutRecurring | null;
220
+ savedPaymentMethods: Array<StripeCustomCheckoutSavedPaymentMethod> | null;
191
221
  shipping: StripeCustomCheckoutShipping | null;
192
222
  shippingAddress: StripeCustomCheckoutContact | null;
193
223
  shippingOptions: Array<StripeCustomCheckoutShippingOption>;
@@ -374,6 +404,10 @@ export interface StripeCustomCheckout {
374
404
  ) => Promise<StripeCustomCheckoutResult>;
375
405
  confirm: (args?: {
376
406
  return_url?: string;
407
+ returnUrl?: string;
408
+ redirect?: StripeCustomCheckoutRedirectBehavior;
409
+ paymentMethod?: string;
410
+ savePaymentMethod?: boolean;
377
411
  }) => Promise<StripeCustomCheckoutResult>;
378
412
  session: () => StripeCustomCheckoutSession;
379
413
  on: (event: 'change', handler: StripeCustomCheckoutUpdateHandler) => void;
@@ -100,6 +100,32 @@ export type StripeCustomCheckoutLastPaymentError = {
100
100
  message: string;
101
101
  };
102
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
+
103
129
  export type StripeCustomCheckoutTaxAmount = {
104
130
  amount: number;
105
131
  inclusive: boolean;
@@ -179,15 +205,19 @@ export type StripeCustomCheckoutTrial = {
179
205
  /* Custom Checkout session */
180
206
  export interface StripeCustomCheckoutSession {
181
207
  billingAddress: StripeCustomCheckoutContact | null;
208
+ businessName: string | null;
182
209
  canConfirm: boolean;
183
210
  confirmationRequirements: StripeCustomCheckoutConfirmationRequirement[];
184
211
  currency: string;
185
212
  discountAmounts: Array<StripeCustomCheckoutDiscountAmount> | null;
186
213
  email: string | null;
214
+ id: string;
187
215
  lastPaymentError: StripeCustomCheckoutLastPaymentError | null;
188
216
  lineItems: Array<StripeCustomCheckoutLineItem>;
217
+ livemode: boolean;
189
218
  phoneNumber: string | null;
190
219
  recurring: StripeCustomCheckoutRecurring | null;
220
+ savedPaymentMethods: Array<StripeCustomCheckoutSavedPaymentMethod> | null;
191
221
  shipping: StripeCustomCheckoutShipping | null;
192
222
  shippingAddress: StripeCustomCheckoutContact | null;
193
223
  shippingOptions: Array<StripeCustomCheckoutShippingOption>;
@@ -374,6 +404,10 @@ export interface StripeCustomCheckout {
374
404
  ) => Promise<StripeCustomCheckoutResult>;
375
405
  confirm: (args?: {
376
406
  return_url?: string;
407
+ returnUrl?: string;
408
+ redirect?: StripeCustomCheckoutRedirectBehavior;
409
+ paymentMethod?: string;
410
+ savePaymentMethod?: boolean;
377
411
  }) => Promise<StripeCustomCheckoutResult>;
378
412
  session: () => StripeCustomCheckoutSession;
379
413
  on: (event: 'change', handler: StripeCustomCheckoutUpdateHandler) => void;
@@ -259,3 +259,7 @@ export interface StripeAddressElementChangeEvent {
259
259
  phone?: string;
260
260
  };
261
261
  }
262
+
263
+ export interface StripeAddressElementGetElementOptions {
264
+ mode: AddressMode;
265
+ }
@@ -259,3 +259,7 @@ export interface StripeAddressElementChangeEvent {
259
259
  phone?: string;
260
260
  };
261
261
  }
262
+
263
+ export interface StripeAddressElementGetElementOptions {
264
+ mode: AddressMode;
265
+ }
@@ -47,6 +47,7 @@ import {
47
47
  StripeIssuingCardCopyButtonElementOptions,
48
48
  StripeExpressCheckoutElement,
49
49
  StripeExpressCheckoutElementOptions,
50
+ StripeAddressElementGetElementOptions,
50
51
  } from './elements';
51
52
  import {StripeError} from './stripe';
52
53
 
@@ -84,7 +85,10 @@ export interface StripeElements {
84
85
  /**
85
86
  * Looks up a previously created `Element` by its type.
86
87
  */
87
- getElement(elementType: 'address'): StripeAddressElement | null;
88
+ getElement(
89
+ elementType: 'address',
90
+ options?: StripeAddressElementGetElementOptions
91
+ ): StripeAddressElement | null;
88
92
 
89
93
  /////////////////////////////
90
94
  /// paymentMethodMessaging
@@ -47,6 +47,7 @@ import {
47
47
  StripeIssuingCardCopyButtonElementOptions,
48
48
  StripeExpressCheckoutElement,
49
49
  StripeExpressCheckoutElementOptions,
50
+ StripeAddressElementGetElementOptions,
50
51
  } from './elements';
51
52
  import {StripeError} from './stripe';
52
53
 
@@ -84,7 +85,10 @@ export interface StripeElements {
84
85
  /**
85
86
  * Looks up a previously created `Element` by its type.
86
87
  */
87
- getElement(elementType: 'address'): StripeAddressElement | null;
88
+ getElement(
89
+ elementType: 'address',
90
+ options?: StripeAddressElementGetElementOptions
91
+ ): StripeAddressElement | null;
88
92
 
89
93
  /////////////////////////////
90
94
  /// paymentMethodMessaging
@@ -1,3 +1,26 @@
1
+ export type StripeEmbeddedCheckoutAddress = {
2
+ country: string;
3
+ line1?: string | null;
4
+ line2?: string | null;
5
+ city?: string | null;
6
+ postal_code?: string | null;
7
+ state?: string | null;
8
+ };
9
+
10
+ export type StripeEmbeddedCheckoutShippingDetails = {
11
+ name: string;
12
+ address: StripeEmbeddedCheckoutAddress;
13
+ };
14
+
15
+ export type StripeEmbeddedCheckoutShippingDetailsChangeEvent = {
16
+ checkoutSessionId: string;
17
+ shippingDetails: StripeEmbeddedCheckoutShippingDetails;
18
+ };
19
+
20
+ export type ResultAction =
21
+ | {type: 'accept'}
22
+ | {type: 'reject'; errorMessage?: string};
23
+
1
24
  export interface StripeEmbeddedCheckoutOptions {
2
25
  /**
3
26
  * The client secret of the [Checkout Session](https://stripe.com/docs/api/checkout/sessions).
@@ -13,6 +36,15 @@ export interface StripeEmbeddedCheckoutOptions {
13
36
  * You can use it to unmount Embedded Checkout and render a custom success UI.
14
37
  */
15
38
  onComplete?: () => void;
39
+ /**
40
+ * onShippingDetailsChange is called when the customer completes the shipping details form.
41
+ *
42
+ * The callback is required when [permissions.update.shipping_details](https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-permissions-update-shipping_details) is set to `server_only`.
43
+ * For a step-by-step guide on using this callback to customize shipping options during checkout, see [Customize Shipping Options](https://docs.stripe.com/payments/checkout/custom-shipping-options).
44
+ */
45
+ onShippingDetailsChange?: (
46
+ event: StripeEmbeddedCheckoutShippingDetailsChangeEvent
47
+ ) => Promise<ResultAction>;
16
48
  }
17
49
 
18
50
  export interface StripeEmbeddedCheckout {
@@ -1,3 +1,26 @@
1
+ export type StripeEmbeddedCheckoutAddress = {
2
+ country: string;
3
+ line1?: string | null;
4
+ line2?: string | null;
5
+ city?: string | null;
6
+ postal_code?: string | null;
7
+ state?: string | null;
8
+ };
9
+
10
+ export type StripeEmbeddedCheckoutShippingDetails = {
11
+ name: string;
12
+ address: StripeEmbeddedCheckoutAddress;
13
+ };
14
+
15
+ export type StripeEmbeddedCheckoutShippingDetailsChangeEvent = {
16
+ checkoutSessionId: string;
17
+ shippingDetails: StripeEmbeddedCheckoutShippingDetails;
18
+ };
19
+
20
+ export type ResultAction =
21
+ | {type: 'accept'}
22
+ | {type: 'reject'; errorMessage?: string};
23
+
1
24
  export interface StripeEmbeddedCheckoutOptions {
2
25
  /**
3
26
  * The client secret of the [Checkout Session](https://stripe.com/docs/api/checkout/sessions).
@@ -13,6 +36,15 @@ export interface StripeEmbeddedCheckoutOptions {
13
36
  * You can use it to unmount Embedded Checkout and render a custom success UI.
14
37
  */
15
38
  onComplete?: () => void;
39
+ /**
40
+ * onShippingDetailsChange is called when the customer completes the shipping details form.
41
+ *
42
+ * The callback is required when [permissions.update.shipping_details](https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-permissions-update-shipping_details) is set to `server_only`.
43
+ * For a step-by-step guide on using this callback to customize shipping options during checkout, see [Customize Shipping Options](https://docs.stripe.com/payments/checkout/custom-shipping-options).
44
+ */
45
+ onShippingDetailsChange?: (
46
+ event: StripeEmbeddedCheckoutShippingDetailsChangeEvent
47
+ ) => Promise<ResultAction>;
16
48
  }
17
49
 
18
50
  export interface StripeEmbeddedCheckout {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/stripe-js",
3
- "version": "4.1.0",
3
+ "version": "4.3.0",
4
4
  "description": "Stripe.js loading utility",
5
5
  "repository": "github:stripe/stripe-js",
6
6
  "main": "lib/index.js",