plaid / plaid-node

Node bindings for Plaid

Home Page:https://plaid.com/docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: Income Verification Not Found

itsthomthomob opened this issue · comments

Project Intro

Hello! I am a student, Senior year, studying SWE and other majors with some internships. I'm currently building a personal project with the following tech stack:

  • Next.js v13.4.1 (front and back)
  • Firebase (encrypted user data storage)
  • Capacitor (for mobile development)
  • Plaid v13.1.0

Error Context

I have several components fetching several different Plaid products, working ones being transactions, identities, balances, and some others. I started integrating an IncomeReport component a few days ago, but ran into a large issue with trying to verify income. At the moment, I create an access token from a link token through the exchange method here:
` const plaidClient = new PlaidApi(configuration);

    const { user_id } = req.body; 

    // const incomeVerification = IncomeVerificationCreateRequest.constructFromObject({
    //     user_token: user_id,
    // });

    //const incomeVerificationRes = await plaidClient.incomeVerificationCreate(incomeVerification);

    const tokenResponse = await plaidClient.linkTokenCreate({
        user: {
            client_user_id: user_id,
        },
        client_name: "finai",
        products: ["income_verification", "transactions", "assets"],
        country_codes: ["US"],
        language: "en",
        webhook: 'https://webhook.sample.com'
    });`

This is called in onSuccess after I login with Plaid's sandbox environment credentials into a test bank. As you can see, I have "income_verification" listed first before transactions. I request an income type in my api/plaid/getIncome code here:

` console.log("Sending income request with: \n", userToken)

    // Initialize client
    const plaidClient = new PlaidApi(configuration);

    // Set up response
    const incomeResponse = await plaidClient.incomeVerificationCreate({
        user_token: userToken,
    });

    console.log("Received income response", incomeResponse)

    const incomeData = incomeResponse.data;
    console.log("Retrieved income statement", incomeData)`

On the line constIncomeResponse, I receive the following Status 400 error:
https://pastebin.com/hcMxw5AK

Where I'm presented with the "INCOME_VERIFICATION_ERROR" despite me putting "income_verification" as the first item in the products array. I'm pretty clueless on how to proceed, since the Node client has sparse documentation (im willing to help contribute if needed!) and the Plaid docs don't really have a clear set of instructions on this error. Also tried looking on stack overflow and other searches, no luck.

Any clue what might be happening here?

commented

Thanks for the detailed report! The pastebin link doesn't work for me (apparently the paste is pending moderation) but there is one potential issue and one troubleshooting suggestion I see off the bat:

Troubleshooting suggestion:

  • Make sure you're logging the entire error object -- typically the error object will have a human-readable error_message field explaining what the cause of the error is.

Potential issue:

  • Income verification, when specified in /link/token/create, requires several other fields to be specified as well that are not required for the other products you're using. I suggest taking a look at https://plaid.com/docs/income/#income-integration-process or https://plaid.com/docs/income/add-to-app/ for a summary of the Income-specific fields that you'll need to include when calling /link/token/create. (I'm actually quite surprised that the call to /link/token/create is not also returning an error since it is missing several required fields.)

Realized there was a mishap on my API options for creating a linkToken, I was editing the wrong files on accident 🙃 the request went through fine after setting up the income verification correctly with the options/parameters.

I created a small sequence diagram showing the general process for getting Income then getting Transactions, if you have the time to I would love to have your feedback! Other than that I believe this issue can be closed
Sequence Diagrams - Page 1

commented

you should not be sending the access token to the react layer as shown in the diagram; the access token should never be exposed to the frontend. the data that should be exposed to the frontend is the response data from calling the various plaid api endpoints.

Anyway, sounds like the issue was resolved and not related to the client library so I'll go ahead and close this issue now.