@stripe/stripe-react-native 0.16.0 → 0.18.1
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/.husky/pre-commit +4 -0
- package/CHANGELOG.md +40 -0
- package/README.md +1 -1
- package/android/build.gradle +1 -1
- package/android/gradle.properties +2 -2
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt +8 -1
- package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetFragment.kt +278 -0
- package/android/src/main/java/com/reactnativestripesdk/GooglePayFragment.kt +4 -0
- package/android/src/main/java/com/reactnativestripesdk/GooglePayPaymentMethodLauncherFragment.kt +6 -2
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +9 -11
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +2 -2
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +3 -1
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +59 -22
- package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +4 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +11 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +5 -4
- package/ios/Errors.swift +12 -1
- package/ios/FinancialConnections.swift +258 -0
- package/ios/Mappers.swift +12 -9
- package/ios/StripeSdk.m +10 -1
- package/ios/StripeSdk.swift +51 -8
- package/lib/commonjs/NativeStripeSdk.js.map +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
- package/lib/commonjs/components/CardForm.js +1 -1
- package/lib/commonjs/components/CardForm.js.map +1 -1
- package/lib/commonjs/components/StripeProvider.js +1 -1
- package/lib/commonjs/components/StripeProvider.js.map +1 -1
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/hooks/useApplePay.js +1 -1
- package/lib/commonjs/hooks/useApplePay.js.map +1 -1
- package/lib/commonjs/hooks/useConfirmPayment.js +1 -1
- package/lib/commonjs/hooks/useConfirmPayment.js.map +1 -1
- package/lib/commonjs/hooks/useConfirmSetupIntent.js +1 -1
- package/lib/commonjs/hooks/useConfirmSetupIntent.js.map +1 -1
- package/lib/commonjs/hooks/useFinancialConnectionsSheet.js +2 -0
- package/lib/commonjs/hooks/useFinancialConnectionsSheet.js.map +1 -0
- package/lib/commonjs/hooks/useGooglePay.js +1 -1
- package/lib/commonjs/hooks/useGooglePay.js.map +1 -1
- package/lib/commonjs/hooks/usePaymentSheet.js +1 -1
- package/lib/commonjs/hooks/usePaymentSheet.js.map +1 -1
- package/lib/commonjs/hooks/useStripe.js +1 -1
- package/lib/commonjs/hooks/useStripe.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/plugin/withStripe.js +1 -1
- package/lib/commonjs/plugin/withStripe.js.map +1 -1
- package/lib/commonjs/types/FinancialConnections.js +2 -0
- package/lib/commonjs/types/FinancialConnections.js.map +1 -0
- package/lib/commonjs/types/PaymentIntent.js.map +1 -1
- package/lib/commonjs/types/SetupIntent.js.map +1 -1
- package/lib/commonjs/types/index.js +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/NativeStripeSdk.js.map +1 -1
- package/lib/module/components/AuBECSDebitForm.js +1 -1
- package/lib/module/components/AuBECSDebitForm.js.map +1 -1
- package/lib/module/components/CardForm.js +1 -1
- package/lib/module/components/CardForm.js.map +1 -1
- package/lib/module/components/StripeProvider.js +1 -1
- package/lib/module/components/StripeProvider.js.map +1 -1
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/hooks/useApplePay.js +1 -1
- package/lib/module/hooks/useApplePay.js.map +1 -1
- package/lib/module/hooks/useConfirmPayment.js +1 -1
- package/lib/module/hooks/useConfirmPayment.js.map +1 -1
- package/lib/module/hooks/useConfirmSetupIntent.js +1 -1
- package/lib/module/hooks/useConfirmSetupIntent.js.map +1 -1
- package/lib/module/hooks/useFinancialConnectionsSheet.js +2 -0
- package/lib/module/hooks/useFinancialConnectionsSheet.js.map +1 -0
- package/lib/module/hooks/useGooglePay.js +1 -1
- package/lib/module/hooks/useGooglePay.js.map +1 -1
- package/lib/module/hooks/usePaymentSheet.js +1 -1
- package/lib/module/hooks/usePaymentSheet.js.map +1 -1
- package/lib/module/hooks/useStripe.js +1 -1
- package/lib/module/hooks/useStripe.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/plugin/withStripe.js +1 -1
- package/lib/module/plugin/withStripe.js.map +1 -1
- package/lib/module/types/FinancialConnections.js +2 -0
- package/lib/module/types/FinancialConnections.js.map +1 -0
- package/lib/module/types/PaymentIntent.js.map +1 -1
- package/lib/module/types/SetupIntent.js.map +1 -1
- package/lib/module/types/index.js +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/src/NativeStripeSdk.d.ts +4 -2
- package/lib/typescript/src/functions.d.ts +24 -2
- package/lib/typescript/src/hooks/useConfirmPayment.d.ts +2 -2
- package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts +11 -0
- package/lib/typescript/src/hooks/useStripe.d.ts +4 -2
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/types/FinancialConnections.d.ts +100 -0
- package/lib/typescript/src/types/PaymentIntent.d.ts +1 -0
- package/lib/typescript/src/types/SetupIntent.d.ts +1 -0
- package/lib/typescript/src/types/Token.d.ts +18 -7
- package/lib/typescript/src/types/index.d.ts +2 -1
- package/package.json +10 -12
- package/src/NativeStripeSdk.tsx +10 -2
- package/src/functions.ts +67 -1
- package/src/hooks/useConfirmPayment.tsx +3 -3
- package/src/hooks/useFinancialConnectionsSheet.tsx +34 -0
- package/src/hooks/useStripe.tsx +24 -2
- package/src/index.tsx +1 -0
- package/src/types/FinancialConnections.ts +126 -0
- package/src/types/PaymentIntent.ts +1 -0
- package/src/types/SetupIntent.ts +1 -0
- package/src/types/Token.ts +24 -7
- package/src/types/index.ts +2 -0
- package/stripe-react-native.podspec +1 -1
package/src/functions.ts
CHANGED
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
IsCardInWalletResult,
|
|
36
36
|
CanAddCardToWalletParams,
|
|
37
37
|
CanAddCardToWalletResult,
|
|
38
|
+
FinancialConnections,
|
|
38
39
|
} from './types';
|
|
39
40
|
|
|
40
41
|
const APPLE_PAY_NOT_SUPPORTED_MESSAGE =
|
|
@@ -138,9 +139,17 @@ export const retrieveSetupIntent = async (
|
|
|
138
139
|
}
|
|
139
140
|
};
|
|
140
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Confirm and, if necessary, authenticate a PaymentIntent.
|
|
144
|
+
*
|
|
145
|
+
* @param paymentIntentClientSecret The client_secret of the associated [PaymentIntent](https://stripe.com/docs/api/payment_intents).
|
|
146
|
+
* @param params An optional object that contains data related to the payment method used to confirm this payment. If no object is provided (undefined), then it is assumed that the payment method has already been [attached to the Payment Intent](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method).
|
|
147
|
+
* @param options An optional object that contains options for this payment method.
|
|
148
|
+
* @returns A promise that resolves to an object containing either a `paymentIntent` field, or an `error` field.
|
|
149
|
+
*/
|
|
141
150
|
export const confirmPayment = async (
|
|
142
151
|
paymentIntentClientSecret: string,
|
|
143
|
-
params
|
|
152
|
+
params?: PaymentIntent.ConfirmParams,
|
|
144
153
|
options: PaymentIntent.ConfirmOptions = {}
|
|
145
154
|
): Promise<ConfirmPaymentResult> => {
|
|
146
155
|
try {
|
|
@@ -567,6 +576,63 @@ export const collectBankAccountForSetup = async (
|
|
|
567
576
|
}
|
|
568
577
|
};
|
|
569
578
|
|
|
579
|
+
/**
|
|
580
|
+
* Use collectBankAccountToken in the [Add a Financial Connections Account to a US Custom Connect](https://stripe.com/docs/financial-connections/connect-payouts) account flow.
|
|
581
|
+
* When called, it will load the Authentication Flow, an on-page modal UI which allows your user to securely link their external financial account for payouts.
|
|
582
|
+
* @param clientSecret The client_secret of the [Financial Connections Session](https://stripe.com/docs/api/financial_connections/session).
|
|
583
|
+
* @returns A promise that resolves to an object containing either `session` and `token` fields, or an error field.
|
|
584
|
+
*/
|
|
585
|
+
export const collectBankAccountToken = async (
|
|
586
|
+
clientSecret: string
|
|
587
|
+
): Promise<FinancialConnections.TokenResult> => {
|
|
588
|
+
try {
|
|
589
|
+
const { session, token, error } =
|
|
590
|
+
await NativeStripeSdk.collectBankAccountToken(clientSecret);
|
|
591
|
+
|
|
592
|
+
if (error) {
|
|
593
|
+
return {
|
|
594
|
+
error,
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
return {
|
|
598
|
+
session: session!,
|
|
599
|
+
token: token!,
|
|
600
|
+
};
|
|
601
|
+
} catch (error: any) {
|
|
602
|
+
return {
|
|
603
|
+
error: createError(error),
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Use collectFinancialConnectionsAccounts in the [Collect an account to build data-powered products](https://stripe.com/docs/financial-connections/other-data-powered-products) flow.
|
|
610
|
+
* When called, it will load the Authentication Flow, an on-page modal UI which allows your user to securely link their external financial account.
|
|
611
|
+
* @param clientSecret The client_secret of the [Financial Connections Session](https://stripe.com/docs/api/financial_connections/session).
|
|
612
|
+
* @returns A promise that resolves to an object containing either a `session` field, or an error field.
|
|
613
|
+
*/
|
|
614
|
+
export const collectFinancialConnectionsAccounts = async (
|
|
615
|
+
clientSecret: string
|
|
616
|
+
): Promise<FinancialConnections.SessionResult> => {
|
|
617
|
+
try {
|
|
618
|
+
const { session, error } =
|
|
619
|
+
await NativeStripeSdk.collectFinancialConnectionsAccounts(clientSecret);
|
|
620
|
+
|
|
621
|
+
if (error) {
|
|
622
|
+
return {
|
|
623
|
+
error,
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
return {
|
|
627
|
+
session: session!,
|
|
628
|
+
};
|
|
629
|
+
} catch (error: any) {
|
|
630
|
+
return {
|
|
631
|
+
error: createError(error),
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
|
|
570
636
|
export const canAddCardToWallet = async (
|
|
571
637
|
params: CanAddCardToWalletParams
|
|
572
638
|
): Promise<CanAddCardToWalletResult> => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useState } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PaymentIntent } from '../types';
|
|
3
3
|
import { useStripe } from './useStripe';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -12,8 +12,8 @@ export function useConfirmPayment() {
|
|
|
12
12
|
const _confirmPayment = useCallback(
|
|
13
13
|
async (
|
|
14
14
|
paymentIntentClientSecret: string,
|
|
15
|
-
data
|
|
16
|
-
options:
|
|
15
|
+
data?: PaymentIntent.ConfirmParams,
|
|
16
|
+
options: PaymentIntent.ConfirmOptions = {}
|
|
17
17
|
) => {
|
|
18
18
|
setLoading(true);
|
|
19
19
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { useStripe } from './useStripe';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* React hook for accessing functions on the Financial Connections sheet.
|
|
6
|
+
*
|
|
7
|
+
* Retuns the `collectBankAccountToken` and `collectFinancialConnectionsAccounts` functions, and a `loading` boolean that you can use
|
|
8
|
+
* to display loading state (like showing a spinner).
|
|
9
|
+
*/
|
|
10
|
+
export function useFinancialConnectionsSheet() {
|
|
11
|
+
const [loading, setLoading] = useState(false);
|
|
12
|
+
const { collectBankAccountToken, collectFinancialConnectionsAccounts } =
|
|
13
|
+
useStripe();
|
|
14
|
+
|
|
15
|
+
const _collectBankAccountToken = async (clientSecret: string) => {
|
|
16
|
+
setLoading(true);
|
|
17
|
+
const result = await collectBankAccountToken(clientSecret);
|
|
18
|
+
setLoading(false);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const _collectFinancialConnectionsAccounts = async (clientSecret: string) => {
|
|
23
|
+
setLoading(true);
|
|
24
|
+
const result = await collectFinancialConnectionsAccounts(clientSecret);
|
|
25
|
+
setLoading(false);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
collectBankAccountToken: _collectBankAccountToken,
|
|
31
|
+
collectFinancialConnectionsAccounts: _collectFinancialConnectionsAccounts,
|
|
32
|
+
loading,
|
|
33
|
+
};
|
|
34
|
+
}
|
package/src/hooks/useStripe.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
PaymentMethod,
|
|
3
|
+
PaymentIntent,
|
|
3
4
|
ApplePay,
|
|
4
5
|
PaymentSheet,
|
|
5
6
|
CreatePaymentMethodResult,
|
|
@@ -30,6 +31,7 @@ import type {
|
|
|
30
31
|
CollectBankAccountForPaymentResult,
|
|
31
32
|
CanAddCardToWalletParams,
|
|
32
33
|
CanAddCardToWalletResult,
|
|
34
|
+
FinancialConnections,
|
|
33
35
|
} from '../types';
|
|
34
36
|
import { useCallback, useEffect, useState } from 'react';
|
|
35
37
|
import { isiOS } from '../helpers';
|
|
@@ -60,6 +62,8 @@ import {
|
|
|
60
62
|
verifyMicrodepositsForPayment,
|
|
61
63
|
verifyMicrodepositsForSetup,
|
|
62
64
|
canAddCardToWallet,
|
|
65
|
+
collectBankAccountToken,
|
|
66
|
+
collectFinancialConnectionsAccounts,
|
|
63
67
|
} from '../functions';
|
|
64
68
|
|
|
65
69
|
/**
|
|
@@ -114,8 +118,8 @@ export function useStripe() {
|
|
|
114
118
|
const _confirmPayment = useCallback(
|
|
115
119
|
async (
|
|
116
120
|
paymentIntentClientSecret: string,
|
|
117
|
-
data
|
|
118
|
-
options:
|
|
121
|
+
data?: PaymentIntent.ConfirmParams,
|
|
122
|
+
options: PaymentIntent.ConfirmOptions = {}
|
|
119
123
|
): Promise<ConfirmPaymentResult> => {
|
|
120
124
|
return confirmPayment(paymentIntentClientSecret, data, options);
|
|
121
125
|
},
|
|
@@ -290,6 +294,22 @@ export function useStripe() {
|
|
|
290
294
|
[]
|
|
291
295
|
);
|
|
292
296
|
|
|
297
|
+
const _collectBankAccountToken = useCallback(
|
|
298
|
+
async (clientSecret: string): Promise<FinancialConnections.TokenResult> => {
|
|
299
|
+
return collectBankAccountToken(clientSecret);
|
|
300
|
+
},
|
|
301
|
+
[]
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
const _collectFinancialConnectionsAccounts = useCallback(
|
|
305
|
+
async (
|
|
306
|
+
clientSecret: string
|
|
307
|
+
): Promise<FinancialConnections.SessionResult> => {
|
|
308
|
+
return collectFinancialConnectionsAccounts(clientSecret);
|
|
309
|
+
},
|
|
310
|
+
[]
|
|
311
|
+
);
|
|
312
|
+
|
|
293
313
|
return {
|
|
294
314
|
retrievePaymentIntent: _retrievePaymentIntent,
|
|
295
315
|
retrieveSetupIntent: _retrieveSetupIntent,
|
|
@@ -317,5 +337,7 @@ export function useStripe() {
|
|
|
317
337
|
verifyMicrodepositsForPayment: _verifyMicrodepositsForPayment,
|
|
318
338
|
verifyMicrodepositsForSetup: _verifyMicrodepositsForSetup,
|
|
319
339
|
canAddCardToWallet: _canAddCardToWallet,
|
|
340
|
+
collectBankAccountToken: _collectBankAccountToken,
|
|
341
|
+
collectFinancialConnectionsAccounts: _collectFinancialConnectionsAccounts,
|
|
320
342
|
};
|
|
321
343
|
}
|
package/src/index.tsx
CHANGED
|
@@ -5,6 +5,7 @@ export { useStripe } from './hooks/useStripe';
|
|
|
5
5
|
export { useApplePay, Props as UseApplePayProps } from './hooks/useApplePay';
|
|
6
6
|
export { usePaymentSheet } from './hooks/usePaymentSheet';
|
|
7
7
|
export { useGooglePay } from './hooks/useGooglePay';
|
|
8
|
+
export { useFinancialConnectionsSheet } from './hooks/useFinancialConnectionsSheet';
|
|
8
9
|
|
|
9
10
|
//components
|
|
10
11
|
export {
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { BankAccount } from './Token';
|
|
2
|
+
import type { StripeError } from './Errors';
|
|
3
|
+
|
|
4
|
+
export type SessionResult =
|
|
5
|
+
| {
|
|
6
|
+
/** The updated Financial Connections Session object. */
|
|
7
|
+
session: Session;
|
|
8
|
+
error?: undefined;
|
|
9
|
+
}
|
|
10
|
+
| {
|
|
11
|
+
session?: undefined;
|
|
12
|
+
error: StripeError<FinancialConnectionsSheetError>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type TokenResult =
|
|
16
|
+
| {
|
|
17
|
+
/** The updated Financial Connections Session object. */
|
|
18
|
+
session: Session;
|
|
19
|
+
/** The Stripe token object associated with the bank account. */
|
|
20
|
+
token: BankAccountToken;
|
|
21
|
+
error?: undefined;
|
|
22
|
+
}
|
|
23
|
+
| {
|
|
24
|
+
session?: undefined;
|
|
25
|
+
token?: undefined;
|
|
26
|
+
error: StripeError<FinancialConnectionsSheetError>;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type Session = {
|
|
30
|
+
/** A unique ID for this session. */
|
|
31
|
+
id: string;
|
|
32
|
+
/** The client secret for this session. */
|
|
33
|
+
clientSecret: string;
|
|
34
|
+
/** Has the value true if the object exists in live mode or the value false if the object exists in test mode. */
|
|
35
|
+
livemode: boolean;
|
|
36
|
+
/** The accounts that were collected as part of this Session. */
|
|
37
|
+
accounts: Array<Account>;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type BankAccountToken = {
|
|
41
|
+
/** Bank account details. */
|
|
42
|
+
bankAccount: BankAccount | null;
|
|
43
|
+
/** Has the value true if the object exists in live mode or the value false if the object exists in test mode. */
|
|
44
|
+
livemode: boolean;
|
|
45
|
+
/** A unique ID for this token. */
|
|
46
|
+
id: string | null;
|
|
47
|
+
used: boolean;
|
|
48
|
+
type: 'BankAccount';
|
|
49
|
+
/** The UNIX timestamp (in milliseconds) of the date this token was created. */
|
|
50
|
+
created: number | null;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type Account = {
|
|
54
|
+
/** A unique ID for this Financial Connections Account. */
|
|
55
|
+
id: string;
|
|
56
|
+
/** Has the value true if the object exists in live mode or the value false if the object exists in test mode. */
|
|
57
|
+
livemode: boolean;
|
|
58
|
+
displayName: string | null;
|
|
59
|
+
/** The current status of the account. Either active, inactive, or disconnected. */
|
|
60
|
+
status: AccountStatus;
|
|
61
|
+
institutionName: string;
|
|
62
|
+
last4: string | null;
|
|
63
|
+
/** The UNIX timestamp (in milliseconds) of the date this account was created. */
|
|
64
|
+
created: number;
|
|
65
|
+
/** The balance of this account. */
|
|
66
|
+
balance: Balance | null;
|
|
67
|
+
/** The last balance refresh. Includes the timestamp and the status. */
|
|
68
|
+
balanceRefresh: BalanceRefresh | null;
|
|
69
|
+
/** The category of this account, either cash, credit, investment, or other. */
|
|
70
|
+
category: Category;
|
|
71
|
+
/** The subcategory of this account, either checking, credit_card, line_of_credit, mortgage, savings, or other. */
|
|
72
|
+
subcategory: Subcategory;
|
|
73
|
+
/** Permissions requested for accounts collected during this session. */
|
|
74
|
+
permissions: Array<Permission> | null;
|
|
75
|
+
/** The supported payment method types for this account. */
|
|
76
|
+
supportedPaymentMethodTypes: Array<PaymentMethodType>;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export type AccountStatus = 'active' | 'inactive' | 'disconnected';
|
|
80
|
+
|
|
81
|
+
export type Category = 'cash' | 'credit' | 'investment' | 'other';
|
|
82
|
+
|
|
83
|
+
export type PaymentMethodType = 'us_bank_account' | 'link';
|
|
84
|
+
|
|
85
|
+
export type Subcategory =
|
|
86
|
+
| 'checking'
|
|
87
|
+
| 'credit_card'
|
|
88
|
+
| 'line_of_credit'
|
|
89
|
+
| 'mortgage'
|
|
90
|
+
| 'other'
|
|
91
|
+
| 'savings';
|
|
92
|
+
|
|
93
|
+
export type Permission =
|
|
94
|
+
| 'balances'
|
|
95
|
+
| 'ownership'
|
|
96
|
+
| 'payment_method'
|
|
97
|
+
| 'transactions'
|
|
98
|
+
| 'account_numbers';
|
|
99
|
+
|
|
100
|
+
export type Balance = {
|
|
101
|
+
/** The UNIX timestamp (in milliseconds) of time that the external institution calculated this balance. */
|
|
102
|
+
asOf: number;
|
|
103
|
+
/** The type of this balance, either cash or credit. */
|
|
104
|
+
type: BalanceType;
|
|
105
|
+
/** The funds available to the account holder. Typically this is the current balance less any holds. Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Each value is an integer amount. A positive amount indicates money owed to the account holder. A negative amount indicates money owed by the account holder. */
|
|
106
|
+
cash: { available: Map<String, number> | null };
|
|
107
|
+
/** The credit that has been used by the account holder. Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Each value is a integer amount. A positive amount indicates money owed to the account holder. A negative amount indicates money owed by the account holder. */
|
|
108
|
+
credit: { used: Map<String, number> | null };
|
|
109
|
+
/** The balances owed to (or by) the account holder. Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Each value is a integer amount. A positive amount indicates money owed to the account holder. A negative amount indicates money owed by the account holder. */
|
|
110
|
+
current: Map<String, number>;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export type BalanceRefresh = {
|
|
114
|
+
status: BalanceRefreshStatus;
|
|
115
|
+
/** The UNIX timestamp (in milliseconds) of the time at which the last refresh attempt was initiated. */
|
|
116
|
+
lastAttemptedAt: number;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export type BalanceType = 'cash' | 'credit';
|
|
120
|
+
|
|
121
|
+
export type BalanceRefreshStatus = 'failed' | 'pending' | 'succeeded';
|
|
122
|
+
|
|
123
|
+
export enum FinancialConnectionsSheetError {
|
|
124
|
+
Failed = 'Failed',
|
|
125
|
+
Canceled = 'Canceled',
|
|
126
|
+
}
|
package/src/types/SetupIntent.ts
CHANGED
|
@@ -6,6 +6,7 @@ export interface Result {
|
|
|
6
6
|
id: string;
|
|
7
7
|
clientSecret: string;
|
|
8
8
|
lastSetupError: LastPaymentError | null;
|
|
9
|
+
/** The UNIX timestamp (in milliseconds) of the date this Setup Intent was created. */
|
|
9
10
|
created: string | null;
|
|
10
11
|
livemode: boolean;
|
|
11
12
|
paymentMethodId: string | null;
|
package/src/types/Token.ts
CHANGED
|
@@ -20,6 +20,7 @@ export type Type =
|
|
|
20
20
|
|
|
21
21
|
export interface Result {
|
|
22
22
|
id: string;
|
|
23
|
+
/** The UNIX timestamp (in milliseconds) of the date this token was created. */
|
|
23
24
|
created: string;
|
|
24
25
|
type: Type;
|
|
25
26
|
used: boolean;
|
|
@@ -29,15 +30,31 @@ export interface Result {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
export interface BankAccount {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
/** A unique ID for this bank account. */
|
|
34
|
+
id: string;
|
|
35
|
+
/** The name of the associated bank. */
|
|
36
|
+
bankName: string | null;
|
|
37
|
+
/** The name of the person or business that owns the bank account. This field is required when attaching the bank account to a Customer object. */
|
|
38
|
+
accountHolderName: string | null;
|
|
39
|
+
/** The type of entity that holds the account. */
|
|
40
|
+
accountHolderType: BankAcccountHolderType | null;
|
|
41
|
+
/** The currency the bank account is in. This must be a country/currency pairing that Stripe supports. */
|
|
42
|
+
currency: string | null;
|
|
43
|
+
/** The country in which the bank account is located. */
|
|
44
|
+
country: string | null;
|
|
45
|
+
routingNumber: string | null;
|
|
46
|
+
status: BankAccountStatus | null;
|
|
47
|
+
fingerprint: string | null;
|
|
48
|
+
last4: string | null;
|
|
39
49
|
}
|
|
40
50
|
|
|
51
|
+
export type BankAccountStatus =
|
|
52
|
+
| 'Errored'
|
|
53
|
+
| 'New'
|
|
54
|
+
| 'Validated'
|
|
55
|
+
| 'VerificationFailed'
|
|
56
|
+
| 'Verified';
|
|
57
|
+
|
|
41
58
|
export interface Card {
|
|
42
59
|
country: string;
|
|
43
60
|
brand: CardBrand;
|
package/src/types/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ import * as AuBECSDebitFormComponent from './components/AuBECSDebitFormComponent
|
|
|
25
25
|
import * as CardFieldInput from './components/CardFieldInput';
|
|
26
26
|
import * as CardFormView from './components/CardFormView';
|
|
27
27
|
import * as Token from './Token';
|
|
28
|
+
import * as FinancialConnections from './FinancialConnections';
|
|
28
29
|
|
|
29
30
|
export {
|
|
30
31
|
ApplePay,
|
|
@@ -39,6 +40,7 @@ export {
|
|
|
39
40
|
CardFieldInput,
|
|
40
41
|
CardFormView,
|
|
41
42
|
Token,
|
|
43
|
+
FinancialConnections,
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
export * from './Errors';
|