/get_virtual_accounts

Returns a list of virtual accounts for the specified user.

This will return a list of virtual accounts for the specified user.

Results are paginated. The page and per_page keys can instead be specified in query parameters (e.g. by appending ?page=2&per_page=2 or ?per_page=100 to the end of the URL). If these keys are already specified in the request body, the request body keys take precedence. This allows a requester to fetch several pages using the same signatures, if desired.

Requests

Both authsignature and usersignature headers are required for this request.

  
POST /0.2/get_virtual_accounts HTTP/1.1
Host: sandbox.silamoney.com
authsignature: [GENERATED AUTHSIGNATURE HEX STRING HERE]
usersignature: [GENERATED USERSIGNATURE HEX STRING HERE]
Content-Type: application/json

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

***

HTTP/1.1 200 OK

{
  "success": true,
  "status": "SUCCESS",
  "response_time_ms": "171",
  "virtual_accounts": [
    {
      "virtual_account_id": "UUID",
      "virtual_account_name": "Sherrys 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
    }
  ],
  "pagination": {
    "returned_count": 1,
    "total_count": 1,
    "current_page": 1,
    "total_pages": 1
  }
}
let filters = {
    'page':1,
    'perPage':10,
    'sortAscending':true
};
// filters object and its key of pagination is option
const res = await Sila.getVirtualAccounts(userHandle, userPrivateKey, filters);
 //OR
const res = await Sila.getVirtualAccounts(userHandle, userPrivateKey);

Success Response Object
{
  "statusCode": 200,
  "headers": {
    "server": "nginx/1.14.0 (Ubuntu)",
    "date": "Fri, 25 Mar 2022 11:45:16 GMT",
    "content-type": "application/json",
    "content-length": "548",
    "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_accounts": [
      {
        "virtual_account_id": "72130e62-1bd8-431d-b88d-2440a27c828a",
        "virtual_account_name": "default_v_account_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
      }
    ],
    "pagination": {
      "returned_count": 1,
      "total_count": 1,
      "current_page": 1,
      "total_pages": 1
    },
    "reference": "78f2ab49-872e-4565-9580-d051fae5babd",
    "response_time_ms": "153"
  }
}
payload={

        "user_handle": "user.silamoney.eth"    #Required
    }

User.getVirtualAccounts(silaApp,payload,user_private_key) # users_private_key (256 bits) associated with ethereum address                  


### Success Response Object
{
   "success":true,
   "status":"SUCCESS",
   "virtual_accounts":[
      {
         "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_debit_enabled": true,
         "ach_credit_enabled": false,
      },
      {
         "virtual_account_id":"4eaca914-a86c-48cc-b19d-6e380c126af8",
         "virtual_account_name":"updates_test_v_acc",
         "account_number":"9710012690626872",
         "routing_number":"084106768",
         "account_type":"VIRTUAL_ACCOUNT",
         "active":true,
         "closed":false,
         "created_epoch":1643027824,
         "closed_epoch":"None",
         "ach_debit_enabled": true,
         "ach_credit_enabled": false,
      },
      {
         "virtual_account_id":"ecd4984f-6e3d-444b-9532-3fb3828acb8c",
         "virtual_account_name":"test_v_acc",
         "account_number":"9710019235738819",
         "routing_number":"084106768",
         "account_type":"VIRTUAL_ACCOUNT",
         "active":true,
         "closed":false,
         "created_epoch":1643027824,
         "closed_epoch":"None",
         "ach_debit_enabled": true,
         "ach_credit_enabled": false,
      }
   ],
   "pagination":{
      "returned_count":3,
      "total_count":3,
      "current_page":1,
      "total_pages":1
   },
   "reference": "<your unique id>"
   "status_code":200,
}

### Failure Response Object
{
    status: 'FAILURE'
}
ApiResponse response = api.getVirtualAccounts("userHandle", "userPrivateKey");

// Success Response
System.out.println(response.getStatusCode()); // 200
GetVirtualAccountsResponse parsedResponse = (GetVirtualAccountsResponse) 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()); 
parsedResponse.getVirtualAccounts(); // List of virtual account
System.out.println(parsedResponse.getVirtualAccounts().get(0).getVirtualAccountId()); // 1df8f430-3dec-47a2-bfa7-5e02b19a7bc8
System.out.println(parsedResponse.getVirtualAccounts().get(0).getVirtualAccountName()); // Virtual account name
System.out.println(parsedResponse.getVirtualAccounts().get(0).getAccountNumber()); // Account number
System.out.println(parsedResponse.getVirtualAccounts().get(0).getRoutingNumber()); // 123456789
System.out.println(parsedResponse.getVirtualAccounts().get(0).getAccountType()); // VIRTUAL_ACCOUNT
System.out.println(parsedResponse.getVirtualAccounts().get(0).getClosedEpoch()); // "null" or <epoch_timestamp>
System.out.println(parsedResponse.getVirtualAccounts().get(0).getCreated_epoch()); // <epoch_timestamp>
System.out.println(parsedResponse.getVirtualAccounts().get(0).isClosed()); // true/false
System.out.println(parsedResponse.getVirtualAccounts().get(0).isActive()); // true/falseApi
System.out.println(parsedResponse.getVirtualAccount().isAchCreditEnabled()); // true/false
System.out.println(parsedResponse.getVirtualAccount().isAchDebitEnabled()); // true/false
$userHandle = 'user.silamoney.eth';
$userPrivateKey = 'some private key'; // Hex format
$response = $client->getVirtualAccounts($userHandle, $userPrivateKey);

// Success 200
echo $response->getStatusCode();    // 200
$accounts = $response->getData();   // Array of Silamoney\Client\Domain\Account
if (count($accounts)) {
    echo $accounts[0]->virtual_account_id;     // Virtual account id
    echo $accounts[0]->virtual_account_name;     // Virtual account name
    echo $accounts[0]->account_number;   // Virtual account number
    echo $accounts[0]->active;                 // Virutal account active bool
    echo $accounts[0]->ach_credit_enabled;                 // Virutal account ach_credit_enabled
    echo $accounts[0]->ach_debit_enabled;                 // Virutal account ach_debit_enabled
    echo $accounts[0]->closed_epoch;            // Virtual account closed epoch date
}
ApiResponse<object> response = api.GetVirtualAccounts(userHandle, userPrivateKey);

// Success Object Response

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

Console.WriteLine(((GetVirtualAccountsResponse)response.Data).Pagination); // Pagination
Console.WriteLine(((GetVirtualAccountsResponse)response.Data).Pagination.CurrentPage); // return current page number
Console.WriteLine(((GetVirtualAccountsResponse)response.Data).Pagination.ReturnedCount); // returned count
Console.WriteLine(((GetVirtualAccountsResponse)response.Data).Pagination.TotalCount); // total count
Console.WriteLine(((GetVirtualAccountsResponse)response.Data).Pagination.TotalPages); // total pages

Console.WriteLine(((GetVirtualAccountsResponse)response.Data).VirtualAccounts);
Console.WriteLine(((GetVirtualAccountsResponse)response.Data).VirtualAccounts[0].AccountNumber);  // 1234567812345678
Console.WriteLine(((GetVirtualAccountsResponse)response.Data).VirtualAccounts[0].AccountType); // VIRTUAL_ACCOUNT
Console.WriteLine(((GetVirtualAccountsResponse)response.Data).VirtualAccounts[0].Active);  // true/false
Console.WriteLine(((GetVirtualAccountsResponse)response.Data).VirtualAccounts[0].Closed); // true/false
Console.WriteLine(((GetVirtualAccountsResponse)response.Data).VirtualAccounts[0].ClosedEpoch); // epoch timestamp
Console.WriteLine(((GetVirtualAccountsResponse)response.Data).VirtualAccounts[0].CreatedEpoch); // epoch timestamp
Console.WriteLine(((GetVirtualAccountsResponse)response.Data).VirtualAccounts[0].RoutingNumber); // 044000000
Console.WriteLine(((GetVirtualAccountsResponse)response.Data).VirtualAccounts[0].VirtualAccountId); // {{payment instrument UUID here}}
Console.WriteLine(((GetVirtualAccountsResponse)response.Data).VirtualAccounts[0].VirtualAccountName); // name of virtual account
KeyTypeDescription
headerJSON objectRequired. Requires these keys in JSON format: created, app_handle, user_handle. See the /check_handle endpoint for the complete list of fields in this object.
  

Responses

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

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_typestringBank account 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.
ach_credit_enabledbooleanWhether or not the virtual account can receive external credits
ach_debit_enabledWhether or not the virtual account can receive external debits