plaid v0.2.0 Plaid.Connect
Functions for working with Plaid Connect endpoint.
Through this API you can:
- Add a Plaid Connect user
- Register a webhook for a user
- Fetch user account data
- Fetch user transaction data
- Specify MFA delivery options
- Submit MFA responses
- Update user credentials
- Delete a user
All requests are submitted as maps with the parameter name as the key
and value as value: %{key: value}
. Keys can be strings or atoms.
The functionality is performed by five functions: add
, mfa
, connect
,
update
and delete
. The specific requests are determined by the payload.
Each function accepts user-supplied credentials, but uses the credentials
specified in the configuration by default. The credentials are provided
as a map: %{client_id: value, secret: value}
Payload (Credentials)
client_id
- PlaidCLIENT_ID
-string
- requiredsecret
- PlaidSECRET
-string
- required
Summary
Functions
Adds a Connect user
Adds a Connect user with user-supplied credentials
Deletes a Connect user
Deletes a Connect user with user-supplied credentials
Gets Plaid data
Gets Plaid data with user-supplied credentials
Submits MFA choice confirmation and MFA answer
Submits MFA choice confirmation and MFA answer with user-supplied credentials
Updates a user’s credentials
Updates a user’s credentials with user-supplied credentials
Updates a user’s MFA credentials with user-supplied credentials
Functions
Specs
add(map) :: {atom, map}
Adds a Connect user.
Adds a Plaid Connect user using the username and password of the specified financial institution. Uses credentials supplied in the configuration.
Returns Plaid.Connect
, Plaid.MfaQuestion
, Plaid.MfaMask
or Plaid.Error
struct.
Payload
type
- Plaid institution code -string
- requiredusername
- user login -string
- requiredpassword
- user password -string
- requiredpin
- user pin -string
- required for USAAtype
onlyoptions
- optional parameters (below) -map
- optionallogin_only
- add user only, does not return transactions -boolean
webhook
- url to which webhook messages will be sent -string
pending
- return pending transactions -boolean
start_date
- iflogin_only
is false, earliest date for which transactions will be returned -string
formatted “YYYY-MM-DD”end_date
- iflogin_only
is false, latest date for which transactions will be returned -string
format “YYYY-MM-DD”list
- MFA delivery methods -boolean
Example
params = %{username: "plaid_test", password: "plaid_good", type: "bofa",
options: %{login_only: true, webhook: "http://requestb.in/",
pending: false, start_date: "2015-01-01", end_date: "2015-03-31"},
list: true}
{:ok, %Plaid.Connect{...}} = Plaid.Connect.add(params)
{:ok, %Plaid.MfaQuestion{...}} = Plaid.Connect.add(params)
{:ok, %Plaid.MfaMask{...}} = Plaid.Connect.add(params)
{:error, %Plaid.Error{...}} = Plaid.Connect.add(params)
Plaid API Reference: https://plaid.com/docs/api/#add-connect-user
Specs
add(map, map) :: {atom, map}
Adds a Connect user with user-supplied credentials.
Example
params = %{username: "plaid_test", password: "plaid_good", type: "bofa",
options: %{login_only: true, webhook: "http://requestb.in/",
pending: false, start_date: "2015-01-01", end_date: "2015-03-31"},
list: true}
cred = %{client_id: "test_id", secret: "test_secret"}
{:ok, %Plaid.Connect{...}} = Plaid.Connect.add(params, cred)
{:ok, %Plaid.MfaQuestion{...}} = Plaid.Connect.add(params, cred)
{:ok, %Plaid.MfaMask{...}} = Plaid.Connect.add(params, cred)
{:error, %Plaid.Error{...}} = Plaid.Connect.add(params, cred)
Plaid API Reference: https://plaid.com/docs/api/#add-connect-user
Specs
delete(map) :: {atom, map}
Deletes a Connect user.
Deletes a user from the Plaid connect endpoint.
Returns a Plaid.Message
or Plaid.Error
struct.
Payload
access_token
- userACCESS_TOKEN
-string
- required
Example
params = %{access_token: "test_bofa"}
{:ok, %Plaid.Message{...}} = Plaid.Connect.delete(params)
{:error, %Plaid.Error{...}} = Plaid.Connect.delete(params)
Plaid API Reference: https://plaid.com/docs/api/#delete-connect-user
Specs
delete(map, map) :: {atom, map}
Deletes a Connect user with user-supplied credentials.
Example
params = %{access_token: "test_bofa"}
cred = %{client_id: "test_id", secret: "test_secret"}
{:ok, %Plaid.Message{...}} = Plaid.Connect.delete(params, cred)
{:error, %Plaid.Error{...}} = Plaid.Connect.delete(params, cred)
Plaid API Reference: https://plaid.com/docs/api/#delete-connect-user
Specs
get(map) :: {atom, map}
Gets Plaid data.
Gets a user’s account and transaction data as specified in the params. Uses credentials specified in the configuration.
Returns Plaid.Connect
or Plaid.Error
struct.
Payload
access_token
- userACCESS_TOKEN
-string
- requiredoptions
- optional parameters (below) -map
- optionalpending
- return pending transactions -boolean
account
- Plaid account_id
for which to return transactions -string
gte
- earliest date for which transactions will be returned -string
formatted “YYYY-MM-DD”lte
- latest date for which transactions will be returned -string
formatted “YYYY-MM-DD”
Example
params = %{access_token: "test_bofa", options: %{pending: false,
account: "QPO8Jo8vdDHMepg41PBwckXm4KdK1yUdmXOwK",
gte: "2012-01-01", lte: "2016-01-01"}}
{:ok, %Plaid.Connect{...}} = Plaid.Connect.get(params)
{:error, %Plaid.Error{...}} = Plaid.Connect.get(params)
Plaid API Reference: https://plaid.com/docs/api/#get-transactions
Specs
get(map, map) :: {atom, map}
Gets Plaid data with user-supplied credentials.
Example
params = %{access_token: "test_bofa", options: %{pending: false,
account: "QPO8Jo8vdDHMepg41PBwckXm4KdK1yUdmXOwK",
gte: "2012-01-01", lte: "2016-01-01"}}
cred = %{client_id: "test_id", secret: "test_secret"}
{:ok, %Plaid.Connect{...}} = Plaid.Connect.get(params, cred)
{:error, %Plaid.Error{...}} = Plaid.Connect.get(params, cred)
Plaid API Reference: https://plaid.com/docs/api/#get-transactions
Specs
mfa(map) :: {atom, map}
Submits MFA choice confirmation and MFA answer.
Submits MFA choice confirmation or MFA answer to Plaid connect/step endpoint. The request is determined by the payload. Used in response to an MFA question response following a Plaid.Connect.add/1 request. Uses credentials supplied in the configuration.
Returns Plaid.Connect
, Plaid.MfaMessage
or Plaid.Error
struct.
Payload (Choice Confirmation)
access_token
- userACCESS_TOKEN
-string
- requiredoptions
- options for MFA (below) -map
- requiredsend_method
- delivery modality for MFA request -map
Payload (MFA Answer)
access_token
- userACCESS_TOKEN
-string
- requiredmfa
- user response to MFA question -string
- required
Example
params = %{access_token: "test_bofa", mfa: "tomato"}
OR
%{access_token: "test_bofa", options: %{send_method:
%{type: "phone"}}}
{:ok, %Plaid.Connect{...}} = Plaid.Connect.mfa(params)
{:ok, %Plaid.MfaMessage{...}} = Plaid.Connect.mfa(params)
{:error, %Plaid.Error{...}} = Plaid.Connect.mfa(params)
Plaid API Reference: https://plaid.com/docs/api/#connect-mfa
Specs
mfa(map, map) :: {atom, map}
Submits MFA choice confirmation and MFA answer with user-supplied credentials.
Example
params = %{access_token: "test_bofa", mfa: "tomato"}
OR
%{access_token: "test_bofa", options: %{send_method:
%{type: "phone"}}}
cred = %{client_id: "test_id", secret: "test_secret"}
{:ok, %Plaid.Connect{...}} = Plaid.Connect.mfa(params, cred)
{:ok, %Plaid.MfaMessage{...}} = Plaid.Connect.mfa(params, cred)
{:error, %Plaid.Error{...}} = Plaid.Connect.mfa(params, cred)
Plaid API Reference: https://plaid.com/docs/api/#connect-mfa
Specs
update(map) :: {atom, map}
Updates a user’s credentials.
Patches a user’s credentials or webhook url in Plaid. New credentials
must be submitted for an existing user identified by the ACCESS_TOKEN
.
Request is determined by the payload. Uses credentials specified in the
configuration.
Returns Plaid.Connect
, Plaid.MfaQuestion
or Plaid.Error
struct.
Payload (Connect)
access_token
- userACCESS_TOKEN
-string
- requiredusername
- user login -string
- requiredpassword
- user password -string
- requiredpin
- user pin -string
- required for USAA only
Payload (Webhook)
access_token
- userACCESS_TOKEN
-string
- requiredoptions
- parameters (below) -map
- requiredwebhook
- url to which webhook messages will be sent -string
Example
params = %{access_token: "test_bofa", username: "plaid_test",
password: "plaid_good"}
OR
%{access_token: "test_bofa", options: %{webhook: "http://requestb.in/"}}
{:ok, %Plaid.Connect{...}} = Plaid.Connect.update(params)
{:ok, %Plaid.MfaQuestion{...}} = Plaid.Connect.update(params)
{:error, %Plaid.Error{...}} = Plaid.Connect.update(params)
Plaid API Reference: https://plaid.com/docs/api/#update-connect-user
Specs
update(map, atom) :: {atom, map}
update(map, map) :: {atom, map}
Updates a user’s credentials with user-supplied credentials.
Example
params = %{access_token: "test_bofa", username: "plaid_test",
password: "plaid_good"}
OR
%{access_token: "test_bofa", options: %{webhook: "http://requestb.in/"}}
cred = %{client_id: "test_id", secret: "test_secret"}
{:ok, %Plaid.Connect{...}} = Plaid.Connect.update(params, cred)
{:ok, %Plaid.MfaQuestion{...}} = Plaid.Connect.update(params, cred)
{:error, %Plaid.Error{...}} = Plaid.Connect.update(params, cred)
Plaid API Reference: https://plaid.com/docs/api/#update-connect-user
Specs
update(map, map, atom) :: {atom, map}
Updates a user’s MFA credentials with user-supplied credentials.
Example
params = %{access_token: "test_bofa", mfa: "tomato"}
cred = %{client_id: "test_id", secret: "test_secret"}
{:ok, %Plaid.Connect{...}} = Plaid.Connect.update(params, cred, :mfa)
{:error, %Plaid.Error{...}} = Plaid.Connect.update(params, cred, :mfa)
Plaid API Reference: https://plaid.com/docs/api/#update-connect-user