/get_virtual_account

Gets an array of virtual account data including the balance for a single virtual account.

This endpoint returns details about a virtual account registered to a user, including:

  • Virtual Account ID
  • Virtual Account Name
  • Account Number
  • Routing Number
  • Account Type
  • Balance

Requests

Authorization / Authentication

Apps using Access Token Authorization

Use a valid access token in an Authorization: Bearer request header.

See Authenticating with an Access Token for more details.

Apps using ECDSA Authentication

Both authsignature and usersignature headers are required for this request. The usersignature header should be generated with a keypair registered to the user (either registered from the /register endpoint or the /register_wallet endpoint).

See the section on ECDSA Authentication for more detail about ECDSA signature generation.

POST /0.2/get_virtual_account HTTP/1.1
sandbox.silamoney.com
Content-Type: application/json
// if using OAuth2
Authorization: Bearer [GENERATED JWT TOKEN HERE]
// if using ECDSA
authsignature: [GENERATED AUTHSIGNATURE HEX STRING HERE]
usersignature: [GENERATED USERSIGNATURE HEX STRING HERE]

{
  "header": {
    "created": 1234567890, 
    "app_handle": "handle.silamoney.eth", 
    "user_handle":"user.silamoney.eth", 
    "version": "0.2",
    "crypto": "ETH", 
    "reference": "<your unique id>"
  }
  "virtual_account_id": "<virtual account uuid>"
}

***

HTTP/1.1 200 OK

{
  "success": true,
  "status": "SUCCESS",
  "response_time_ms": "171",
  "virtual_account": {
    "virtual_account_id": "<virtual account uuid>",
    "virtual_account_name": "Sherry's Money Tree",
    "account_number": "1234567812345678",
    "routing_number": "123456789",
    "account_type": "VIRTUAL_ACCOUNT",
    "active": true,
    "closed": false,
    "created_epoch": 1613569714,
    "closed_epoch": null,
    "ach_credit_enabled": true,
    "ach_debit_enabled": false
  }
  "balance": {
    "pending_sila_balance": 120,
    "available_sila_balance": 100
  }
}
let virtualAccountName = 'varAccount-1';
let vAccountId = '18fd14c8-cab2-41ef-8fed-5916be32610c';
const res = await Sila.getVirtualAccount(userHandle, userPrivateKey, vAccountId);

Success Response Object
{
  "statusCode": 200,
  "headers": {
    "server": "nginx/1.14.0 (Ubuntu)",
    "date": "Fri, 25 Mar 2022 11:45:14 GMT",
    "content-type": "application/json",
    "content-length": "527",
    "connection": "close",
    "access-control-allow-origin": "*",
    "access-control-allow-headers": "*",
    "allow": "GET, POST, PUT, DELETE, HEAD, OPTIONS",
    "vary": "Cookie"
  },
  "data": {
    "success": true,
    "status": "SUCCESS",
    "virtual_account": {
      "virtual_account_id": "18fd14c8-cab2-41ef-8fed-5916be32610c",
      "virtual_account_name": "varAccount-1",
      "account_number": "9710010589065012",
      "routing_number": "084106768",
      "account_type": "VIRTUAL_ACCOUNT",
      "ach_credit_enabled": false,
      "ach_debit_enabled": true,
      "active": true,
      "closed": false,
      "created_epoch": 1648208707,
      "closed_epoch": null
    },
    "balance": {
      "available_sila_balance": 0,
      "pending_sila_balance": 0
    },
    "reference": "9540cb7d-c057-4483-b517-e7fdd15ab196",
    "response_time_ms": "3477"
  }
}
payload = {
    "user_handle": "user.silamoney.eth",
    "virtual_account_id":"f06e7f6d-381f-42c0-997f-98b86cfe3770",
}

User.getVirtualAccount(app, payload, eth_private_key)

# Success

{
   "success":true,
   "status":"SUCCESS",
   "virtual_account":{
      "virtual_account_id":"782bbd8c-ae27-4fb6-89e8-2675a1791382",
      "virtual_account_name":"default",
      "account_number":"9710016172909900",
      "routing_number":"084106768",
      "account_type":"VIRTUAL_ACCOUNT",
      "active":true,
      "closed":false,
      "created_epoch":1643027826,
      "closed_epoch":"None",
      "ach_credit_enabled": true,
      "ach_debit_enabled": false
   },
   "balance":{
      "available_sila_balance":0,
      "pending_sila_balance":0
   },
   "reference":"846ed675-5269-4006-90a1-aadb08b9245b",
   "status_code":200,
}
ApiResponse response = api.getVirtualAccount("userHandle", "userPrivateKey","virtual_account_id");

// Success Response
System.out.println(response.getStatusCode()); // 200
GetVirtualAccountResponse parsedResponse = (GetVirtualAccountResponse) response.getData();
System.out.println(parsedResponse.getStatus()); // SUCCESS
System.out.println(parsedResponse.getSuccess()); // true
System.out.println(parsedResponse.getReference()); // Reference number
System.out.println(parsedResponse.getMessage());
System.out.println(parsedResponse.getVirtualAccount().getVirtualAccountId()); // 1df8f430-3dec-47a2-bfa7-5e02b19a7bc8
System.out.println(parsedResponse.getVirtualAccount().getVirtualAccountName()); // Virtual account name
System.out.println(parsedResponse.getVirtualAccount().getAccountNumber()); // Account number
System.out.println(parsedResponse.getVirtualAccount().getRoutingNumber()); // 123456789
System.out.println(parsedResponse.getVirtualAccount().getAccountType()); // VIRTUAL_ACCOUNT
System.out.println(parsedResponse.getVirtualAccount().getClosedEpoch()); // "null" or <epoch_timestamp>
System.out.println(parsedResponse.getVirtualAccount().getCreated_epoch()); // <epoch_timestamp>
System.out.println(parsedResponse.getVirtualAccount().isClosed()); // true/false
System.out.println(parsedResponse.getVirtualAccount().isActive()); // true/false
System.out.println(parsedResponse.getVirtualAccount().isAchCreditEnabled()); // true/false
System.out.println(parsedResponse.getVirtualAccount().isAchDebitEnabled()); // true/false
System.out.println(parsedResponse.getBalance().getAvailableSilaBalance()); // Available  sila balance
System.out.println(parsedResponse.getBalance().getPendingSilaBalance()); // Pending sila balance
$userHandle = 'user.silamoney.eth';
$userPrivateKey = 'some private key'; // Hex format
$virtualAccountId = "virtual account id";

// Call the api
$response = $client->getVirtualAccount($userHandle, $userPrivateKey, $virtualAccountId);

// Success 200
echo $response->getStatusCode();
echo $response->getData()->success;
echo $response->getData()->status;
echo $response->getData()->reference;
echo $response->getData()->message;
echo $response->getData()->virtual_account->account_type;
echo $response->getData()->virtual_account->virtual_account_id;
echo $response->getData()->virtual_account->virtual_account_name;
echo $response->getData()->virtual_account->ach_credit_enabled;
echo $response->getData()->virtual_account->ach_debit_enabled;
//Load your informations
ApiResponse<object> response = api.GetVirtualAccount(userHandle, userPrivateKey, virtualAccountId);

// Success Object Response

Console.WriteLine(response.StatusCode); // 200           
Console.WriteLine(((GetVirtualAccountResponse)response.Data).Message); // Message
Console.WriteLine(((GetVirtualAccountResponse)response.Data).Success); // true
Console.WriteLine(((GetVirtualAccountResponse)response.Data).Status); // SUCCESS
Console.WriteLine(((GetVirtualAccountResponse)response.Data).Reference); // ccb35eb8-xxxx-xxxx-xxxx-xxxxx
Console.WriteLine(((GetVirtualAccountsResponse)response.Data).ResponseTimeMs); // API responses time

Console.WriteLine(((GetVirtualAccountResponse)response.Data).Balance); // Balance
Console.WriteLine(((GetVirtualAccountResponse)response.Data).Balance.AvailableSilaBalance); // return 120
Console.WriteLine(((GetVirtualAccountResponse)response.Data).Balance.PendingSilaBalance); // 100

Console.WriteLine(((GetVirtualAccountResponse)response.Data).VirtualAccount);
Console.WriteLine(((GetVirtualAccountResponse)response.Data).VirtualAccount.AccountNumber);  // 1234567812345678
Console.WriteLine(((GetVirtualAccountResponse)response.Data).VirtualAccount.AccountType); // VIRTUAL_ACCOUNT
Console.WriteLine(((GetVirtualAccountResponse)response.Data).VirtualAccount.Active);  // true/false
Console.WriteLine(((GetVirtualAccountResponse)response.Data).VirtualAccount.Closed); // true/false
Console.WriteLine(((GetVirtualAccountResponse)response.Data).VirtualAccount.ClosedEpoch); // epoch timestamp
Console.WriteLine(((GetVirtualAccountResponse)response.Data).VirtualAccount.CreatedEpoch); // epoch timestamp
Console.WriteLine(((GetVirtualAccountResponse)response.Data).VirtualAccount.RoutingNumber); // 044000000
Console.WriteLine(((GetVirtualAccountResponse)response.Data).VirtualAccount.VirtualAccountId); // {{payment instrument UUID here}}
Console.WriteLine(((GetVirtualAccountResponse)response.Data).VirtualAccount.VirtualAccountName); // name of virtual account

Console.WriteLine(((GetVirtualAccountResponse)response.Data).VirtualAccount.AchCreditEnabled); // true
Console.WriteLine(((GetVirtualAccountResponse)response.Data).VirtualAccount.AchDebitEnabled); // false
KeyTypeDescription
headerJSON objectRequired. Requires these keys in JSON format: created, app_handle, user_handle for ECDSA. Requires auth token for OAuth2. See the /check_handle endpoint for the complete list of fields in this object.
virtual_account_idUUIDRequired. The UUID of the virtual account.

Responses

Status CodeDescription
200Successfully fetched virtual accounts.
400Bad request format - check validation_details for more information.
401authsignature or usersignature header was absent or incorrect.
403Not Authorized
404Not Found

Response Contents

KeyDatatypeDescription
virtual_account_idUUIDUUID is unique and distinct to the virtual account
virtual_account_namestring or nullName of the virtual account
account_numberstringFull virtual account number
routing_numberstring or nullVirtual account ACH routing number.
account_typestringAccount subtype "VIRTUAL_ACCOUNT"
activebooleanWhether the virtual account is "active", True or False.
closedbooleanWhether the account is "closed", True or False.
createddatetimeUnix datetime for the date the virtual account was created.
closed_epochdatetime or nullUnix datetime for the date the virtual account was closed.
pending_sila_balanceintegerPending balance total of sila in virtual account. What the balance will be if all pending transactions settle successfully.
available_sila_balanceintegerAvailable balance total of sila in virtual account. The balance of all settled transactions.
ach_credit_enabledbooleanWhether or not the virtual account can receive external incoming ACH credits
ach_debit_enabledbooleanWhether or not the virtual account can receive external incoming ACH debits