Registry / payments / react-native-plaid-link-sdk

react-native-plaid-link-sdk

JSON →
library12.8.0jsnpmunverified

The `react-native-plaid-link-sdk` is the official client-side SDK for integrating Plaid Link into React Native applications, enabling users to securely connect their financial accounts to Plaid's services. As of version 12.8.0, it provides a programmatic API for initializing and opening the Link flow, including an optional preloading feature (introduced in v11.6.0) designed to reduce latency for users. The SDK also offers a declarative `PlaidLink` component and robust callbacks for managing Link success and exit events. It handles platform-specific integrations for iOS (via CocoaPods) and Android (via Gradle). Plaid actively maintains this SDK, with major versions frequently introducing updates to the Link flow or API integration patterns, ensuring compatibility with the latest Plaid Link features and security standards. Developers should consult the official documentation for specific version-dependent integration details.

npm install react-native-plaid-link-sdk
INSTALL
IMPORT
SIG · REACT-NATIVE-PLAID
R
react-native-plaid-link-sdk
paymentsjavascriptv12.8.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

open
import { open } from 'react-native-plaid-link-sdk';
const { open } = require('react-native-plaid-link-sdk');
The primary function to open the Plaid Link flow. Modern React Native applications typically use ESM imports.
create
import { create } from 'react-native-plaid-link-sdk';
const { create } = require('react-native-plaid-link-sdk');
Introduced in v11.6.0, this function preloads Plaid Link for improved user experience. It should be called before `open`.
PlaidLink
import { PlaidLink } from 'react-native-plaid-link-sdk';
import PlaidLink from 'react-native-plaid-link-sdk';
A functional component for declarative integration, though the `create` and `open` functions are the recommended approach for versions >=11.6.0.
LinkSuccess, LinkExit
import type { LinkSuccess, LinkExit } from 'react-native-plaid-link-sdk';
TypeScript types for the callback parameters of the `open` function. Use `import type` for type-only imports.

This quickstart demonstrates the recommended flow for integrating Plaid Link into a React Native application using the `create` (for preloading) and `open` functions. It includes state management for the `link_token`, essential callbacks for success and exit events, and handles platform-specific configurations like iOS presentation styles.

import React, { useEffect, useState } from 'react'; import { Button, View, Text, Platform, Alert } from 'react-native'; import { open, create, dismissLink, LinkSuccess, LinkExit, LinkTokenConfiguration, LinkOpenProps, LinkIOSPresentationStyle, LinkLogLevel, } from 'react-native-plaid-link-sdk'; // IMPORTANT: In a real application, 'YOUR_GENERATED_PLAID_LINK_TOKEN' // must be fetched from your backend server. This token is short-lived. // Refer to Plaid's /link/token/create documentation. const GENERATED_LINK_TOKEN = 'YOUR_GENERATED_PLAID_LINK_TOKEN'; const PlaidLinkIntegration = () => { const [linkToken, setLinkToken] = useState<string | null>(null); const [loading, setLoading] = useState(true); useEffect(() => { // Simulate fetching a link token from your backend. // Replace this with an actual API call to your server that generates the token. const fetchLinkToken = async () => { try { // Example (replace with your actual backend endpoint): // const response = await fetch('https://your-backend.com/create_plaid_link_token'); // const data = await response.json(); // setLinkToken(data.link_token); if (GENERATED_LINK_TOKEN !== 'YOUR_GENERATED_PLAID_LINK_TOKEN') { setLinkToken(GENERATED_LINK_TOKEN); } else { Alert.alert( 'Missing Link Token', "Please replace 'YOUR_GENERATED_PLAID_LINK_TOKEN' with a valid token from your backend. Link will not open without it." ); } } catch (error) { console.error('Failed to fetch link token:', error); Alert.alert('Error', 'Could not fetch Plaid Link token.'); } setLoading(false); }; fetchLinkToken(); }, []); useEffect(() => { if (linkToken) { // For SDK versions >= 11.6.0, it's recommended to preload Link. const tokenConfiguration: LinkTokenConfiguration = { token: linkToken, noLoadingState: false, // Set to true to hide the native activity indicator }; create(tokenConfiguration); } }, [linkToken]); const handleOpenLink = () => { if (!linkToken) { Alert.alert('Error', 'Plaid Link token is not available yet.'); return; } const openProps: LinkOpenProps = { onSuccess: (success: LinkSuccess) => { console.log('Plaid Link Success:', success); // Send success.public_token to your backend for exchange with an access_token Alert.alert('Link Success', `Account linked! Public Token: ${success.public_token}`); }, onExit: (linkExit: LinkExit) => { console.log('Plaid Link Exit:', linkExit); if (linkExit.error) { console.error('Plaid Link Error:', linkExit.error); Alert.alert('Link Exit Error', `Code: ${linkExit.error.error_code}, Message: ${linkExit.error.display_message}`); } dismissLink(); // Ensure Link view is dismissed, especially on iOS. }, iOSPresentationStyle: LinkIOSPresentationStyle.MODAL, // Or FULL_SCREEEN logLevel: LinkLogLevel.ERROR, }; open(openProps); }; if (loading) { return ( <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}> <Text>Loading Plaid Link Token...</Text> </View> ); } return ( <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}> <Button title="Open Plaid Link" onPress={handleOpenLink} disabled={!linkToken} /> {!linkToken && ( <Text style={{ marginTop: 10, color: 'red' }}> Please provide a valid Plaid Link token. </Text> )} </View> ); }; export default PlaidLinkIntegration;
Debug
Known issues
breakingStarting with v11.6.0, the recommended integration pattern shifted to using `create()` for preloading the Link experience, followed by `open()` to launch it. Previous versions typically relied solely on `open()` or the `PlaidLink` component directly without a distinct preloading step. Applications upgrading from versions older than 11.6.0 must adapt to this new `create` then `open` flow.
fix
Implement the `create(LinkTokenConfiguration)` function with your `link_token` as soon as possible, and then call `open(LinkOpenProps)` when the user is ready to engage with Link. Maximize the delay between `create` and `open` for optimal latency reduction.
affects: >=11.6.0
gotchaFor Android, your project's `compileSdkVersion` must be `33` to ensure compatibility and proper functioning of the Plaid React Native SDK. Mismatched SDK versions can lead to build failures or runtime issues.
fix
Update your `android/app/build.gradle` file to set `compileSdkVersion 33`.
affects: >=10.0.0
gotchaWhen developing for Android, you must register your application's Android package name (e.g., `com.yourcompany.yourapp`) in the Plaid Dashboard. Failure to do so will prevent the successful connection to OAuth institutions, which include most major banks.
fix
Navigate to your Plaid Dashboard (dashboard.plaid.com/developers/api), go to 'Team Settings' -> 'API' and add your Android package name under 'Android Package Names'.
affects: >=10.0.0
gotchaThe `link_token` required by the SDK is a short-lived, single-use token that must be generated on your backend server using the `/link/token/create` endpoint of the Plaid API. It should never be generated client-side or hardcoded.
fix
Ensure your React Native application fetches a fresh `link_token` from your secure backend before attempting to initialize or open Plaid Link.
affects: >=10.0.0
Errors
Common errors & fixes
Plaid Link initialization failed: Invalid link_token
The provided `link_token` is expired, malformed, or has already been used.
fix
Ensure your backend generates a new `link_token` for each Plaid Link session using the `/link/token/create` endpoint and that your React Native app is fetching this fresh token before calling `create` or `open`.
Error: Failed to install CocoaPods dependencies
Automatic linking of iOS dependencies via CocoaPods failed after `npm install`.
fix
Navigate to your iOS project directory (`cd ios`) and manually run `bundle install && bundle exec pod install` to install dependencies.
Connection to OAuth institution fails on Android device/emulator.
The Android application's package name is not registered in the Plaid Dashboard, preventing successful OAuth redirect handling.
fix
Log in to your Plaid Dashboard, navigate to 'Team Settings' -> 'API' and add your app's Android package name (e.g., `com.yourcompany.yourapp`) to the 'Android Package Names' list.
Plaid Link doesn't open or crashes on Android, or shows `android.view.InflateException`
Your Android project's `compileSdkVersion` is not set to `33`, which is a requirement for recent versions of the SDK.
fix
Open your `android/app/build.gradle` file and set `compileSdkVersion 33`.
Upgrade
Version history
12.8.0latest on npm
Audit
Dependencies
reactrequiredRequired peer dependency for React Native components and hooks.
react-nativerequiredCore platform for React Native SDK functionality.
Agent activity
24 hits · last 30 days
node
22
Resources