plaid v0.3.0 Plaid.Token

Functions for working with a Plaid token.

Through this API you can:

  • Exchange a public token for an access token

Plaid API Reference: https://plaid.com/docs/quickstart/#-exchange_token-endpoint

  • TODO: incorporate account _id in payload.

Summary

Functions

Exchanges a public token for an access token

Functions

exchange(params, cred \\ nil)

Specs

exchange(binary | map, map) :: {atom, binary | map}

Exchanges a public token for an access token.

Exchanges a user’s public token for an access token. If credentials are not supplied, credentials in the default configuration are used.

Returns access_token or Plaid.Error struct.

Args

  • params - map or string - req - public token or Payload
  • cred - map - opt - Plaid credentials

Payload

  • public_token - string - req - Public token returned from Plaid Link

Example

params = "test,bofa,connected"
cred = %{client_id: "test_id", secret: "test_secret"}

{:ok, "test_bofa"} = Plaid.Token.exchange("test,bofa,connected")
{:ok, "test_bofa"} = Plaid.Token.exchange(params)
{:ok, "test_bofa"} = Plaid.Token.exchange(params, cred)
{:error, %Plaid.Error{...}} = Plaid.Token.exchange(params, cred)