chingu-voyages / v42-bears-team-34

Add-project-description-here | Voyage-42 | https://chingu.io/ | Twitter: https://twitter.com/ChinguCollabs
1 stars 0 forks source link

Plaid integration #31

Open davideastmond opened 1 year ago

davideastmond commented 1 year ago

Plaid Integration process

A detailed explanation is will be found in the documentation here: https://plaid.com/docs/quickstart/?utm_source=google&utm_medium=search&utm_campaign=Search_G_Brand_Phrase&utm_content=Plaid_integration&utm_term=plaid%20integration&utm_creative=642318327722&gclid=EAIaIQobChMI8dqzwszD_AIVmOTjBx0fxgD0EAAYASABEgLVjfD_BwE#quickstart-setup

Introduction

Let’s test out running Plaid locally by cloning the Quickstart app. You’ll need API keys, which you can receive by signing up in the Dashboard. You'll have two different API keys, and there are three different Plaid environments. Today we'll start in the Sandbox environment. View the API Keys section of the Dashboard to find your Sandbox secret.

API Key

Environment

Quickstart setup Once you have your API keys, it's time to run the Plaid Quickstart locally! The instructions below will guide you through the process of cloning the Quickstart repository, customizing the .env file with your own Plaid client ID and Sandbox secret, and finally, building and running the app.

Plaid offers both Docker and non-Docker options for the Quickstart. If you don't have Docker installed, you may wish to use the non-Docker version; this path is especially recommended for Windows users who do not have Docker installations.

However, if you already have Docker installed, we recommend the Docker option because it is simpler and easier to run the Quickstart. Below are instructions on setting up the Quickstart with Docker and non-Docker configurations.

Setting up without Docker.

Make sure you have npm installed before following along. If you're using Windows, ensure you have a terminal capable of running basic Unix shell commands.

How it works As you might have noticed, you use both a server and a client-side component to access the Plaid APIs. The flow looks like this: The Plaid flow begins when your user wants to connect their bank account to your app.

  1. Call /link/token/create to create a link_token and pass the temporary token to your app's client.

  2. Use the link_token to open Link for your user. In the onSuccess callback, Link will provide a temporary public_token.

  3. Call /item/public_token/exchange to exchange the public_token for a permanent access_token and item_id for the new Item.

  4. Store the access_token and use it to make product requests for your user's Item.

The first step is to create a new link_token by making a /link/token/create request and passing in the required configurations. This link_token is a short lived, one-time use token that authenticates your app with Plaid Link, our frontend module. Several of the environment variables you configured when launching the Quickstart, such as PLAID_PRODUCTS, are used as parameters for the link_token.