ackara / plaid.net Goto Github PK
View Code? Open in Web Editor NEWA .NET standard library for interacting with Plaid's banking APIs.
Home Page: https://plaid.com/
License: MIT License
A .NET standard library for interacting with Plaid's banking APIs.
Home Page: https://plaid.com/
License: MIT License
PlaidException
should inherit from System.Exception
so that something like throw getTransactionsResponse.Exception;
is a valid use. If not, I would argue that the name "Exception" here is changed to something different (like "Error")
I need to authenticate users' accounts using plaid API in .NET web application. I was struggling to integrate this project in my .NET 4.7 web application but I could not do so. Then I just included the Plaid.Link project in my solution and ran in the new instance in visual studio, it ran in the browser and created a local link. i.e. https://localhost:44359/. I then used it's link in my project and hit that link to create a flow to generate access link eventually. The project stores access link and access link in plaid_access_token.tmp in temp folder step by step. I understand Access token can be used after the completion of the flow to call other API end points. below screenshots are attached for all the steps.
I have 2 questions/ problems right now.
1- What I am doing is right or there is another better way of doings things? if yes, what steps should I follow.
2- When I run the project using above steps, it shows blue screens at the start and end of the flow. And in second step there is "Example uses Plaid to link your bank". How to avoid blue screen and change text at picture number two attached?
The FetchAllInstitutionsAsync method should return the total number of institution to allow us to fetch them all correctly.
Also the SearchAllRequest.AdditionalOptions has a typo for "IncludeMetadata" { InclueMetadata=true },
https://plaid.com/docs/api/institutions/
{
"institutions": [
{
"country_codes": [
"US"
],
"institution_id": "ins_1",
"name": "Bank of America",
"oauth": false,
"products": [
"assets",
"auth",
"balance",
"transactions",
"identity",
"liabilities"
],
"routing_numbers": [
"011000138",
"011200365",
"011400495",
"011500010",
"011900254",
"021000322",
"021200339",
"026009593",
"031202084",
"051000017",
"052001633",
"053000196",
"053904483",
"054001204",
"061000052",
"063100277",
"064000020",
"071214579",
"072000805",
"073000176",
"081000032",
"081904808",
"082000073",
"101100045",
"103000017",
"107000327",
"111000025",
"121000358",
"122101706",
"122400724",
"123103716",
"125000024",
"323070380"
]
}
],
"request_id": "tbFyCEqkU774ZGG",
"total": 11384
}
Hi, I tried running this locally, and it works perfectly fine, but on the AWS Environment live server, there's no exception thrown and it returns linktoken and exception null.
Here's the code snippet:
public async Task<CreateLinkTokenResult> GetPlaidLinkToken() { var linkToken = await _client.CreateLinkToken(new CreateLinkTokenRequest() { ClientId = _clientId, Secret = _secret, User = new CreateLinkTokenRequest.UserInfo { ClientUserId = _userContext.CurrentUser.UserId, }, CountryCodes = new[] { "US" }, ClientName = "TestClient", Products = new[] { "transactions" } }); return new CreateLinkTokenResult { Expiration = linkToken.Expiration, LinkToken = linkToken.LinkToken }; }
And we always get this null result:
{ "data": { "linkToken": null, "expiration": null }, "exception": null, "errorMessage": "", "statusCode": 200 }
The result should not be nullable. Hope you guys have an idea on this.
CreateLinkTokenResponse.Expiration should be DateTime rather than string. The format is 2021-06-21T20:05:03Z
Is there an example of creating a public token using the receivedRedirectUri from plaid?
Hi @Ackara !
Thank you for writing this library.
I use visual studio 2019, i can't run this project.
build project cannot run, and says the type of project is not compatible.
which version of visual studio or net framework i should use ?
I was trying to add your package in VS using NuGet and I get an error that this package is not found:
https://www.screencast.com/t/q5Sz37wi
Hi, some of the properties are structured incorrectly. For example, there is no "Identity" in the response. Instead, there is a list of Identities under each Account.
https://plaid.com/docs/#identity
Do you need help updating the structure of the objects to the newest PLAID Api version?
Hi @Ackara !
Thank you for writing this library! I work at Plaid and was wondering if you would be interested in having this library included on our community libraries page? I think a lot of Plaid users would benefit from it. If you're interested, let me know and we'll add a link!
Plaid periodically introduces new API versions when breaking changes are required. It would be good to document what API versions this library supports.
Hi there,
When I try to call the FetchAccountBalanceAsync
function with an account id, I got this error:
Acklann.Plaid.Exceptions.PlaidException: the following fields are not recognized by this endpoint: Options.
There is my call:
var response = await this._client.FetchAccountBalanceAsync(new GetBalanceRequest
{
Secret = this._environmentConfig.Secret,
ClientId = this._config.ClientId,
AccessToken = accessToken,
// TODO: Options should be used here
Options = new GetBalanceRequest.Settings
{
AccountIds = new string[] {accountId}
}
});
It looks like the options dont go through. But if I comment the settings object its working find.
According to the README, this library is configured for Plaid API version 2019-05-29. The latest Plaid API version is now 2020-09-14. Can you consider supporting this latest version?
Hi Ackara!
I am trying to connect to Plaid using this library. I am confused about how to use it. I Have the following code:
var request = new AccessTokenRequest
{
ClientId = "client_id",
Secret = "secret",
Language = "en",
User = new User {ClientUserId = "unique_user_id"},
Products = new[]{"auth"},
CountryCodes = new []{"US"}
};
var client = new PlaidClient(request.ClientId, request.Secret,null, environment: Environment.Development);
//create link token request
var createLinkTokenRequest = new CreateLinkTokenRequest
{
Language = request.Language,
ClientId = request.ClientId,
Secret = request.Secret,
ClientName = request.ClientId,
CountryCodes = request.CountryCodes,
Products = request.Products,
User = new CreateLinkTokenRequest.UserInfo {ClientUserId = request.User.ClientUserId}
};
var linkToken = await client.CreateLinkToken(createLinkTokenRequest);
return Json(linkToken);
The above code returns the link token. How can I get the public token that I need to use to exchange so I can get the access_token?
PlaidClient.cs seems to be missing all asset report related endpoints such as /asset_report/refresh and /asset_report/create
When using CreateLinkToken
with the AccountFilters
option of the CreateLinkTokenRequest
class, it doesn't appear to properly relay the request to Plaid. It would appear the request is missing the account_subtypes field under the account type object.
For example, to filter to only depository account types with account subtypes of checking, it currently sends a request like:
{
...,
"account_filters": {
"depository": ["checking"]
},
...
}
The correct structure for the Plaid API would be:
{
...,
"account_filters": {
"depository": {
"account_subtypes": ["checking"]
}
},
...
}
Can a new class (AccountFilterSubTypes
) be created with a single property (AccountSubtypes
of type List<string>
) be added? Then make the AccountFilters
property of the CreateLinkTokenRequest
class be of type Dictionary<string, AccountFilterSubTypes>
.
What is wrong with this:
var request = await client.FetchAccountInfoAsync(new Acklann.Plaid.Auth.GetAccountInfoRequest()
{
AccessToken = "<acess_token>"
ClientId = "<client_id>",
Secret = "<secret>",
Options = new Acklann.Plaid.Auth.GetAccountInfoOptions
{
AccountIds = BankAccountIdArray
}
});
The error is:
Testing this repo (via tests/Plais.MSTest) requires a secrets.json file but there's no mention in the README of that file, it's format or what to put in it.
Could one be added to the repo (with fake values that need substitution) and the README updated to indicate it's format/use?
I successfully generated link token via CreateLinkTokenRequest.
Now, I am trying to get a public token via CreatePublicTokenRequest, so that i can get an access token via ExchangeTokenRequest.
But, I am getting error "ErrorMessage = "This endpoint has been discontinued as of version '2020-09-14' of the API." in CreatePublicTokenRequest.
And in the parameters of CreatePublicTokenRequest, it is taking expecting AccessToken instead of LinkToken
var response = await client.CreatePublicTokenAsync(new Acklann.Plaid.Management.CreatePublicTokenRequest
{
ClientId = clientId,
Secret = clientSecret,
AccessToken = linkToken
});
Could anyone please help on this?
The Entity.Transaction
model is missing the iso_currency_code
and unofficial_currency_code
fields specified in the Plaid documentation. https://plaid.com/docs/#transactions
Sometimes var response = await plaidClient.FetchTransactionsAsync(transactionRequest); returns different transactions count for same account id on the sandbox. Sometimes if I run it on debug mode, it returns the correct count.
I'm calling it in a loop
Hi,
The Entity.Transaction model is missing the 'Location/country' and 'authorized_date' fields which are specified in the Plaid documentation.
https://plaid.com/docs/#transaction-schema
https://plaid.com/docs/#transaction-location-schema
How does one achieve creating link token in update mode ?
https://plaid.com/docs/link/update-mode/
curl -X POST https://sandbox.plaid.com/link/token/create
-H 'Content-Type: application/json'
-d '{
"client_id": "CLIENT_ID",
"secret": "SECRET",
"client_name": "My App",
"user": { "client_user_id": "UNIQUE_USER_ID" },
"country_codes": ["US"],
"language": "en",
"webhook": "https://webhook.sample.com",
"access_token": "ENTER_YOUR_ACCESS_TOKEN_HERE"
}'
Release 0.0.12 so that the ability to create a link token is available to use.
Apologizes if this is the wrong way to get this answered, but I didn't see this in the readme (or any better way) -- will this code work inside a Unity project? Has anyone tried it in such a thing? I know it's an odd request, but a client actually wants to gamify banking and use this software for occasional real transactions and I'm at the phase where I'm deciding on a platform. I know certain .net libraries would need to be added for Unity to recognize the code -- I'd just like to know which ones, since the editor's AI doesn't seem to do a good job of figuring it out, heh.
EDIT: So far, it looks like Unity compatibility is a no-go (even when I manage to circumvent the nuget issues that Unity has and delete all the redundant dll copies, it still freaks out with dozens of soft runtime errors with the included dependencies), but would be cool to get confirmation.
Apologies for filing an issue again but I don't have your contact info :-). I just wanted to say thanks for your work maintaining this library, and as thank-you we'd like to send you a small Plaid care package. If you're interested, can you let me know your shipping address, t-shirt size, and if there are any items you'd particularly like? If you don't want to publish your address on GitHub you can DM me at @plaiddev or email me at [email protected].
Thanks,
Alex
P.S. If you haven't already seen it, you might be interested in our newly-published OpenAPI file, which is designed to make Plaid SDK generation easier -- we'd love to hear any feedback you might have!
Heres a snippet of my code using the client.FetchInstitutionByIdAsync() method I am in c# , using api end point version "2019-05-29" I am using nuget package version "v0.0.13-rc"
snippet
"
var searchByIdRequest = new SearchByIdRequest
{
InstitutionId = institutionId,
PublicKey = _plaidPublicKey,
};
var client = new PlaidClient(_plaidClientId, _plaidSecret, null, _plaidEnvironment, "2019-05-29");
var task = Task.Run(async () => await client.FetchInstitutionByIdAsync(searchByIdRequest));"
when I make this call I get an error message back saying that the clientId is missing, however it is supplied when I instantiate the plaidClient. when I have encountered this before in other methods I then added ClientId to the Request object, however this SearchByIdRequest object doesnt contain an item for me to Put the ClientId in the request...
I would appreciate a fix, a work around or a fix if you can please
Regards Julian
Hello @Ackara .
How can i find access token for use library ?
https://plaid.com/docs/api/products/#transactionsget
merchant_name is missing from the GetTransactionsResponse Transaction object.
Hello,
I'm sorry if it's done by design but I personally was really surprised when:
var request = new ExchangeTokenRequest
{
PublicToken = publicToken
};
ExchangeTokenResponse response = await _plaidClient.ExchangeTokenAsync(request);
returned bad request saying client_id and secret are missed.
I started digging and found out that EnsureCredentials
method doesn't do anything because ExchangeTokenRequest
doesn't inherit RequestBase
(as other classes) so request parameters such as Secret
/ClientId
are not fallbacked with values from PlaidClient
.
Thank you!
Using float will lead to losing decimal precision when passing the float size limit,
Consider the number 345678.64
var a = Single.Parse("345678.64");
Console.WriteLine(a); // outputs 345678.62
Check this thread for https://stackoverflow.com/questions/588004/is-floating-point-math-broken more info.
I can submit a PR if you agree on this.
Thanks.
PM> Install-Package Acklann.Plaid -Version 0.0.6-beta
Attempting to gather dependency information for package 'Acklann.Plaid.0.0.6-beta' with respect to project 'Clients\Stripe.Service', targeting '.NETFramework,Version=v4.6.1'
Gathering dependency information took 330.28 ms
Attempting to resolve dependencies for package 'Acklann.Plaid.0.0.6-beta' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Acklann.Plaid.0.0.6-beta'
Resolved actions to install package 'Acklann.Plaid.0.0.6-beta'
Retrieving package 'Acklann.Plaid 0.0.6-beta' from 'nuget.org'.
GET https://api.nuget.org/v3-flatcontainer/acklann.plaid/0.0.6-beta/acklann.plaid.0.0.6-beta.nupkg
OK https://api.nuget.org/v3-flatcontainer/acklann.plaid/0.0.6-beta/acklann.plaid.0.0.6-beta.nupkg 285ms
Installing Acklann.Plaid 0.0.6-beta.
Install failed. Rolling back...
Package 'Acklann.Plaid.0.0.6-beta' does not exist in project 'xxxx.Service'
Package 'Acklann.Plaid.0.0.6-beta' does not exist in folder 'C:\Users\tmwil\Documents\VS\GF_dev\packages'
Executing nuget actions took 821.27 ms
Install-Package : Could not install package 'Acklann.Plaid 0.0.6-beta'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain any
assembly references or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
The library instantiates a new HttpClient
instance for every API call:
Plaid.NET/src/Plaid/PlaidClient.cs
Line 310 in 1acbd93
This runs contrary to Microsoft's guidance, and I can personally attest to the fact that ignoring this guidance does lead to problems in production (not with this library specifically, but with others I used heavily). At the very least, the HttpClient
instance should be cached for the lifetime of the PlaidClient
instance, if not made static
.
Plaid now has an additional processor token endpoint for other integrations besides Stripe. The documentation is here.
Should be a straightforward implementation. I may even take a stab at it.
I have the following code:
GetTransactionsResponse transactions = await plaidClient.FetchTransactionsAsync(new GetTransactionsRequest
{
ClientId = plaidClientId,
Secret = plaidSecret,
AccessToken = sources[source],
StartDate = beginningOfMonth,
EndDate = beginningOfNextMonth,
});
I call this code in a loop and during one iteration I got the following unhandled exception:
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
at Acklann.Plaid.PlaidClient.CreateResponse[TResponse](HttpResponseMessage response)
at Acklann.Plaid.PlaidClient.PostAsync[TResponse](String path, SerializableContent request)
at TransactionChecker.Program.CheckForNewTransactionsAsync(Boolean firstRun) in C:\Users\derek\source\repos\TransactionChecker\TransactionChecker\Program.cs:line 85
Could this be wrapped up into a PlaidException
and return GetTransactionsResponse.IsSuccessStatusCode = false
?
The request and response for this endpoint are implemented as GetAccountRequest
/GetAccountResponse
, but the API endpoint is not available on the client.
There is a nullable field 'verification_status' in Plaid documentation that is used for Auth items (but it is present in the description to some other requests).
https://plaid.com/docs/api/products/#authget
How about adding this property to Account entity and creating appropriate enum (or just property)?
Thanks.
When I attempt to exchange tokens I just receive "Waiting for activation" - Do you know why this is occurring?
I've tried to await the request but I am never able to get back into debugging a response with the access-token.
Any information would be appreciated!
Allow users who have already been verified with a financial institution to go through the Plaid pre-matched RUX.
See the docs here: https://plaid.com/docs/link/returning-user
This project has an fairly lengthy build script with a lot of options, but 'dotnet build' and 'dotnet test' work, however 'dotnet pack' does not.
Issues:
I know you said you'd do this - I just want to track it somewhere. Is there anything I can do to help get this release out? Thanks!
How can i use this library in asp mvc 5 ?
Currently missing the new Link Token
in the SDK.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.