Prefunded accounts allow you to maintain a balance of funds to power instant on-ramps and off-ramps for your customers. They are backed by a fungible stablecoin (1:1 with USD), and the destination currency when funding is always USD.
⚠️ Note: Prefunded accounts are very similar to Bridge wallets. In practice, a prefunded account is a wallet, but configured to allow use of the on_behalf_of field for offramps.
This can be useful in payroll scenarios where you may want to disperse ACH payments for multiple employees using one general liquidity wallet.

Funding a prefunded account

The destination currency when funding a Prefunded Account should always be USD, regardless of what underlying currency is used for an on-chain prefunded account.

Funding via virtual account API

This creates a virtual account that automatically forwards fiat deposits to your prefunded account.
curl --location --request POST 'https://api.bridge.xyz/v0/customers/<Customer ID>/virtual_accounts' \
--header 'Api-Key: <API Key>' \
--header 'Idempotency-Key: <Unique Idempotency Key>' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "source": {
    "currency": "usd"
  },
  "destination": {
    "payment_rail": "prefunded",
    "currency": "usd",
    "prefunded_account_id": "prefunded_account_id"
  }

Funding via transfer API

You can set a prefunded account as the destination of a Transfer.
Request
curl --location --request POST 'https://api.bridge.xyz/v0/transfers' \
--header 'Api-Key: <API Key>' \
--header 'Idempotency-Key: <Unique Idempotency Key>' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "amount": "100.00",
  "on_behalf_of": "customer_id",
  "source": {
    "payment_rail": "ethereum",
    "currency": "usdc",
    "from_address": "0x..."
  },
  "destination": {
    "payment_rail": "prefunded",
    "currency": "usd",
    "prefunded_account_id": "prefunded_account_id"
  }
}'

Funding via liquidation address API

You can automatically forward crypto deposits to your prefunded account using the liquidation address api.
Request
curl --location --request POST 'https://api.bridge.xyz/v0/customers/<Customer ID>/liquidation_addresses' \
--header 'Api-Key: <API Key>' \
--header 'Idempotency-Key: <Unique Idempotency Key>' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "chain": "stellar",
  "currency": "usdc",
  "destination_payment_rail": "prefunded",
  "destination_currency": "usd",
  "prefunded_account_id": "prefunded_account_id"
}

Using prefunded accounts for instant onramps

Prefunded Accounts can be used as the source when making a Transfer. The currency when using a Prefunded Account as a source should always be USD.
Request
curl --location --request POST 'https://api.bridge.xyz/v0/transfers' \
--header 'Api-Key: <API Key>' \
--header 'Idempotency-Key: <Unique Idempotency Key>' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "amount": "100.00",
  "on_behalf_of": "customer_id",
  "source": {
    "payment_rail": "prefunded",
    "currency": "usd",
    "prefunded_account_id": "prefunded_account_id"
  },
  "destination": {
    // You can set the destination to be a regular crypto address:
    "payment_rail": "ethereum",
    "currency": "usdc",
    "to_address": "0x..."

    // Or to a bridge wallet:
    "payment_rail": "<Bridge Wallet chain>",
    "currency": "<Bridge Wallet currency>",
    "bridge_wallet_id": "<Bridge Wallet id>"

    // Or to an external address:
    payment_rail: "wire",
    currency: "usd",
    wire_message: "<wire message>",
    external_account_id: <External Account id>,
  }
}'
Response
{
  "id": "tr_123456",
  "state": "in_review",
  "currency": "usd",
  "amount": "100.00",
  "source": {
    "payment_rail": "prefunded",
    "currency": "usd",
    "prefunded_account_id": "pref_789",
    "prefunded_account": "account_name"
  },
  "destination": {
    "payment_rail": "ethereum",
    "currency": "usdc",
    "to_address": "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6"
  },
  "receipt": {
    "initial_amount": "100.00",
    "developer_fee": "0.00",
    "exchange_fee": "0.00",
    "subtotal_amount": "100.00",
    "remaining_prefunded_balance": "900.00",
    "final_amount": "100.00",
    "gas_fee": "0.00"
  }
}