Virtual Account

A Virtual Account is a virtual bank account created by our system to facilitate onramping. Users can deposit fiat into the virtual account, and the deposited fiat is automatically converted into stablecoins and transferred to the user's wallet on-chain. To create a virtual account for a user, you can call the Create a virtual account endpoint with the user's id.

The parameters you pass in will determine the rail you want this onramp virtual account to support. For example, passing the sourceCurrency as usd, destinationCurrency as usdc, and destinationChain as POLYGON, will allow the user to deposit usd into the virtual bank account to onramp to usdc on POLYGON.

Let's make a Create a virtual account call with the parameters we just mentioned:

Request

curl --request POST \
     --url https://sandbox.hifibridge.com/v2/users/f4fd2f10-2577-45cc-9e06-07ac9a74eb51/virtual-accounts \
     --header 'accept: application/json' \
     --header 'authorization: Bearer zpka_123456' \
     --header 'content-type: application/json' \
     --data '
{
  "sourceCurrency": "usd",
  "destinationCurrency": "usdc",
  "destinationChain": "POLYGON"
}
'

Response

{
    "message": "Virtual account for US_ACH_WIRE created successfully",
    "account": {
        "virtualAccountId": "a83de52e-7741-442d-8406-f1e65c07fdc6",
        "userId": "f4fd2f10-2577-45cc-9e06-07ac9a74eb51",
        "paymentRails": [
            "ach_push",
            "wire"
        ],
        "sourceCurrency": "usd",
        "destinationChain": "POLYGON_AMOY",
        "destinationCurrency": "usdc",
        "destinationWalletAddress": "0x3b17b0Cc70116F0aD0c0960FcD628E7ff85cb351",
        "railStatus": "activated",
        "depositInstructions": {
            "bankName": "Bank of Nowhere",
            "routingNumber": "101019644",
            "accountNumber": "900602808842",
            "bankAddress": "1800 North Pole St., Orlando, FL 32801"
        }
    }
}

Let's take a look at the response, focusing on the virtual account object:

  • The virtualAccountId is the unique identifier for the newly created virtual account. This ID should be saved for future retrieval of account information, including deposit instructions and micro-deposit details required by the institution.
  • The paymentRails indicates the payment methods supported by this virtual account.
  • The sourceCurrency, destinationChain, and destinationCurrency together represents the complete onramp rail. In our case, any usd deposited into the virtual account will be converted to usdc and sent to destinationWalletAddress on the POLYGON_AMOY blockchain.
  • The railStatus reflects whether this virtual account is active for onramping.
  • IMPORTANT: The depositInstructions object contains the bank account details that the user needs to deposit fiat into for onramping.