Advertisement
mvan231

Plaid API Script

Nov 7th, 2021
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. let wv = new WebView( )
  2.  
  3. let html = `
  4. <!DOCTYPE HTML>
  5. <HTML>
  6. <body>
  7. <button id="link-button">Link Account</button>
  8. <script src="https://cdn.plaid.com/link/v2/stable/
  9. link-initialize.js"></script>
  10. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script>
  11. <Script type="text/javascript">
  12. </script>
  13. </body>
  14. </html>
  15. `;
  16. let js = `
  17. (function ($) {
  18.  
  19. var handler = Plaid.create({
  20.  
  21. clientName: '<APP NAME>',
  22. env: 'sandbox',
  23. key: '<PLAID PUBLIC KEY>',
  24. webhook: 'https://[sandbox][api].hydrogenplatform.com/callback/aggregation/plaid',
  25. product: ['auth', 'transactions'],
  26. onLoad: function() {
  27. // Optional, called when Link loads
  28. },
  29. onSuccess: function (public_token, metadata) {
  30. // call integration/v1/token_exchange with client data, see example below
  31. }
  32. });
  33. $('#link-button').on('click', function (e) {
  34. handler. open();
  35. });
  36. })(jQuery);
  37. `;
  38. await wv.loadHTML (html);
  39. await wv.present()
  40.  
  41. let result = await wv.evaluateJavaScript(js, true)
  42. return completion(result);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement