@stripe/stripe-react-native 0.16.0 → 0.17.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/.husky/pre-commit +4 -0
- package/CHANGELOG.md +14 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt +5 -1
- package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetFragment.kt +284 -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/PaymentSheetFragment.kt +3 -1
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +46 -14
- 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 +11 -0
- package/ios/FinancialConnections.swift +258 -0
- package/ios/Mappers.swift +12 -9
- package/ios/StripeSdk.m +10 -1
- package/ios/StripeSdk.swift +28 -1
- package/lib/commonjs/NativeStripeSdk.js.map +1 -1
- package/lib/commonjs/components/AddToWalletButton.js +1 -1
- package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
- package/lib/commonjs/components/ApplePayButton.js +1 -1
- package/lib/commonjs/components/ApplePayButton.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/CardField.js +1 -1
- package/lib/commonjs/components/CardField.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/GooglePayButton.js +1 -1
- package/lib/commonjs/components/GooglePayButton.js.map +1 -1
- package/lib/commonjs/components/StripeContainer.js +1 -1
- package/lib/commonjs/components/StripeContainer.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/AddToWalletButton.js +1 -1
- package/lib/module/components/AddToWalletButton.js.map +1 -1
- package/lib/module/components/ApplePayButton.js +1 -1
- package/lib/module/components/ApplePayButton.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/CardField.js +1 -1
- package/lib/module/components/CardField.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/GooglePayButton.js +1 -1
- package/lib/module/components/GooglePayButton.js.map +1 -1
- package/lib/module/components/StripeContainer.js +1 -1
- package/lib/module/components/StripeContainer.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 +3 -1
- package/lib/typescript/src/functions.d.ts +15 -1
- package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts +11 -0
- package/lib/typescript/src/hooks/useStripe.d.ts +3 -1
- 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 +7 -0
- package/src/functions.ts +58 -0
- package/src/hooks/useFinancialConnectionsSheet.tsx +34 -0
- package/src/hooks/useStripe.tsx +21 -0
- 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/android/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.1/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/gradle.xml +0 -13
- package/android/.idea/misc.xml +0 -9
- package/android/.idea/modules/android.iml +0 -18
- package/android/.idea/modules.xml +0 -8
- package/android/.idea/vcs.xml +0 -6
- package/android/local.properties +0 -8
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcuserdata/charliecruzan.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/StripeSdk.xcodeproj/xcuserdata/charliecruzan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -22
- package/ios/StripeSdk.xcodeproj/xcuserdata/charliecruzan.xcuserdatad/xcschemes/xcschememanagement.plist +0 -27
|
@@ -3,6 +3,7 @@ export declare type CardBrand = 'AmericanExpress' | 'DinersClub' | 'Discover' |
|
|
|
3
3
|
export declare type Type = 'Account' | 'BankAccount' | 'Card' | 'CvcUpdate' | 'Person' | 'Pii';
|
|
4
4
|
export interface Result {
|
|
5
5
|
id: string;
|
|
6
|
+
/** The UNIX timestamp (in milliseconds) of the date this token was created. */
|
|
6
7
|
created: string;
|
|
7
8
|
type: Type;
|
|
8
9
|
used: boolean;
|
|
@@ -11,14 +12,24 @@ export interface Result {
|
|
|
11
12
|
bankAccount?: BankAccount;
|
|
12
13
|
}
|
|
13
14
|
export interface BankAccount {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
/** A unique ID for this bank account. */
|
|
16
|
+
id: string;
|
|
17
|
+
/** The name of the associated bank. */
|
|
18
|
+
bankName: string | null;
|
|
19
|
+
/** 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. */
|
|
20
|
+
accountHolderName: string | null;
|
|
21
|
+
/** The type of entity that holds the account. */
|
|
22
|
+
accountHolderType: BankAcccountHolderType | null;
|
|
23
|
+
/** The currency the bank account is in. This must be a country/currency pairing that Stripe supports. */
|
|
24
|
+
currency: string | null;
|
|
25
|
+
/** The country in which the bank account is located. */
|
|
26
|
+
country: string | null;
|
|
27
|
+
routingNumber: string | null;
|
|
28
|
+
status: BankAccountStatus | null;
|
|
29
|
+
fingerprint: string | null;
|
|
30
|
+
last4: string | null;
|
|
21
31
|
}
|
|
32
|
+
export declare type BankAccountStatus = 'Errored' | 'New' | 'Validated' | 'VerificationFailed' | 'Verified';
|
|
22
33
|
export interface Card {
|
|
23
34
|
country: string;
|
|
24
35
|
brand: CardBrand;
|
|
@@ -11,7 +11,8 @@ import * as AuBECSDebitFormComponent from './components/AuBECSDebitFormComponent
|
|
|
11
11
|
import * as CardFieldInput from './components/CardFieldInput';
|
|
12
12
|
import * as CardFormView from './components/CardFormView';
|
|
13
13
|
import * as Token from './Token';
|
|
14
|
-
|
|
14
|
+
import * as FinancialConnections from './FinancialConnections';
|
|
15
|
+
export { ApplePay, PaymentIntent, PaymentMethod, PaymentSheet, SetupIntent, ThreeDSecure, GooglePay, ApplePayButtonComponent, AuBECSDebitFormComponent, CardFieldInput, CardFormView, Token, FinancialConnections, };
|
|
15
16
|
export * from './Errors';
|
|
16
17
|
export { Address, BillingDetails } from './Common';
|
|
17
18
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stripe/stripe-react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"author": "Stripe",
|
|
5
5
|
"description": "Stripe SDK for React Native",
|
|
6
6
|
"main": "lib/commonjs/index",
|
|
@@ -50,19 +50,19 @@
|
|
|
50
50
|
"@wdio/mocha-framework": "^7.16.15",
|
|
51
51
|
"@wdio/spec-reporter": "^7.16.14",
|
|
52
52
|
"@wdio/sync": "^7.16.15",
|
|
53
|
-
"appium": "^1.22.
|
|
53
|
+
"appium": "^1.22.3",
|
|
54
54
|
"appium-chromedriver": "4.26.2",
|
|
55
55
|
"eslint": "^7.32.0",
|
|
56
56
|
"eslint-config-prettier": "^6.11.0",
|
|
57
57
|
"eslint-plugin-prettier": "^3.1.3",
|
|
58
58
|
"expect-webdriverio": "^2.0.1",
|
|
59
|
-
"husky": "^
|
|
59
|
+
"husky": "^8.0.0",
|
|
60
60
|
"jest": "^26.6.3",
|
|
61
|
-
"metro-react-native-babel-preset": "^0.
|
|
61
|
+
"metro-react-native-babel-preset": "^0.70.3",
|
|
62
62
|
"mocha": "^8.3.2",
|
|
63
63
|
"prettier": "^2.0.5",
|
|
64
|
-
"react": "
|
|
65
|
-
"react-native": "0.
|
|
64
|
+
"react": "18.0.0",
|
|
65
|
+
"react-native": "0.69.2",
|
|
66
66
|
"ts-node": "^9.1.1",
|
|
67
67
|
"typedoc": "^0.22.12",
|
|
68
68
|
"typescript": "~4.4.4",
|
|
@@ -81,11 +81,6 @@
|
|
|
81
81
|
"<rootDir>/e2e"
|
|
82
82
|
]
|
|
83
83
|
},
|
|
84
|
-
"husky": {
|
|
85
|
-
"hooks": {
|
|
86
|
-
"pre-commit": "yarn lint && yarn typescript"
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
84
|
"eslintConfig": {
|
|
90
85
|
"extends": [
|
|
91
86
|
"@react-native-community",
|
|
@@ -145,6 +140,9 @@
|
|
|
145
140
|
]
|
|
146
141
|
},
|
|
147
142
|
"dependencies": {
|
|
148
|
-
"@expo/config-plugins": "^4.1.
|
|
143
|
+
"@expo/config-plugins": "^4.1.5"
|
|
144
|
+
},
|
|
145
|
+
"resolutions": {
|
|
146
|
+
"simple-plist": "1.3.1"
|
|
149
147
|
}
|
|
150
148
|
}
|
package/src/NativeStripeSdk.tsx
CHANGED
|
@@ -27,6 +27,7 @@ import type {
|
|
|
27
27
|
IsCardInWalletResult,
|
|
28
28
|
CanAddCardToWalletParams,
|
|
29
29
|
CanAddCardToWalletResult,
|
|
30
|
+
FinancialConnections,
|
|
30
31
|
} from './types';
|
|
31
32
|
|
|
32
33
|
type NativeStripeSdkType = {
|
|
@@ -96,6 +97,12 @@ type NativeStripeSdkType = {
|
|
|
96
97
|
isCardInWallet(params: {
|
|
97
98
|
cardLastFour: string;
|
|
98
99
|
}): Promise<IsCardInWalletResult>;
|
|
100
|
+
collectBankAccountToken(
|
|
101
|
+
clientSecret: string
|
|
102
|
+
): Promise<FinancialConnections.TokenResult>;
|
|
103
|
+
collectFinancialConnectionsAccounts(
|
|
104
|
+
clientSecret: string
|
|
105
|
+
): Promise<FinancialConnections.SessionResult>;
|
|
99
106
|
};
|
|
100
107
|
|
|
101
108
|
const { StripeSdk } = NativeModules;
|
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 =
|
|
@@ -567,6 +568,63 @@ export const collectBankAccountForSetup = async (
|
|
|
567
568
|
}
|
|
568
569
|
};
|
|
569
570
|
|
|
571
|
+
/**
|
|
572
|
+
* Use collectBankAccountToken in the [Add a Financial Connections Account to a US Custom Connect](https://stripe.com/docs/financial-connections/connect-payouts) account flow.
|
|
573
|
+
* 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.
|
|
574
|
+
* @param clientSecret The client_secret of the [Financial Connections Session](https://stripe.com/docs/api/financial_connections/session).
|
|
575
|
+
* @returns A promise that resolves to an object containing either `session` and `token` fields, or an error field.
|
|
576
|
+
*/
|
|
577
|
+
export const collectBankAccountToken = async (
|
|
578
|
+
clientSecret: string
|
|
579
|
+
): Promise<FinancialConnections.TokenResult> => {
|
|
580
|
+
try {
|
|
581
|
+
const { session, token, error } =
|
|
582
|
+
await NativeStripeSdk.collectBankAccountToken(clientSecret);
|
|
583
|
+
|
|
584
|
+
if (error) {
|
|
585
|
+
return {
|
|
586
|
+
error,
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
return {
|
|
590
|
+
session: session!,
|
|
591
|
+
token: token!,
|
|
592
|
+
};
|
|
593
|
+
} catch (error: any) {
|
|
594
|
+
return {
|
|
595
|
+
error: createError(error),
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Use collectFinancialConnectionsAccounts in the [Collect an account to build data-powered products](https://stripe.com/docs/financial-connections/other-data-powered-products) flow.
|
|
602
|
+
* When called, it will load the Authentication Flow, an on-page modal UI which allows your user to securely link their external financial account.
|
|
603
|
+
* @param clientSecret The client_secret of the [Financial Connections Session](https://stripe.com/docs/api/financial_connections/session).
|
|
604
|
+
* @returns A promise that resolves to an object containing either a `session` field, or an error field.
|
|
605
|
+
*/
|
|
606
|
+
export const collectFinancialConnectionsAccounts = async (
|
|
607
|
+
clientSecret: string
|
|
608
|
+
): Promise<FinancialConnections.SessionResult> => {
|
|
609
|
+
try {
|
|
610
|
+
const { session, error } =
|
|
611
|
+
await NativeStripeSdk.collectFinancialConnectionsAccounts(clientSecret);
|
|
612
|
+
|
|
613
|
+
if (error) {
|
|
614
|
+
return {
|
|
615
|
+
error,
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
return {
|
|
619
|
+
session: session!,
|
|
620
|
+
};
|
|
621
|
+
} catch (error: any) {
|
|
622
|
+
return {
|
|
623
|
+
error: createError(error),
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
|
|
570
628
|
export const canAddCardToWallet = async (
|
|
571
629
|
params: CanAddCardToWalletParams
|
|
572
630
|
): Promise<CanAddCardToWalletResult> => {
|
|
@@ -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
|
@@ -30,6 +30,7 @@ import type {
|
|
|
30
30
|
CollectBankAccountForPaymentResult,
|
|
31
31
|
CanAddCardToWalletParams,
|
|
32
32
|
CanAddCardToWalletResult,
|
|
33
|
+
FinancialConnections,
|
|
33
34
|
} from '../types';
|
|
34
35
|
import { useCallback, useEffect, useState } from 'react';
|
|
35
36
|
import { isiOS } from '../helpers';
|
|
@@ -60,6 +61,8 @@ import {
|
|
|
60
61
|
verifyMicrodepositsForPayment,
|
|
61
62
|
verifyMicrodepositsForSetup,
|
|
62
63
|
canAddCardToWallet,
|
|
64
|
+
collectBankAccountToken,
|
|
65
|
+
collectFinancialConnectionsAccounts,
|
|
63
66
|
} from '../functions';
|
|
64
67
|
|
|
65
68
|
/**
|
|
@@ -290,6 +293,22 @@ export function useStripe() {
|
|
|
290
293
|
[]
|
|
291
294
|
);
|
|
292
295
|
|
|
296
|
+
const _collectBankAccountToken = useCallback(
|
|
297
|
+
async (clientSecret: string): Promise<FinancialConnections.TokenResult> => {
|
|
298
|
+
return collectBankAccountToken(clientSecret);
|
|
299
|
+
},
|
|
300
|
+
[]
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
const _collectFinancialConnectionsAccounts = useCallback(
|
|
304
|
+
async (
|
|
305
|
+
clientSecret: string
|
|
306
|
+
): Promise<FinancialConnections.SessionResult> => {
|
|
307
|
+
return collectFinancialConnectionsAccounts(clientSecret);
|
|
308
|
+
},
|
|
309
|
+
[]
|
|
310
|
+
);
|
|
311
|
+
|
|
293
312
|
return {
|
|
294
313
|
retrievePaymentIntent: _retrievePaymentIntent,
|
|
295
314
|
retrieveSetupIntent: _retrieveSetupIntent,
|
|
@@ -317,5 +336,7 @@ export function useStripe() {
|
|
|
317
336
|
verifyMicrodepositsForPayment: _verifyMicrodepositsForPayment,
|
|
318
337
|
verifyMicrodepositsForSetup: _verifyMicrodepositsForSetup,
|
|
319
338
|
canAddCardToWallet: _canAddCardToWallet,
|
|
339
|
+
collectBankAccountToken: _collectBankAccountToken,
|
|
340
|
+
collectFinancialConnectionsAccounts: _collectFinancialConnectionsAccounts,
|
|
320
341
|
};
|
|
321
342
|
}
|
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';
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
package/android/.idea/gradle.xml
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="GradleMigrationSettings" migrationVersion="1" />
|
|
4
|
-
<component name="GradleSettings">
|
|
5
|
-
<option name="linkedExternalProjectsSettings">
|
|
6
|
-
<GradleProjectSettings>
|
|
7
|
-
<option name="testRunner" value="GRADLE" />
|
|
8
|
-
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
9
|
-
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
10
|
-
</GradleProjectSettings>
|
|
11
|
-
</option>
|
|
12
|
-
</component>
|
|
13
|
-
</project>
|
package/android/.idea/misc.xml
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectRootManager" version="2" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
|
|
4
|
-
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
5
|
-
</component>
|
|
6
|
-
<component name="ProjectType">
|
|
7
|
-
<option name="id" value="Android" />
|
|
8
|
-
</component>
|
|
9
|
-
</project>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module external.linked.project.id=":" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
|
3
|
-
<component name="FacetManager">
|
|
4
|
-
<facet type="android-gradle" name="Android-Gradle">
|
|
5
|
-
<configuration>
|
|
6
|
-
<option name="GRADLE_PROJECT_PATH" value=":" />
|
|
7
|
-
<option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" />
|
|
8
|
-
<option name="LAST_KNOWN_AGP_VERSION" />
|
|
9
|
-
</configuration>
|
|
10
|
-
</facet>
|
|
11
|
-
</component>
|
|
12
|
-
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
13
|
-
<exclude-output />
|
|
14
|
-
<content url="file://$MODULE_DIR$/../.." />
|
|
15
|
-
<orderEntry type="inheritedJdk" />
|
|
16
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
17
|
-
</component>
|
|
18
|
-
</module>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/modules/android.iml" filepath="$PROJECT_DIR$/.idea/modules/android.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
package/android/.idea/vcs.xml
DELETED
package/android/local.properties
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
## This file must *NOT* be checked into Version Control Systems,
|
|
2
|
-
# as it contains information specific to your local configuration.
|
|
3
|
-
#
|
|
4
|
-
# Location of the SDK. This is only used by Gradle.
|
|
5
|
-
# For customization when using a Version Control System, please read the
|
|
6
|
-
# header note.
|
|
7
|
-
#Tue Jun 21 15:53:06 EDT 2022
|
|
8
|
-
sdk.dir=/Users/charliecruzan/Library/Android/sdk
|
|
Binary file
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<Bucket
|
|
3
|
-
uuid = "18A7FEF5-1FA3-4609-B152-0287F2E115A0"
|
|
4
|
-
type = "1"
|
|
5
|
-
version = "2.0">
|
|
6
|
-
<Breakpoints>
|
|
7
|
-
<BreakpointProxy
|
|
8
|
-
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
9
|
-
<BreakpointContent
|
|
10
|
-
uuid = "C0FB3E07-7654-41DA-96B5-07363EE2CDC7"
|
|
11
|
-
shouldBeEnabled = "Yes"
|
|
12
|
-
ignoreCount = "0"
|
|
13
|
-
continueAfterRunningActions = "No"
|
|
14
|
-
filePath = "ApplePayButtonManager.m"
|
|
15
|
-
startingColumnNumber = "9223372036854775807"
|
|
16
|
-
endingColumnNumber = "9223372036854775807"
|
|
17
|
-
startingLineNumber = "11"
|
|
18
|
-
endingLineNumber = "11">
|
|
19
|
-
</BreakpointContent>
|
|
20
|
-
</BreakpointProxy>
|
|
21
|
-
</Breakpoints>
|
|
22
|
-
</Bucket>
|