Plaid - Account verification
by douglasloyo
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://cdn.plaid.com/link/v2/stable/link-initialize.js"></script>
<div ng-app="myApp">
<div ng-controller="homeController">
<span>{{plaidToken}}</span>
<button id="link-button">
Here
</button>
</div>
</div>
CSS
body{}
JavaScript
/* Application */
var myApp = angular.module('myApp', []);
myApp.controller('homeController', function ($scope) {
//alert('here');
});
(function($) {
var handler = Plaid.create({
clientName: 'Plaid Walkthrough Demo',
env: 'sandbox',
// Replace with your public_key from the Dashboard
key: '32676a575d88d1a26fa745334ea770',
product: ['transactions'],
// Optional, use webhooks to get transaction and error updates
webhook: 'https://requestb.in',
onLoad: function() {
// Optional, called when Link loads
},
onSuccess: function(public_token, metadata) {
// Send the public_token to your app server.
// The metadata object contains info about the institution the
// user selected and the account ID, if the Account Select view
// is enabled.
$.post('/get_access_token', {
public_token: public_token,
});
},
onExit: function(err, metadata) {
// The user exited the Link flow.
if (err != null) {
// The user encountered a Plaid API error prior to exiting.
}
// metadata contains information about the institution
// that the user selected and the most recent API request IDs.
// Storing this information can be helpful for support.
},
onEvent: function(eventName, metadata) {
// Optionally capture Link flow events, streamed through
// this callback as your users connect an Item to Plaid.
// For example:
// eventName = "TRANSITION_VIEW"
// metadata = {
// link_session_id: "123-abc",
// mfa_type: "questions",
// timestamp: "2017-09-14T14:42:19.350Z",
// view_name: "MFA",
// }
}
});
$('#link-button').on('click', function(e) {
alert("d");
//handler.open();
});
})(jQuery);