View Source Plaid.Sandbox (elixir_plaid v1.2.1)

Plaid Sandbox API calls and schema.

Only used for sandbox testing purposes. None of these calls will work in development or production.

🏗 I haven'tyet tested the bank_transfer endpoints against the actual plaid API because I can't get the bank_transfers product from plaid yet. If you test it, let me know and I can remove the in-progress status!

Link to this section Summary

Functions

Create a valid processor_token for an arbitrary institution ID and test credentials.

Create a valid public_token with arbitrary details.

Manually fire a Bank Transfer webhook.

Fire a fake webhook to an Item's webhook endpoint.

Force an item into a "login required" state.

Simulate a bank transfer event in the Plaid Sandbox.

Link to this section Functions

Link to this function

create_processor_token(institution_id, options \\ %{}, config)

View Source

Specs

create_processor_token(String.t(), options, Plaid.config()) ::
  {:ok, Plaid.Sandbox.CreateProcessorTokenResponse.t()}
  | {:error, Plaid.Error.t()}
when options: %{
       optional(:override_username) => String.t(),
       optional(:override_password) => String.t()
     }

Create a valid processor_token for an arbitrary institution ID and test credentials.

Does a POST /sandbox/processor_token/create call to create a valid processor_token to use with all the processor endpoints in the sandbox.

Params:

  • institution_id - The ID of the institution the Item will be associated with.

Options:

  • :override_username - Test username to use for the creation of the Sandbox Item.
  • :override_password - Test password to use for the creation of the Sandbox Item.

examples

Examples

Sandbox.create_processor_token("ins_1", client_id: "123", secret: "abc")
{:ok, %Sandbox.CreateProcessorTokenResponse{}}
Link to this function

create_public_token(institution_id, initial_products, options \\ %{}, config)

View Source

Specs

create_public_token(String.t(), [String.t()], options, Plaid.config()) ::
  {:ok, Plaid.Sandbox.CreatePublicTokenResponse.t()} | {:error, Plaid.Error.t()}
when options: %{
       optional(:webhook) => String.t(),
       optional(:override_username) => String.t(),
       optional(:override_password) => String.t(),
       optional(:transactions) => Plaid.Sandbox.TransactionsOptions.t()
     }

Create a valid public_token with arbitrary details.

Does a POST /sandbox/public_token/create call to create a new sandbox public token.

Params:

  • institution_id - The ID of the institution the Item will be associated with.
  • initial_products - The products to initially pull for the Item.

Options:

  • :webhook - Specify a webhook to associate with the new Item.
  • :override_username - Test username to use for the creation of the Sandbox Item.
  • :override_password - Test password to use for the creation of the Sandbox Item.
  • :transactions - Options for transactions on the new Item.

examples

Examples

Sandbox.create_public_token("ins_1", ["auth"], client_id: "123", secret: "abc")
{:ok, %Sandbox.CreatePublicTokenResponse{}}
Link to this function

fire_bank_transfer_webhook(webhook, config)

View Source

Specs

fire_bank_transfer_webhook(String.t(), Plaid.config()) ::
  {:ok, Plaid.SimpleResponse.t()} | {:error, Plaid.Error.t()}

Manually fire a Bank Transfer webhook.

Does a POST /sandbox/bank_transfer/fire_webhook call to manually trigger a bank transfer webhook.

Params:

  • webhook - The URL to which the webhook should be sent.

examples

Examples

Sandbox.fire_bank_transfer_webhook("https://example.com/webhook", client_id: "123", secret: "abc")
{:ok, %Plaid.SimpleResponse{}}
Link to this function

fire_item_webhook(access_token, webhook_code, config)

View Source

Specs

fire_item_webhook(String.t(), String.t(), Plaid.config()) ::
  {:ok, Plaid.Sandbox.FireItemWebhookResponse.t()} | {:error, Plaid.Error.t()}

Fire a fake webhook to an Item's webhook endpoint.

Does a POST /sandbox/item/fire_webhook call which forces an item into the ITEM_LOGIN_REQUIRED state to simulate and item whose login is no longer valid.

Params:

  • access_token - The access token associated with the Item to fire the webhook for.
  • webhook_code - The webhook code to send.

webhook_code only supports DEFAULT_UPDATE for now.

examples

Examples

Sandbox.fire_item_webhook("access-prod-123xxx", "DEFAULT_UPDATE", client_id: "123", secret: "abc")
{:ok, %Sandbox.FireItemWebhookResponse{}}
Link to this function

reset_item_login(access_token, config)

View Source

Specs

reset_item_login(String.t(), Plaid.config()) ::
  {:ok, Plaid.Sandbox.ResetItemLoginResponse.t()} | {:error, Plaid.Error.t()}

Force an item into a "login required" state.

Does a POST /sandbox/item/reset_login call which forces an item into the ITEM_LOGIN_REQUIRED state to simulate and item whose login is no longer valid.

Params:

  • access_token - The access token associated with the Item to reset the login for.

examples

Examples

Sandbox.reset_item_login("access-prod-123xxx", client_id: "123", secret: "abc")
{:ok, %Sandbox.ResetItemLoginResponse{}}
Link to this function

set_item_verification_status(access_token, account_id, verification_status, config)

View Source

Specs

set_item_verification_status(String.t(), String.t(), String.t(), Plaid.config()) ::
  {:ok, Plaid.SimpleResponse.t()} | {:error, Plaid.Error.t()}

Change the verification status of an item.

Does a POST /sandbox/item/set_verification_status call to change the status of an item in order to simulate the Automated Micro-deposit flow.

Params:

  • access_token - The access token associated with the Item data is being requested for.
  • account_id - The ID of the account whose verification status is to be modified.
  • verification_status - The verification status to set the account to.

examples

Examples

Sandbox.set_item_verification_status("access-prod-123xxx", "39flxk4ek2xs", "verification_expired", client_id: "123", secret: "abc")
{:ok, %Plaid.SimpleResponse{request_id: "9bkemelske"}}
Link to this function

simulate_bank_transfer(bank_transfer_id, event_type, options \\ %{}, config)

View Source

Specs

simulate_bank_transfer(String.t(), String.t(), options, Plaid.config()) ::
  {:ok, Plaid.SimpleResponse.t()} | {:error, Plaid.Error.t()}
when options: %{
       optional(:failure_reason) => %{
         optional(:ach_return_code) => String.t(),
         optional(:description) => String.t()
       }
     }

Simulate a bank transfer event in the Plaid Sandbox.

Does a POST /sandbox/bank_transfer/simulate call to simulate a bank transfer in the plaid sandbox for testing purposes.

Params:

  • bank_transfer_id - Plaid’s unique identifier for a bank transfer.
  • event_type - The asynchronous event to be simulated. May be: posted, failed, or reversed.

Options:

  • :failure_reason - The failure reason if the type of this transfer is "failed" or "reversed".

examples

Examples

Sandbox.simulate_bank_transfer("bt_123xxx", "posted", client_id: "123", secret: "abc")
{:ok, %Plaid.SimpleResponse{}}