NativeScript plugin that opens the Plaid native sdk to log in to banking services.
npm install @nstudio/nativescript-plaid
This plugin opens the Plaid Link flow, which walks the user through finding their institution and linking their bank account. It opens the flow in a modal view, and returns metadata for events, on exit, and on success.
import { PlaidLink } from '@nstudio/nativescript-plaid';
export class YourClass {
successPublicToken: string;
constructor() {}
open() {
// first set an event listener for the events Plaid reports back.
PlaidLink.setLinkEventListener((event) => {
console.log('linkEventListener', event);
});
// create a handler and pass your link token. (https://plaid.com/docs/api/tokens/)
const handler = PlaidLink.createHandler({
token: 'YOURLINKTOKEN',
onSuccess: (linkSuccess) => {
console.log('linkSuccess', linkSuccess);
this.set('successPublicToken', linkSuccess.publicToken)
},
onExit: (linkExit) => {
console.log('linkExit', linkExit);
}
});
handler.open();
}
}
- setLinkEventListener() - Listens to events created by the flow.
- createHandler() - Creates a handler with a config including token, onSuccess and onExit functions.
- handler.open(config: PlaidLinkConfig) - Opens the flow in a modal. When user exits or successfully links an account, the modal closes.
- Dave Coffin @davecoffin
- Osei Fortune @triniwiz
Apache License Version 2.0