{"id":18281837,"url":"https://github.com/wfgilman/plaid-elixir","last_synced_at":"2025-04-04T10:04:54.497Z","repository":{"id":11537474,"uuid":"69612288","full_name":"wfgilman/plaid-elixir","owner":"wfgilman","description":"An Elixir Library for Plaid","archived":false,"fork":false,"pushed_at":"2024-08-20T04:25:22.000Z","size":380,"stargazers_count":66,"open_issues_count":2,"forks_count":52,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T09:04:34.414Z","etag":null,"topics":["elixir","plaid"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wfgilman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-29T22:15:29.000Z","updated_at":"2025-03-19T08:47:06.000Z","dependencies_parsed_at":"2024-11-21T12:01:54.591Z","dependency_job_id":"8ce0827b-2a95-4e43-8405-ceb2ffe09711","html_url":"https://github.com/wfgilman/plaid-elixir","commit_stats":{"total_commits":105,"total_committers":26,"mean_commits":4.038461538461538,"dds":0.5523809523809524,"last_synced_commit":"a869de8b16e784f378f41c599accd9994bb23900"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wfgilman%2Fplaid-elixir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wfgilman%2Fplaid-elixir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wfgilman%2Fplaid-elixir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wfgilman%2Fplaid-elixir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wfgilman","download_url":"https://codeload.github.com/wfgilman/plaid-elixir/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247156318,"owners_count":20893197,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","plaid"],"created_at":"2024-11-05T13:03:08.809Z","updated_at":"2025-04-04T10:04:54.471Z","avatar_url":"https://github.com/wfgilman.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Plaid\n\n[![Build Status](https://travis-ci.org/wfgilman/plaid-elixir.svg?branch=master)](https://travis-ci.org/wfgilman/plaid-elixir)\n[![Coverage Status](https://coveralls.io/repos/github/wfgilman/plaid-elixir/badge.svg?branch=master)](https://coveralls.io/github/wfgilman/plaid-elixir?branch=master)\n[![Module Version](https://img.shields.io/hexpm/v/plaid_elixir.svg)](https://hex.pm/packages/plaid_elixir)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/plaid_elixir/)\n[![Total Download](https://img.shields.io/hexpm/dt/plaid_elixir.svg)](https://hex.pm/packages/plaid_elixir)\n[![License](https://img.shields.io/hexpm/l/plaid_elixir.svg)](https://github.com/wfgilman/plaid-elixir/blob/master/LICENSE)\n[![Last Updated](https://img.shields.io/github/last-commit/wfgilman/plaid-elixir.svg)](https://github.com/wfgilman/plaid-elixir/commits/master)\n\nElixir library for Plaid's V2 API.\n\nSupported Plaid products:\n\n- [x] Transactions\n- [x] Auth\n- [x] Identity\n- [x] Balance\n- [x] Income\n- [x] Assets\n- [x] Investments\n- [x] Signal\n\n[Plaid Documentation](https://plaid.com/docs/api)\n\n## Changes in 3.0\n\n`3.0` replaces [HTTPoison](https://github.com/edgurgel/httpoison) with [Tesla](https://github.com/teamon/tesla)\nbehind the scenes to provide more flexibility around HTTP calls. Additionally, `3.0` refactors\nthe test suite, hard deprecates several functions, and fixes small bugs when decoding Plaid JSON\nresponses into internal data structures.\n\nWhile these changes are primarily transparent, if you are considering upgrading to version `3.0`\nit's recommended you review the full list of breaking changes in the changelog.\n\nBig thanks to [yordis](https://github.com/yordis) for driving major improvements to `3.0`!\n\n## Usage\n\nAdd to your dependencies in `mix.exs`. The hex specification is required.\n\n```elixir\ndef deps do\n  [\n    {:plaid, \"~\u003e 3.0\", hex: :plaid_elixir}\n  ]\nend\n```\n\nCall the library from your project and match on the responses, for example, from a\nPhoenix controller.\n\n```elixir\ndefmodule MyController do\n  use Web, :controller\n\n  def index(conn, _params) do\n    token = ...\n\n    case Plaid.Accounts.get(%{access_token: token}) do\n      {:ok, %Plaid.Accounts{accounts: accts}} -\u003e\n        conn\n        |\u003e put_status(200)\n        |\u003e json(accts)\n      {:error, %Plaid.Error{error_message: msg}} -\u003e\n        conn\n        |\u003e put_status(400)\n        |\u003e json(%{message: msg})\n      {:error, reason} -\u003e\n        conn\n        |\u003e put_status(400)\n        |\u003e json(%{message: \"Request failed, please try again.\"})\n    end\n  end\nend\n```\n\n## Configuration\n\nAll calls to Plaid require your client id and secret. Add the following configuration\nto your project to set the values. This configuration is optional, see below for a\nruntime configuration. The library will raise an error if the relevant credentials\nare not provided either via `config.exs` or at runtime.\n\n```elixir\nconfig :plaid,\n  root_uri: \"https://development.plaid.com/\",\n  client_id: \"your_client_id\",\n  secret: \"your_secret\",\n  adapter: Tesla.Adapter.Hackney, # optional\n  middleware: [Tesla.Middleware.Logger], # optional\n  http_options: [timeout: 10_000, recv_timeout: 30_000] # optional\n```\n\nBy default, `root_uri` is set by `mix` environment. You can override it in your config.\n* `dev` - https://development.plaid.com/\n* `prod` - https://production.plaid.com/\n\nFinally, you can specify your HTTP client of choice with `adapter` key. The adapter is passed to [Tesla](https://github.com/teamon/tesla) and [hackney](https://github.com/benoitc/hackney) is the default adapter if this\nconfiguration is omitted.\n\nThe `http_options` key specifies the custom configuration for your HTTP client adapter. It's recommended you\nextend the receive timeout for Plaid, especially for retrieving historical transactions. In the code\nsnippet above, `[timeout: 10_000, recv_timeout: 30_000]` are timeout options understood by hackney.\n\n## Runtime configuration\n\nAlternatively, you can provide the configuration at runtime. The configuration passed\nas a function argument will overwrite the configuration in `config.exs`, if one exists.\n\nFor example, if you want to hit a different URL when calling the `/accounts` endpoint, you could\npass in a configuration argument to `Plaid.Accounts.get/2`.\n\n```elixir\nPlaid.Accounts.get(\n  %{access_token: \"my-token\"},\n  %{root_uri: \"http://sandbox.plaid.com/\", secret: \"no-secrets\"}\n)\n```\n\nHTTP client options may also be passed to the configuration at runtime. This can be\nuseful if you'd like to extend the receive timeout for certain calls to Plaid.\nHTTP client options will need to conform to the selected HTTP adapter.\n\n```elixir\nPlaid.Transactions.get(\n  %{access_token: \"my-token\"},\n  %{http_options: [recv_timeout: 10_000]}\n)\n```\n\n## Obtaining Access Tokens\n\nAccess tokens are required for almost all calls to Plaid. However, they can only be obtained\nusing [Plaid Link](https://plaid.com/docs/link/transition-guide/#creating-items-with-link).\n\nCall the `/link` endpoint to create a link token that you'll use to initialize Plaid Link.\nOnce a user successfully connects to his institution using Plaid Link, a\npublic token is returned to the client. This single-use public token can be exchanged\nfor an access token and item id (both of which should be stored) using\n`Plaid.Item.exchange_public_token/1`.\n\nConsult Plaid's documentation for additional detail on this process.\n\n## Metrics\n\nThis library emits [telemetry](https://github.com/beam-telemetry/telemetry) that you can use to get insight into communication\nbetween your system and Plaid service. Emitted events are designed to be similar to the ones Phoenix emits. Those are the following:\n* `[:tesla, :request, :start]` with `:system_time` measurement - signifies the moment request is being initiated\n* `[:tesla, :request, :stop]` with `:duration` measurement - emitted after request has been finished\n* `[:tesla, :request, :exception]` with `:duration` measurement - emitted in case there's an exception while making a request\n\nMetadata attached (if applicable to event type) are as follows:\n* `:env` - `Tesla.Env` containing information on the request, including `:method, :url, :status`\n* `:service` - Included by default to distinguish events from other potential tesla middleware. Only value is `:plaid`\n* `:u` - unit in which time is reported. Only value is `:native`.\n* `:error` - The error returned when making the request.\n* `:kind, :reason, :stacktrace` - Information about any exception raised during the request\n\nAdditionally, you can pass your custom metadata through the `config` parameter when calling a product endpoint.\nPut it under `telemetry_metadata` and it will be merged to the event metadata.\n\nAll times are in `:native` unit. Telemetry instrumentation is implemented using [Tesla.Middleware](https://github.com/teamon/tesla#middleware).\n\n#### Backward Compatibility\n\nTo continue receiving events in the format of the `2.5` version of this library,\nadd `Plaid.Telemetry` to the `middleware` in your config:\n```elixir\nconfig  :plaid\n  middleware: [Plaid.Telemetry]\n```\n\nIf you'd like to migrate to the telemetry events emitted in `3.0`, modify your event handler\nto listen for `[:tesla, :request, :start]` instead of `[:plaid, :request, :start]`. In the\nmetadata, the fields in `2.5` map to the following in `3.0`:\n* `:method` -\u003e `Tesla.Env{:method}`\n* `:path` -\u003e `Tesla.Env[:url]`\n* `:status` -\u003e `Tesla.Env[:status]`\n* `:result` -\u003e `Tesla.Env`\n* `:reason` -\u003e `:error`\n* `:exception` -\u003e `:kind, :reason, :stacktrace`\n\n## Custom Middleware\n\nUsing [Tesla](https://github.com/teamon/tesla) under the hood provides additional capabilities that can\nbe useful for communicating with Plaid, such as retry logic and logging, or emitting refined telemetry events.\n\nBy default this library uses the following middleware:\n* `Tesla.Middleware.BaseUrl`\n* `Tesla.Middleware.Headers`\n* `Tesla.Middleware.JSON`\n* `Plaid.Telemetry` (_custom implementation of_ `Tesla.Middleware.Telemetry`)\n\nTo include additional middleware, add either Tesla's supported middleware, or your own, to the `middleware` key\nin `config.exs` or pass it via the `config` argument at runtime.\n\nTo write your own middleware, please see [Tesla's documentation](https://hexdocs.pm/tesla/Tesla.Middleware.html#module-writing-custom-middleware) or the [Wiki Cookbook on Github](https://github.com/teamon/tesla/wiki).\n\n## Compatibility\n\nThis library natively supports serialization of its structs using `Jason` for compatibility with Phoenix.\n\n## Tests and Style\n\nThis library tries to implement best practices for unit and integration testing and\nversion `3.0` implements major improvements.\n\nUnit testing is done using [mox](https://github.com/dashbitco/mox) and follows the principals\noutlined in the well-known article by José Valim linked in that repo.  Unit tests can\nbe run standalone using `ExUnit` tags.\n```\nmix test --only unit\n```\n\nIntegration testing uses [bypass](https://github.com/PSPDFKit-labs/bypass) to simulate HTTP responses from Plaid.\nIntegration tests can also be run in isolation using tags.\n```\nmix test --only integration\n```\n\nStatic analysis is performed using [dialyzer](https://github.com/jeremyjh/dialyxir).\n\nElixir's native formatter is used along with [credo](https://github.com/rrrene/credo)\nfor code analysis.\n\n## Copyright and License\n\nCopyright (c) 2016 Will Gilman\n\nThis work is free. You can redistribute it and/or modify it under the\nterms of the MIT License. See the [LICENSE.md](./LICENSE.md) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwfgilman%2Fplaid-elixir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwfgilman%2Fplaid-elixir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwfgilman%2Fplaid-elixir/lists"}