Collect an account to build data-powered products
Collect your user's account and use data such as balances, ownership details, and transactions to build products.
Financial Connections lets your users securely share their financial data by linking their external financial accounts to your business. You can use Financial Connections to access user-permissioned financial data such as tokenized account and routing numbers, account balances, account owner information, and historical transactions.
Some common examples of how you can use Financial Connections to improve product experiences for your users include:
- Mitigate fraud when onboarding a customer or business by verifying the ownership information of an account, such as the name and address of the bank account holder.
- Help your users track expenses, handle bills, manage their finances and take control of their financial well-being with transactions data.
- Speed up underwriting and improve access to credit and other financial services with transactions and balances data.
Enable your users to connect their accounts in fewer steps with Link, allowing them to save and quickly reuse their bank account details across Stripe merchants.
Set up StripeServer-sideClient-side
Server-side 
This integration requires endpoints on your server that talk to the Stripe API. Use our official libraries for access to the Stripe API from your server:
Client-side 
The React Native SDK is open source and fully documented. Internally, it uses the native iOS and Android SDKs. To install Stripe’s React Native SDK, run one of the following commands in your project’s directory (depending on which package manager you use):
Next, install some other necessary dependencies:
- For iOS, navigate to the ios directory and run
pod install
to ensure that you also install the required native dependencies. - For Android, there are no more dependencies to install.
Stripe initialization
To initialize Stripe in your React Native app, either wrap your payment screen with the StripeProvider
component, or use the initStripe
initialization method. Only the API publishable key in publishableKey
is required. The following example shows how to initialize Stripe using the StripeProvider
component.
import { StripeProvider } from '@stripe/stripe-react-native'; function App() { const [publishableKey, setPublishableKey] = useState(''); const fetchPublishableKey = async () => { const key = await fetchKey(); // fetch key from your server here setPublishableKey(key); }; useEffect(() => { fetchPublishableKey(); }, []); return ( <StripeProvider publishableKey={publishableKey} merchantIdentifier="merchant.identifier" // required for Apple Pay urlScheme="your-url-scheme" // required for 3D Secure and bank redirects > // Your app code here </StripeProvider> ); }
Create or retrieve an account holderServer-side
Create a Customer object when users create an account with your business. By providing an email address, Financial Connections can optimize the authentication flow by dynamically showing a streamlined user interface, for returning Link users.
Create a Financial Connections SessionServer-side
Notiz
You can find a running implementation of this endpoint available on Glitch for quick testing.
Before you can retrieve data from a user’s bank account with Financial Connections, your user must authenticate their account with the authentication flow.
Your user begins the authentication flow when they want to connect their account to your site or application. Insert a button or link on your site or in your application, which allows a user to link their account—for example, your button might say “Link your bank account”.
Create a Financial Connections Session by posting to /v1/financial_
:
- Set
account_
to the Customerholder[customer] id
. - Set the data
permissions
parameter to include the data required to fulfill your use case. - (Optional) set the
prefetch
parameter for retrieving the data on account creation.
The permissions parameter controls which account data you can access. You must request at least one permission. When completing the authentication flow, your user can see the data you’ve requested access to, and provide their consent to share it.
Consider the data required to fulfill your use case and request permission to access only the data you need. Requesting permissions that go well beyond your application’s scope might erode your users’ trust in how you use their data. For example, if you’re building a personal financial management application or a lending product, you might request transactions
data. If you’re mitigating fraud such as account takeovers, you might want to request ownership
details.
After your user authenticates their account, you can expand data permissions only by creating a new Financial Connections Session and specifying a new value for the permissions
parameter. Your user must complete the authentication flow again, where they’ll see the additional data you’ve requested permission to access, and provide consent to share their data.
The optional prefetch parameter controls which data you retrieve immediately after the user connects their account. Use this option if you know you always want a certain type of data. It removes the need to make an extra API call to initiate a data refresh.
To preserve the option to accept ACH Direct Debit payments, request the payment_
permission.
Collect a Financial Connections accountClient-side
Import the collectFinancialConnectionsAccounts
function from Stripe’s React Native SDK.
import {collectFinancialConnectionsAccounts} from '@stripe/stripe-react-native';
Use collectFinancialConnectionsAccounts
to collect the bank account by passing in the client_
from above, and then handle the result appropriately:
// Assume you have a <Button /> to collect payout accounts, whose onPress is handleCollectPress const handleCollectPress = async () => { // Fetch the clientSecret you created above and pass it to collectFinancialConnectionsAccounts const {session, error} = await collectFinancialConnectionsAccounts( clientSecret, ); if (error) { Alert.alert(`Error code: ${error.code}`, error.message); } else { Alert.alert('Success'); console.log( 'Successfully obtained session: ', JSON.stringify(session, null, 2), ); } };
collectFinancialConnectionsAccounts
returns a Promise
. When your user completes the modal flow, the Promise
resolves with one of the following:
- A
session
, representing the completed Financial Connections Session, if the user can successfully link their account. Thissession
includes anaccounts
array that contains the list of connected accounts. - An
error
if the Session fails or is canceled.
By default your connected accounts can only add account types like a checking or savings account in the authentication flow because Stripe can only facilitate payouts to an ACH-enabled account.
Set up a return URL (iOS only)Client-side
When a customer exits your app, for example to authenticate in Safari or their banking app, provide a way for them to automatically return to your app afterward. Many payment method types require a return URL, so if you fail to provide it, we can’t present those payment methods to your user, even if you’ve enabled them.
To provide a return URL:
- Register a custom URL. Universal links aren’t supported.
- Configure your custom URL.
- Set up your root component to forward the URL to the Stripe SDK as shown below.
Notiz
If you’re using Expo, set your scheme in the app.
file.
import React, { useEffect, useCallback } from 'react'; import { Linking } from 'react-native'; import { useStripe } from '@stripe/stripe-react-native'; export default function MyApp() { const { handleURLCallback } = useStripe(); const handleDeepLink = useCallback( async (url: string | null) => { if (url) { const stripeHandled = await handleURLCallback(url); if (stripeHandled) { // This was a Stripe URL - you can return or add extra handling here as you see fit } else { // This was NOT a Stripe URL – handle as you normally would } } }, [handleURLCallback] ); useEffect(() => { const getUrlAsync = async () => { const initialUrl = await Linking.getInitialURL(); handleDeepLink(initialUrl); }; getUrlAsync(); const deepLinkListener = Linking.addEventListener( 'url', (event: { url: string }) => { handleDeepLink(event.url); } ); return () => deepLinkListener.remove(); }, [handleDeepLink]); return ( <View> <AwesomeAppComponent /> </View> ); }
For more information on native URL schemes, refer to the Android and iOS docs.
Retrieve data on a Financial Connections accountServer-side
After your user has successfully completed the authentication flow, access or refresh the account data you’ve specified in the permissions
parameter of the Financial Connections Session.
To protect the privacy of your user’s data, account data accessible to you is limited to the data you’ve specified in the permissions
parameter.
Follow the guides for balances, ownership and transactions to start retrieving account data.