How to create a link token using Plaid.NET Nuget package with c#

1k views Asked by At

Is Plaid.Net fully functional and can it be used in production code?

I am trying to create a link token like below

            var plaid = new PlaidClient(Acklann.Plaid.Environment.Development);
            string[] products = new string[] { "transactions" };
            string[] countryCodes = new string[] { "US" };
            var user = new UserInfo();
            user.ClientUserId = "123bs6a4";
            
            var createLinkTokenRequest = new CreateLinkTokenRequest
            {
                ClientId = "*****************",
                Secret = "****************",
                Products = products,
                CountryCodes = countryCodes,
                Language = "en",
                ClientName = "My client",
                User=user
            };
            try
            {
                var result = getToken(createLinkTokenRequest);
            }
            catch(Exception e)
            {
                Console.WriteLine(e);
                Console.ReadKey();
            }





public static async Task<CreateLinkTokenResponse> getToken(CreateLinkTokenRequest createLinkTokenRequest)
    {
        var plaid = new PlaidClient(Acklann.Plaid.Environment.Development);
        try
        {
            var res= await plaid.CreateLinkToken(createLinkTokenRequest);
            Console.WriteLine(res.LinkToken);
            return res;
        }
        catch(Exception e)
        {
            Console.WriteLine(e);
        }
        finally
        {
            Console.WriteLine("Abc");
            Console.ReadKey();
        }

While debugging when I reach

await plaid.CreateLinkToken(createLinkTokenRequest);

the execution is stopped without an execption

is this the right way of creating link token or any other way? (using .Net core 2.1, Acklann.Plaid Nuget)

1

There are 1 answers

0
farhan On

Try to change the environment from development to sandbox. Maybe you are using the sandbox key and passing environment as development.