Prefunded Accounts

Prefunded accounts allow sending funds from an account that you have previously funded.

Prefunded accounts enable you to pre-load funds by depositing funds into a bank account with your name on it. You may then send funds out to your users using this balance without waiting for source funds to post effectively speeding transaction time.

Viewing a Prefunded Account

# REQUEST
curl --request GET \
     --url 'https://api.bridge.xyz/v0/prefunded_accounts' \
     --header 'Api-Key: <Api-Key>' \
     --header 'accept: application/json'
// RESPONSE
{ 
  "data": [
    "id": "f3782fe6-7478-4bab-b472-f1b9628ddc90"
    "available_balance": "100000.0",
    "currency": "usd",
    "name": "human-readable-name"
  ]
}

Check the balance of a specific PrefundedAccount

curl --request GET  
     --url '<https://api.bridge.xyz/v0/prefunded_accounts/><ID>'  
     --header 'Api-Key: <Api-Key>'  
     --header 'accept: application/json
// REPSONSE
{
  "id": "f3782fe6-7478-4bab-b472-f1b9628ddc90"
  "available_balance": "100000.0",
  "currency": "usd",
  "name": "human-readable-name"
}

Using for a Transfer

To use the PrefundedAccount as a source of a transfer, simply reference the prefunded account ID in the source data of the API.

Additional context can be found on bridges public documentation for transfers. https://apidocs.bridge.xyz/docs/fitat-to-stablecoin-crypto-on-ramp

Use the PrefundedAccount for sending to a wallet

// 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": "10.0",
  "on_behalf_of": "54120594-f1f8-46da-bc30-ffffea042272",
  "developer_fee": "0.5",
  "source": {
    "payment_rail": "prefunded",
    "currency": "usd",
    "prefunded_account_id": "f3782fe6-7478-4bab-b472-f1b9628ddc90"
  },
  "destination": {
    "payment_rail": "ethereum",
    "currency": "usdc",
    "to_address": "0xdeadbeef",
  },
}'
// RESPONSE
{
  "id": "ddcfbccb-b708-4461-8330-a02d9b5e8818",
  "state": "in_review",
  "on_behalf_of": "54120594-f1f8-46da-bc30-ffffea042272",
  "amount": "10.0",
  "developer_fee": "0.5",
  "source": {
    "payment_rail": "prefunded",
    "currency": "usd"
    "prefunded_account_id": "f3782fe6-7478-4bab-b472-f1b9628ddc90"
  },
  "destination": {
    "payment_rail": "polygon",
    "currency": "usdc",
    "to_address": "0xdeadbeef"
  },
  "receipt": {
    "initial_amount": "10.0",
    "developer_fee": "0.5",
    "exchange_fee": "0.0",
    "subtotal_amount": "9.5",
    "final_amount": "9.5"
  },
  "created_at": "2023-05-05T19:39:14.316Z",
  "updated_at": "2023-05-05T19:39:15.231Z"
}