PlaidEx.API.Sandbox (plaid_ex v1.0.0)

Copy Markdown View Source

Plaid Sandbox API — sandbox-only test utilities.

Use these endpoints to test your integration without real bank accounts.

All functions in this module fail in production environments.

Summary

Functions

Creates a test bank transfer in sandbox.

Creates a sandbox Item with test accounts.

Fires a webhook for a sandbox Item.

Resets an Item's login state to trigger ITEM_LOGIN_REQUIRED.

Sets an Item into a specific verification state for testing error handling.

Returns a list of available test usernames for sandbox.

Functions

create_bank_transfer(config, params, opts \\ [])

@spec create_bank_transfer(PlaidEx.Config.t(), map(), keyword()) ::
  {:ok, map()} | {:error, PlaidEx.Error.t()}

Creates a test bank transfer in sandbox.

create_public_token(config, opts \\ [])

@spec create_public_token(
  PlaidEx.Config.t(),
  keyword()
) :: {:ok, %{public_token: String.t()}} | {:error, PlaidEx.Error.t()}

Creates a sandbox Item with test accounts.

Returns a public_token ready for exchange, without needing to open Link. Used in automated testing.

Example

{:ok, %{public_token: token}} = PlaidEx.API.Sandbox.create_public_token(config,
  institution_id: "ins_109508",
  initial_products: ["transactions"],
  options: %{override_username: "user_good"}
)

fire_webhook(config, opts)

@spec fire_webhook(
  PlaidEx.Config.t(),
  keyword()
) :: {:ok, map()} | {:error, PlaidEx.Error.t()}

Fires a webhook for a sandbox Item.

Example

PlaidEx.API.Sandbox.fire_webhook(config,
  access_token: "access-sandbox-...",
  webhook_type: "TRANSACTIONS",
  webhook_code: "SYNC_UPDATES_AVAILABLE"
)

reset_login(config, access_token, opts \\ [])

@spec reset_login(PlaidEx.Config.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, PlaidEx.Error.t()}

Resets an Item's login state to trigger ITEM_LOGIN_REQUIRED.

set_item_verification_status(config, access_token, account_id, verification_status, opts \\ [])

@spec set_item_verification_status(
  PlaidEx.Config.t(),
  String.t(),
  String.t(),
  String.t(),
  keyword()
) ::
  {:ok, map()} | {:error, PlaidEx.Error.t()}

Sets an Item into a specific verification state for testing error handling.

simulate_transfer_event(config, transfer_id, event_type, opts \\ [])

@spec simulate_transfer_event(PlaidEx.Config.t(), String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, PlaidEx.Error.t()}

Simulates a transfer event in sandbox.

test_usernames()

@spec test_usernames() :: [%{username: String.t(), description: String.t()}]

Returns a list of available test usernames for sandbox.