@stripe/stripe-js 1.31.0 → 1.34.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/pure.esm.js CHANGED
@@ -54,7 +54,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
54
54
 
55
55
  stripe._registerWrapper({
56
56
  name: 'stripe-js',
57
- version: "1.31.0",
57
+ version: "1.34.0",
58
58
  startTime: startTime
59
59
  });
60
60
  };
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: "1.31.0",
61
+ version: "1.34.0",
62
62
  startTime: startTime
63
63
  });
64
64
  };
@@ -38,7 +38,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
38
38
 
39
39
  stripe._registerWrapper({
40
40
  name: 'stripe-js',
41
- version: "1.31.0",
41
+ version: "1.34.0",
42
42
  startTime: startTime
43
43
  });
44
44
  };
package/dist/stripe.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: "1.31.0",
45
+ version: "1.34.0",
46
46
  startTime: startTime
47
47
  });
48
48
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/stripe-js",
3
- "version": "1.31.0",
3
+ "version": "1.34.0",
4
4
  "description": "Stripe.js loading utility",
5
5
  "main": "dist/stripe.js",
6
6
  "module": "dist/stripe.esm.js",
@@ -0,0 +1,86 @@
1
+ /**
2
+ * The Financial Connections Session object
3
+ */
4
+ export interface FinancialConnectionsSession {
5
+ /**
6
+ * Unique identifier for the object.
7
+ */
8
+ id: string;
9
+
10
+ /**
11
+ * List of accounts collected by the Session
12
+ */
13
+ accounts: FinancialConnectionsSession.Account[];
14
+
15
+ /**
16
+ * Filters applied to the Session
17
+ */
18
+ filters?: FinancialConnectionsSession.Filters;
19
+
20
+ /**
21
+ * List of data permissions requested in the Session
22
+ */
23
+ permissions?: FinancialConnectionsSession.Permission[];
24
+
25
+ /**
26
+ * For webview integrations only. The user will be redirected to this URL to return to your app.
27
+ */
28
+ return_url?: string;
29
+ }
30
+
31
+ export namespace FinancialConnectionsSession {
32
+ /**
33
+ * The Financial Connections Account object
34
+ */
35
+ export interface Account {
36
+ /**
37
+ * Unique identifier for the object.
38
+ */
39
+ id: string;
40
+
41
+ /**
42
+ * String representing the object's type. `'linked_account'` is present for backwards-compatibility.
43
+ */
44
+ object: 'linked_account' | 'financial_connections.account';
45
+
46
+ /**
47
+ * The type of the account.
48
+ */
49
+ category: string;
50
+
51
+ /**
52
+ * A human-readable name that has been assigned to this account, either by the account holder or by the institution.
53
+ */
54
+ display_name: string;
55
+
56
+ /**
57
+ * The name of the institution that holds this account.
58
+ */
59
+ institution_name: string;
60
+
61
+ /**
62
+ * The last 4 digits of the account number. If present, this will be 4 numeric characters.
63
+ */
64
+ last4: string | null;
65
+ }
66
+
67
+ /**
68
+ * Filters to restrict the kinds of accounts to collect.
69
+ */
70
+ export interface Filters {
71
+ /**
72
+ * List of countries from which to collect accounts.
73
+ */
74
+ countries?: string[];
75
+ }
76
+
77
+ /**
78
+ * Data features to which access can be requested
79
+ */
80
+ export type Permission =
81
+ | 'payment_method'
82
+ | 'balances'
83
+ | 'transactions'
84
+ | 'ownership'
85
+ | 'account_numbers';
86
+ }
@@ -8,3 +8,4 @@ export * from './tokens';
8
8
  export * from './bank-accounts';
9
9
  export * from './cards';
10
10
  export * from './verification-sessions';
11
+ export * from './financial-connections';
@@ -1,4 +1,5 @@
1
1
  import {StripeElementBase, StripeElementChangeEvent} from './base';
2
+ import {StripeError} from '../stripe';
2
3
 
3
4
  export type StripeLinkAuthenticationElement = StripeElementBase & {
4
5
  /**
@@ -80,6 +81,47 @@ export type StripeLinkAuthenticationElement = StripeElementBase & {
80
81
  eventType: 'escape',
81
82
  handler?: (event: {elementType: 'linkAuthentication'}) => any
82
83
  ): StripeLinkAuthenticationElement;
84
+
85
+ /**
86
+ * Triggered when the element fails to load.
87
+ */
88
+ on(
89
+ eventType: 'loaderror',
90
+ handler: (event: {
91
+ elementType: 'linkAuthentication';
92
+ error: StripeError;
93
+ }) => any
94
+ ): StripeLinkAuthenticationElement;
95
+ once(
96
+ eventType: 'loaderror',
97
+ handler: (event: {
98
+ elementType: 'linkAuthentication';
99
+ error: StripeError;
100
+ }) => any
101
+ ): StripeLinkAuthenticationElement;
102
+ off(
103
+ eventType: 'loaderror',
104
+ handler?: (event: {
105
+ elementType: 'linkAuthentication';
106
+ error: StripeError;
107
+ }) => any
108
+ ): StripeLinkAuthenticationElement;
109
+
110
+ /**
111
+ * Triggered when the loader UI is mounted to the DOM and ready to be displayed.
112
+ */
113
+ on(
114
+ eventType: 'loaderstart',
115
+ handler: (event: {elementType: 'linkAuthentication'}) => any
116
+ ): StripeLinkAuthenticationElement;
117
+ once(
118
+ eventType: 'loaderstart',
119
+ handler: (event: {elementType: 'linkAuthentication'}) => any
120
+ ): StripeLinkAuthenticationElement;
121
+ off(
122
+ eventType: 'loaderstart',
123
+ handler?: (event: {elementType: 'linkAuthentication'}) => any
124
+ ): StripeLinkAuthenticationElement;
83
125
  };
84
126
 
85
127
  export interface StripeLinkAuthenticationElementOptions {
@@ -98,6 +98,22 @@ export type StripePaymentElement = StripeElementBase & {
98
98
  handler?: (event: {elementType: 'payment'; error: StripeError}) => any
99
99
  ): StripePaymentElement;
100
100
 
101
+ /**
102
+ * Triggered when the loader UI is mounted to the DOM and ready to be displayed.
103
+ */
104
+ on(
105
+ eventType: 'loaderstart',
106
+ handler: (event: {elementType: 'payment'}) => any
107
+ ): StripePaymentElement;
108
+ once(
109
+ eventType: 'loaderstart',
110
+ handler: (event: {elementType: 'payment'}) => any
111
+ ): StripePaymentElement;
112
+ off(
113
+ eventType: 'loaderstart',
114
+ handler?: (event: {elementType: 'payment'}) => any
115
+ ): StripePaymentElement;
116
+
101
117
  /**
102
118
  * Updates the options the `PaymentElement` was initialized with.
103
119
  * Updates are merged into the existing configuration.
@@ -110,6 +126,22 @@ export type StripePaymentElement = StripeElementBase & {
110
126
  collapse(): StripePaymentElement;
111
127
  };
112
128
 
129
+ export interface DefaultValuesOption {
130
+ billingDetails?: {
131
+ name?: string;
132
+ email?: string;
133
+ phone?: string;
134
+ address?: {
135
+ country?: string;
136
+ postal_code?: string;
137
+ state?: string;
138
+ city?: string;
139
+ line1?: string;
140
+ line2?: string;
141
+ };
142
+ };
143
+ }
144
+
113
145
  export type FieldOption = 'auto' | 'never';
114
146
 
115
147
  export interface FieldsOption {
@@ -152,6 +184,11 @@ export interface WalletsOption {
152
184
  }
153
185
 
154
186
  export interface StripePaymentElementOptions {
187
+ /**
188
+ * Provide initial customer information that will be displayed in the Payment Element.
189
+ */
190
+ defaultValues?: DefaultValuesOption;
191
+
155
192
  /**
156
193
  * Override the business name displayed in the Payment Element.
157
194
  * By default the PaymentElement will use your Stripe account or business name.
@@ -1,4 +1,5 @@
1
1
  import {StripeElementBase, StripeElementChangeEvent} from './base';
2
+ import {StripeError} from '../stripe';
2
3
 
3
4
  export type StripeShippingAddressElement = StripeElementBase & {
4
5
  /**
@@ -80,6 +81,47 @@ export type StripeShippingAddressElement = StripeElementBase & {
80
81
  eventType: 'escape',
81
82
  handler?: (event: {elementType: 'shippingAddress'}) => any
82
83
  ): StripeShippingAddressElement;
84
+
85
+ /**
86
+ * Triggered when the element fails to load.
87
+ */
88
+ on(
89
+ eventType: 'loaderror',
90
+ handler: (event: {
91
+ elementType: 'shippingAddress';
92
+ error: StripeError;
93
+ }) => any
94
+ ): StripeShippingAddressElement;
95
+ once(
96
+ eventType: 'loaderror',
97
+ handler: (event: {
98
+ elementType: 'shippingAddress';
99
+ error: StripeError;
100
+ }) => any
101
+ ): StripeShippingAddressElement;
102
+ off(
103
+ eventType: 'loaderror',
104
+ handler?: (event: {
105
+ elementType: 'shippingAddress';
106
+ error: StripeError;
107
+ }) => any
108
+ ): StripeShippingAddressElement;
109
+
110
+ /**
111
+ * Triggered when the loader UI is mounted to the DOM and ready to be displayed.
112
+ */
113
+ on(
114
+ eventType: 'loaderstart',
115
+ handler: (event: {elementType: 'shippingAddress'}) => any
116
+ ): StripeShippingAddressElement;
117
+ once(
118
+ eventType: 'loaderstart',
119
+ handler: (event: {elementType: 'shippingAddress'}) => any
120
+ ): StripeShippingAddressElement;
121
+ off(
122
+ eventType: 'loaderstart',
123
+ handler?: (event: {elementType: 'shippingAddress'}) => any
124
+ ): StripeShippingAddressElement;
83
125
  };
84
126
 
85
127
  export interface StripeShippingAddressElementOptions {
@@ -143,7 +185,7 @@ export interface StripeShippingAddressElementChangeEvent
143
185
  name: string;
144
186
  address: {
145
187
  line1: string;
146
- line2: string;
188
+ line2: string | null;
147
189
  city: string;
148
190
  state: string;
149
191
  postal_code: string;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Data to be sent with a `stripe.collectFinancialConnectionsAccounts` request.
3
+ */
4
+ export interface CollectFinancialConnectionsAccountsOptions {
5
+ /**
6
+ * The client secret of the [Financial Connections Session](https://stripe.com/docs/api/financial_connections/session).
7
+ */
8
+ clientSecret: string;
9
+ }
10
+
11
+ /**
12
+ * Data to be sent with a `stripe.collectBankAccountToken` request.
13
+ */
14
+ export interface CollectBankAccountTokenOptions {
15
+ /**
16
+ * The client secret of the [Financial Connections Session](https://stripe.com/docs/api/financial_connections/session).
17
+ */
18
+ clientSecret: string;
19
+ }
@@ -187,6 +187,11 @@ export interface VerifyMicrodepositsForSetupData {
187
187
  * An array of two positive integers, in cents, equal to the values of the microdeposits sent to the bank account.
188
188
  */
189
189
  amounts?: Array<number>;
190
+
191
+ /**
192
+ * A six-character code starting with SM present in the microdeposit sent to the bank account.
193
+ */
194
+ descriptor_code?: string;
190
195
  }
191
196
 
192
197
  export interface ConfirmUsBankAccountSetupData
@@ -4,6 +4,7 @@ import * as setupIntents from './setup-intents';
4
4
  import * as orders from './orders';
5
5
  import * as tokens from './token-and-sources';
6
6
  import * as elements from './elements';
7
+ import * as financialConnections from './financial-connections';
7
8
 
8
9
  import {StripeElements, StripeElementsOptions} from './elements-group';
9
10
  import {RedirectToCheckoutOptions} from './checkout';
@@ -975,6 +976,29 @@ export interface Stripe {
975
976
  * * @docs https://stripe.com/docs/js/identity/modal
976
977
  */
977
978
  verifyIdentity(clientSecret: string): Promise<VerificationSessionResult>;
979
+
980
+ /////////////////////////////
981
+ /// Financial Connections
982
+ ///
983
+ /////////////////////////////
984
+
985
+ /**
986
+ * Use `stripe.collectFinancialConnectionsAccounts` to display a [Financial Connections](https://stripe.com/docs/financial-connections) modal that lets you securely collect financial accounts.
987
+ *
988
+ * * @docs https://stripe.com/docs/js/financial_connections/collect_financial_connections_accounts
989
+ */
990
+ collectFinancialConnectionsAccounts(
991
+ options: financialConnections.CollectFinancialConnectionsAccountsOptions
992
+ ): Promise<FinancialConnectionsSessionResult>;
993
+
994
+ /**
995
+ * Use `stripe.collectBankAccountToken` to display a [Financial Connections](https://stripe.com/docs/financial-connections) modal that lets you securely collect a [Bank Account Token](https://stripe.com/docs/api/tokens/object).
996
+ *
997
+ * * @docs https://stripe.com/docs/js/financial_connections/collect_bank_account_token
998
+ */
999
+ collectBankAccountToken(
1000
+ options: financialConnections.CollectBankAccountTokenOptions
1001
+ ): Promise<CollectBankAccountTokenResult>;
978
1002
  }
979
1003
 
980
1004
  export type PaymentIntentResult =
@@ -1010,6 +1034,25 @@ export type VerificationSessionResult =
1010
1034
  | {verificationSession: api.VerificationSession; error?: undefined}
1011
1035
  | {verificationSession?: undefined; error: StripeError};
1012
1036
 
1037
+ export type FinancialConnectionsSessionResult =
1038
+ | {
1039
+ financialConnectionsSession: api.FinancialConnectionsSession;
1040
+ error?: undefined;
1041
+ }
1042
+ | {financialConnectionsSession: undefined; error: StripeError};
1043
+
1044
+ export type CollectBankAccountTokenResult =
1045
+ | {
1046
+ financialConnectionsSession: api.FinancialConnectionsSession;
1047
+ token: string;
1048
+ error?: undefined;
1049
+ }
1050
+ | {
1051
+ financialConnectionsSession: undefined;
1052
+ token: undefined;
1053
+ error: StripeError;
1054
+ };
1055
+
1013
1056
  export interface WrapperLibrary {
1014
1057
  /**
1015
1058
  * Your library’s name, maximum length is 30