1.0.1 • Published 6 years ago

react-native-plaid v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

react-native-plaid

react-native version npm version

Plaid Link implementation for React Native using a Webview and Plaid Link.

react-native-plaid

Documentation

Installation

npm install --save react-native-plaid

Setup

Environment Variables

Environment Variables will need to be set for react-native-plaid to work. See react-native-config to learn more on how to use environment variables.

In your .env file, use the following variables:

VariableTypedefault valueDescription
PLAID_LINK_PUBLIC_KEY (required)stringPublic identifier that is used to initialize Plaid Link
PLAID_LINK_ENVstringsandboxAPI environment
PLAID_LINK_PRODUCTstringauthPlaid Product
PLAID_LINK_CLIENT_NAMEstringPlaid Test
PLAID_LINK_WEBHOOKstring
PLAID_LINK_TOKENstring
PLAID_LINK_API_VERSIONstringv2

For more information please read their docs

Get Plaid API key

Usage

Once you've install the library and setup the environment variables, you'll want to make it available to your app by importing it:

import PlaidLinkView from 'react-native-plaid';

Displaying the Plaid Link is as simple as:

render() {
    return (
        <PlaidLinkView
          onMessage={data => console.log(data)}
          onExit={() => console.log("Exit")}
          onError={e => {console.log(e)}}
        />
    );
}

API

PropTypedefaultValueDescription
onMessage (required)functionReturns authentication data.
onExitfunctionExecute any action at exit to Plaid.
onErrorfunctionReturns any error on WebView or Plaid.
publicKeystring
envstring
productstring
clientNamestring
webhookstring
tokenstring
selectAccountboolean
apiVersionstring
WebView props---

Returned data object

{
  "institution": {
    "name": "Chase",
    "institution_id": "ins_3"
  },
  "account": {
    "id": null,
    "name": null,
    "type": null,
    "subtype": null
  },
  "account_id": null,
  "accounts": [],
  "link_session_id": "c737a192-270f-4c45-adb7-6358abca8c0f",
  "public_token": "public-sandbox-5658fef9-260c-4848-b443-868413ae1521"
}

Contributions of any kind welcome!