plaid / sandbox-custom-users

JSON files specifying custom users suitable for testing Plaid integrations on Sandbox
MIT License
19 stars 24 forks source link

Custom User Config Not Working After Linking #18

Closed willsmillie closed 8 months ago

willsmillie commented 8 months ago

Hello, i'm having trouble getting the Sandbox custom users to work.

Upon creating a link item, I see the correct accounts which coorespond to my custom user JSON config.

Screenshot 2024-01-05 at 10 58 11 AM

However upon completing the Plaid Link flow, the incorrect accounts are returned...

Screenshot 2024-01-05 at 10 57 05 AM

Any suggestions would be greatly appreciated!

This is the config i'm using:

{
  "override_accounts": [
    {
      "type": "loan",
      "subtype": "student",
      "liability": {
        "type": "student",
        "origination_date": "2022-01-01",
        "principal": 50000,
        "nominal_apr": 4.23,
        "loan_name": "Plaid Student Loan",
        "guarantor": "DEPT OF ED",
        "repayment_model": {
          "type": "standard",
          "non_repayment_months": 12,
          "repayment_months": 120
        }
      }
    },
    {
      "type": "credit",
      "subtype": "credit card",
      "starting_balance": 2500,
      "liability": {
        "type": "credit",
        "purchase_apr": 12.9,
        "cash_apr": 28.45,
        "balance_transfer_apr": 15.24,
        "special_apr": 0,
        "last_payment_amount": 500,
        "minimum_payment_amount": 10
      },
      "inflow_model": {
        "type": "monthly-interest-only-payment",
        "payment_day_of_month": 15,
        "statement_day_of_month": 13,
        "transaction_name": "Interest Payment"
      }
    }
  ]
}
phoenixy1 commented 8 months ago

Yeah, this is unfortunately a known issue with OAuth in the Sandbox:

At OAuth institutions, certain less frequently used customized fields may be overridden by the default values after the Link flow has completed. If this occurs, retry the configuration using a non-OAuth institution. https://plaid.com/docs/sandbox/user-custom/#configuring-the-custom-user-account

Can you try with a non-OAuth institution and see if it works?

willsmillie commented 8 months ago

Thank you! I had read that in the docs but was confused. I managed to get it working with the following code.

Thanks for the quick response!

      const institutionId = "ins_109512"; // Houndstooth Bank
      let initialProducts = ["transactions", "investments"]; // must include transactions  to receive transactions webhooks

      const publicTokenRequest = {
        institution_id: institutionId,
        initial_products: initialProducts,
        options: {
          override_username: "custom_test",
          override_password: "canBeAnything",
        },
      };
      try {
        const publicTokenResponse = await plaid.client.sandboxPublicTokenCreate(
          publicTokenRequest
        );