### Standard Link Session Example Source: https://github.com/plaid/react-native-plaid-link-sdk/blob/master/_autodocs/MANIFEST.txt Demonstrates the standard account linking flow using Plaid Link. Refer to README.md for Quick Start, API-REFERENCE.md for createPlaidLinkSession(), CONFIGURATION.md for LinkTokenConfiguration, and USAGE-EXAMPLES.md for error handling. ```javascript import React from 'react'; import { PlaidLink } from 'react-native-plaid-link-sdk'; const App = () => { const [linkSuccess, setLinkSuccess] = React.useState(false); return ( { // Send public_token to your backend to exchange for access_token console.log('Success:', public_token, metadata); setLinkSuccess(true); }} onExit={(exit_code, metadata) => { console.log('Exit:', exit_code, metadata); }} /> ); }; export default App; ``` -------------------------------- ### Install React Native Plaid Link SDK (Bare React Native) Source: https://github.com/plaid/react-native-plaid-link-sdk/blob/master/_autodocs/README.md Install the SDK and necessary dependencies for bare React Native projects. Includes iOS pod installation. ```bash npm install react-native-plaid-link-sdk npx pod-install # iOS only ``` -------------------------------- ### Sync FinanceKit with Full Configuration Source: https://github.com/plaid/react-native-plaid-link-sdk/blob/master/_autodocs/CONFIGURATION.md Example of calling `syncFinanceKit` with all available configuration options: token, requestAuthorizationIfNeeded, and syncBehavior. ```typescript await syncFinanceKit({ token: linkToken, requestAuthorizationIfNeeded: true, syncBehavior: FinanceKitSyncBehavior.LIVE, }); ``` -------------------------------- ### Install React Native Plaid Link SDK and Expo Source: https://github.com/plaid/react-native-plaid-link-sdk/blob/master/V13_MIGRATION_GUIDE.md Install the SDK and Expo for bare React Native apps. Ensure Expo Modules are installed and configured first. ```sh npm install react-native-plaid-link-sdk expo npx pod-install ``` -------------------------------- ### Plaid Headless Session Start Method Source: https://github.com/plaid/react-native-plaid-link-sdk/blob/master/_autodocs/MODULES.md Represents a Plaid Headless session and its method to start the session. ```typescript PlaidHeadlessSession └── start: () => Promise ``` -------------------------------- ### Install Plaid React Native SDK for Bare React Native Projects Source: https://github.com/plaid/react-native-plaid-link-sdk/blob/master/README.md Install the SDK and its dependencies for Bare React Native projects. This includes installing the 'expo' package and running pod install. ```sh npm install react-native-plaid-link-sdk npx pod-install ``` -------------------------------- ### Sync FinanceKit in Simulated Mode Source: https://github.com/plaid/react-native-plaid-link-sdk/blob/master/_autodocs/CONFIGURATION.md Example of calling `syncFinanceKit` for sandbox testing using `FinanceKitSyncBehavior.SIMULATED`. ```typescript import { syncFinanceKit, FinanceKitSyncBehavior } from 'react-native-plaid-link-sdk'; await syncFinanceKit({ token: linkToken, syncBehavior: FinanceKitSyncBehavior.SIMULATED, }); ``` -------------------------------- ### Sync FinanceKit with Default Configuration Source: https://github.com/plaid/react-native-plaid-link-sdk/blob/master/_autodocs/CONFIGURATION.md Example of calling `syncFinanceKit` with only the required `token`. Uses default settings for authorization and sync behavior. ```typescript import { syncFinanceKit } from 'react-native-plaid-link-sdk'; await syncFinanceKit({ token: linkToken, }); ``` -------------------------------- ### Install Plaid React Native SDK for Expo Projects Source: https://github.com/plaid/react-native-plaid-link-sdk/blob/master/README.md Use this command to install the SDK in your Expo project. Ensure you are running the app in a development build or custom native runtime, as Expo Go does not support custom native modules. ```sh npm install react-native-plaid-link-sdk ``` -------------------------------- ### Example Plaid Layer Session Creation and Usage Source: https://github.com/plaid/react-native-plaid-link-sdk/blob/master/_autodocs/CONFIGURATION.md Demonstrates creating a Plaid Layer session, handling success and exit callbacks, and responding to Layer events to open the session. It also shows how to submit user information after the session is ready. ```typescript let session: PlaidLayerSession; session = await createPlaidLayerSession({ token: linkToken, onSuccess: (success) => { console.log('Layer verification complete'); exchangePublicToken(success.publicToken); }, onExit: (exit) => { console.log('User exited Layer'); }, onEvent: (event) => { if (event.eventName === LinkEventName.LAYER_READY) { // Layer is ready, can now call session.open() session.open(); } else if (event.eventName === LinkEventName.LAYER_NOT_AVAILABLE) { // Layer not available for this institution console.error('Layer not available'); } }, }); // Submit user information await session.submit({ phoneNumber: '+14155550015', dateOfBirth: '1985-03-15', }); ``` -------------------------------- ### Server-Side Integration Source: https://github.com/plaid/react-native-plaid-link-sdk/blob/master/_autodocs/MANIFEST.txt Guides on public token exchange flow for server-side integration. ```APIDOC ## Server-Side Integration (Public Token Exchange) ### Description Details the public token exchange flow for server-side integration. ### Method (Not specified, refers to server-side API calls) ### Endpoint (Not applicable for client-side SDK documentation) ### Parameters (Not specified for client-side SDK) ### Request Example (See USAGE-EXAMPLES.md for Server-Side Integration) ### Response (Not specified for client-side SDK) ### Response Example (Not specified) ``` -------------------------------- ### Sync FinanceKit with Error Handling Source: https://github.com/plaid/react-native-plaid-link-sdk/blob/master/_autodocs/CONFIGURATION.md Example demonstrating how to handle potential errors when calling `syncFinanceKit`, including a platform check for iOS. ```typescript import { Platform } from 'react-native'; if (Platform.OS !== 'ios') { console.error('FinanceKit is iOS only'); return; } try { await syncFinanceKit({ token: linkToken, requestAuthorizationIfNeeded: true, }); console.log('FinanceKit sync successful'); } catch (error) { console.error('FinanceKit sync failed:', error.message); // Handle error appropriately } ``` -------------------------------- ### Headless Session Example Source: https://github.com/plaid/react-native-plaid-link-sdk/blob/master/_autodocs/MANIFEST.txt Facilitates a programmatic payment flow using a Headless Session. This approach offers more control over the user interface. ```javascript import React from 'react'; import { PlaidLink } from 'react-native-plaid-link-sdk'; const App = () => { const [linkSuccess, setLinkSuccess] = React.useState(false); return ( { console.log('Headless Success:', public_token, metadata); setLinkSuccess(true); }} onExit={(exit_code, metadata) => { console.log('Headless Exit:', exit_code, metadata); }} /> ); }; export default App; ``` -------------------------------- ### Create Plaid Layer Session with User Data (TypeScript) Source: https://github.com/plaid/react-native-plaid-link-sdk/blob/master/_autodocs/USAGE-EXAMPLES.md This example demonstrates how to create a Plaid Layer session and submit user data for wealth verification. It includes handling link tokens, phone numbers, and dates of birth. Use this when initiating a wealth verification flow. ```typescript import { useState, useRef, } from 'react'; import { View, Button, Text, TextInput, SafeAreaView, } from 'react-native'; import { createPlaidLayerSession, PlaidLayerSession, LinkEventName, } from 'react-native-plaid-link-sdk'; export function LayerSessionExample() { const [token, setToken] = useState(''); const [phoneNumber, setPhoneNumber] = useState('+1415555001'); const [dateOfBirth, setDateOfBirth] = useState('1985-03-15'); const [status, setStatus] = useState('idle'); const sessionRef = useRef(null); const createSession = async () => { setStatus('creating'); try { sessionRef.current = await createPlaidLayerSession({ token: token.trim(), onSuccess: (success) => { console.log('✓ Layer verification complete'); console.log('Public Token:', success.publicToken); exchangePublicToken(success.publicToken); }, onExit: (exit) => { console.log('User exited Layer'); }, onEvent: (event) => { if (event.eventName === LinkEventName.LAYER_READY) { setStatus('ready'); console.log('Layer is ready to open'); } else if (event.eventName === LinkEventName.LAYER_NOT_AVAILABLE) { setStatus('error'); console.error('Layer not available for this institution'); } }, }); } catch (err) { console.error('Failed to create Layer session:', err); setStatus('error'); } }; const submitUserData = async () => { if (!sessionRef.current) return; try { await sessionRef.current.submit({ phoneNumber: phoneNumber.trim() || undefined, dateOfBirth: dateOfBirth.trim() || undefined, }); console.log('✓ User data submitted'); } catch (err) { console.error('Failed to submit data:', err); } }; const openLayer = async () => { try { await sessionRef.current?.open(); console.log('Layer opened'); } catch (err) { console.error('Failed to open Layer:', err); } }; return ( Plaid Layer Verification Link Token: Phone Number (E.164): Date of Birth (YYYY-MM-DD):