Created
July 24, 2017 00:47
-
-
Save jraczak/fb4f534f4bad7900ebecdc053b45a857 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script> | |
<script src="https://cdn.plaid.com/link/v2/stable/link-initialize.js"></script> | |
<script> | |
// TODO: Move this to a .js file and out of the view code | |
(function($) { | |
var handler = Plaid.create({ | |
apiVersion: 'v2', | |
clientName: 'Sprout Development', | |
env: 'sandbox', | |
product: ['transactions'], | |
key: 'f2ed0e179c86b5a0c0c16dc0bd4dc5', | |
// selectAccount: true, | |
onSuccess: function(public_token, metadata_object) { | |
//$.post('/get_access_token', {public_token: public_token}, function() { | |
console.log(metadata_object.institution.name); | |
$.ajax({ | |
type: 'GET', | |
url: '/access_token_exchange', | |
data: { public_token: public_token, | |
institution_name: metadata_object.institution.name, | |
institution_id: metadata_object.institution.institution_id}}), | |
// TODO: Figure out how to redirect to a detail page on success | |
function() { | |
$('#container').fadeOut('fast', function() { | |
$('#intro').hide(); | |
$('#app, #steps').fadeIn('slow'); | |
}); | |
}; | |
}, | |
}); | |
$('#link-btn').on('click', function(e) { | |
handler.open(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment