$ npm install @exodus/react-native-plaid-link-sdkIn your react-native project directory:
npm install --save react-native-plaid-link-sdk
When upgrading from a previous major version of this library, see the notes here for additional instructions.
Add Plaid to your project’s Podfile as follows (likely located at ios/Podfile). The latest version is .
pod 'Plaid', '~> <insert latest version>'
Then install your cocoapods dependencies:
(cd ios && pod install)
Add a Run Script build phase (after the [CP] Embed Pods Frameworks step) to your target as described in Plaid Link for iOS documentation. This strips simulator symbols from App Store release builds.
That's it if using a recent react-native version with autolinking support.
If using a version of react-native without autolinking support, then you will need to:
react-native link react-native-plaid-link-sdk
followed by
Libraries ▶ Add Files to [your project's name]node_modules ▶ react-native-plaid-link-sdk ▶ ios and add RNLinksdk.xcodeprojlibRNLinksdk.a to your project's Build Phases ▶ Link Binary With LibrariesCmd+R)<com.plaid.exampleandroid/app/src/main/java/<AppName>/MainApplication.javaimport com.plaid.PlaidPackage; to the imports sectionpackages.add(new PlaidPackage()); to List<ReactPackage> getPackages();android/app/build.gradledependencies {
...
implementation project(':react-native-plaid-link-sdk')
implementation 'com.plaid.link:sdk-core:<insert latest version>'
android/settings.gradleinclude ':react-native-plaid-link-sdk'
project(':react-native-plaid-link-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-plaid-link-sdk/android')
In your app:
import { Text } from 'react-native';
import PlaidLink from 'react-native-plaid-link-sdk';
const MyPlaidComponent = () => {
return (
<PlaidLink
// Replace any of the following <#VARIABLE#>s according to your setup,
// for details see https://plaid.com/docs/quickstart/#client-side-link-configuration
publicKey='<# Your Public Key #>'
clientName='<# Your Client Name #>'
env='<# Environment #>' // 'sandbox' or 'development' or 'production'
product={['<# Product #>']}
onSuccess={data => console.log('success: ', data)}
onExit={data => console.log('exit: ', data)}
onCancelled = {(result) => {console.log('Cancelled: ', result)}}
// Optional props
countryCodes={['<# Country Code #>']}
language='<# Language #>'
userEmailAddress='<# User Email #>'
userLegalName='<# User Legal Name #>'
userPhoneNumber='<# User Phone Number #>'
webhook='<# Webhook URL #>'
>
<Text>Add Account</Text>
</PlaidLink>
);
};
The React Native Plaid module emits onEvent events throughout the account linking process — see details here. To receive these events in your React Native app, wrap the PlaidLink react component with the following in order to listen for those events:
import React from 'react';
import { Text, NativeEventEmitter, NativeModules } from 'react-native';
class PlaidEventContainer extends React.Component {
componentDidMount() {
const emitter = new NativeEventEmitter(Platform.OS === 'ios' ? NativeModules.RNLinksdk : NativeModules.PlaidAndroid);
this._listener = emitter.addListener('onEvent', (e) => console.log(e));
}
componentWillUnmount() {
if (this._listener) {
this._listener.remove();
}
}
render() {
return (
<PlaidLink
clientName='##YOUR CLIENT NAME##'
publicKey='#YOUR PUBLIC KEY##'
env='sandbox'
onSuccess={data => console.log('success: ', data)}
onExit={data => console.log('exit: ', data)}
onCancelled = {(result) => {console.log('Cancelled: ', result)}}
product={['transactions']}
language='en'
countryCodes={['US']}
>
<Text>Add Account</Text>
</PlaidLink>
);
}
}
By default, PlaidLink renders a TouchableOpacity component. You may override the component used by passing component and componentProps. For example:
<PlaidLink
clientName = "Component Test"
publicKey = "##YOUR PUBLIC KEY##"
products = {["transactions"]}
env = "sandbox"
component= {Button}
componentProps = {{title: 'Add Account'}}
onSuccess = {(result) => {console.log('Success: ', result)}}
onError = {(result) => {console.log('Error: ', result)}}
onCancelled = {(result) => {console.log('Cancelled: ', result)}}
product = {["transactions"]}
language = "en"
countryCodes = {["US"]}
>