Registry /
payments / react-native-plaid-link-sdk
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
muslnode 18–226 runs
build_error
glibcnode 18–226 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;
Errors
Common errors & fixes
Plaid Link initialization failed: Invalid link_token
The provided `link_token` is expired, malformed, or has already been used.
fixEnsure 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`.
fixNavigate 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.
fixLog 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.
fixOpen your `android/app/build.gradle` file and set `compileSdkVersion 33`.
Audit
Dependencies
reactrequiredRequired peer dependency for React Native components and hooks.
react-nativerequiredCore platform for React Native SDK functionality.