/close_virtual_account
This allows the user to close a virtual account and make it permanently unavailable for transacting. Once a virtual account is closed, it cannot be re-opened.
Since closing is permanent, we require both the virtual_account_id
AND the virtual accounts full account_number
as inputs to minimize inadvertent or mistaken closing of virtual accounts.
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/close_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,
"auth_handle": "handle.silamoney.eth",
"user_handle":"user.silamoney.eth",
"version": "0.2",
"crypto": "ETH",
"reference": "<your unique id>"
},
"virtual_account_id": "<virtual account id>",
"account_number": "1234567812345678"
}
***
HTTP/1.1 200 OK
{
"success": true,
"status": "SUCCESS",
"response_time_ms": "171",
"reference": "<your unique id>",
"message": "Virtual account successfully closed.",
"virtual_account":{
"virtual_account_id": "<virtual account id>",
"virtual_account_name": "",
"account_number": "1234567812345678",
"routing_number": "123456789",
"account_type": "VIRTUAL_ACCOUNT",
"active": false,
"closed": true,
"created_epoch": 1613569714,
"closed_epoch": 1645105714,
"ach_credit_enabled": true,
"ach_debit_enabled": false
}
}
const res = await sila.closeVirtualAccount(userHandle, userPrivateKey,virtualAccountId, accountNumber);
// Success Response Object
// Data Response
{
"statusCode": 200,
"headers": {
"server": "nginx/1.14.0 (Ubuntu)",
"date": "Fri, 25 Mar 2022 11:45:19 GMT",
"content-type": "application/json",
"content-length": "517",
"connection": "close",
"access-control-allow-origin": "*",
"access-control-allow-headers": "*",
"allow": "POST, OPTIONS",
"vary": "Cookie"
},
"data": {
"success": true,
"virtual_account": {
"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": false,
"closed": true,
"created_epoch": 1648208707,
"closed_epoch": 1648208719
},
"message": "Virtual account successfully closed.",
"status": "SUCCESS",
"reference": "4033b083-eb75-40eb-8bbf-5b0dc13545b3",
"response_time_ms": "173"
}
}
payload = {
"user_handle": user_handle,
"virtual_account_id":"60438d3f-2f3c-4ddf-910a-7c0f377cd09c",
"account_number":"9717234399676826",
}
User.closeVirtualAccount(app, payload, eth_private_key)
# Success
{
"success":true,
"virtual_account":{
"virtual_account_id":"60438d3f-2f3c-4ddf-910a-7c0f377cd09c",
"virtual_account_name":"test_close_v_acc",
"account_number":"9717234399676826",
"routing_number":"084106768",
"account_type":"VIRTUAL_ACCOUNT",
"ach_credit_enabled":true,
"ach_debit_enabled":false,
"active":false,
"closed":true,
"created_epoch":1648446772,
"closed_epoch":1648446773,
"statements_enabled": True
},
"message":"Virtual account successfully closed.",
"status":"SUCCESS",
"reference":"80bc1e20-4018-45fc-b06e-7526f88de432",
"response_time_ms":"185",
"status_code":200
}
ApiResponse response = api.closeVirtualAccount("userHandle", "userPrivateKey","virtual_account_id","account_number");
// Success Response
System.out.println(response.getStatusCode()); // 200
VirtualAccountResponse parsedResponse = (VirtualAccountResponse) 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()); // Virtual account successfully closed.
parsedResponse.getVirtualAccount(); // Virtual account details
System.out.println(parsedResponse.getVirtualAccount().getVirtualAccountId()); // 1df8f430-3dec-47a2-bfa7-5e02b19a7bc8
System.out.println(parsedResponse.getVirtualAccount().getVirtualAccountName()); // Your 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
//Load your information
$userHandle = 'user.silamoney.eth';
$userPrivateKey = 'some private key';
$virtualAccountId = "virtual account id";
$accountNumber = "account number";
$response = $client->closeVirtualAccount($userHandle, $userPrivateKey, $virtualAccountId, $accountNumber);
echo $response->getStatusCode();
echo $response->getData()->status;
echo $response->getData()->success;
echo $response->getData()->message;
echo $response->getData()->virtual_account->statements_enabled;
//Load your informations
string virtualAccountId= "<virtual account id>";
string accountNumber= "1234567812345678";
var response = api.CloseVirtualAccount(userHandle, userPrivateKey, virtualAccountId, accountNumber);
// Success Object Response
Console.WriteLine(response.StatusCode); // 200
Console.WriteLine(((VirtualAccountResponse)response.Data).Message); // Message
Console.WriteLine(((VirtualAccountResponse)response.Data).Success); // true
Console.WriteLine(((VirtualAccountResponse)response.Data).Status); // SUCCESS
Console.WriteLine(((VirtualAccountResponse)response.Data).Reference); // ccb35eb8-xxxx-xxxx-xxxx-xxxxx
Console.WriteLine(((GetVirtualAccountsResponse)response.Data).ResponseTimeMs); // API responses time
Console.WriteLine(((VirtualAccountResponse)response.Data).VirtualAccount);
Console.WriteLine(((VirtualAccountResponse)response.Data).VirtualAccount.AccountNumber); // 1234567812345678
Console.WriteLine(((VirtualAccountResponse)response.Data).VirtualAccount.AccountType); // VIRTUAL_ACCOUNT
Console.WriteLine(((VirtualAccountResponse)response.Data).VirtualAccount.Active); // true/false
Console.WriteLine(((VirtualAccountResponse)response.Data).VirtualAccount.Closed); // true/false
Console.WriteLine(((VirtualAccountResponse)response.Data).VirtualAccount.ClosedEpoch); // epoch timestamp
Console.WriteLine(((VirtualAccountResponse)response.Data).VirtualAccount.CreatedEpoch); // epoch timestamp
Console.WriteLine(((VirtualAccountResponse)response.Data).VirtualAccount.RoutingNumber); // 044000000
Console.WriteLine(((VirtualAccountResponse)response.Data).VirtualAccount.VirtualAccountId); // {{payment instrument UUID here}}
Console.WriteLine(((VirtualAccountResponse)response.Data).VirtualAccount.VirtualAccountName); // name of virtual account
Console.WriteLine(((VirtualAccountResponse)response.Data).VirtualAccount.AchCreditEnabled); // true
Console.WriteLine(((VirtualAccountResponse)response.Data).VirtualAccount.AchDebitEnabled); // false
Key | Type | Description |
---|---|---|
header | JSON object | Required. 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. |
virtual_account_id | String | ID of virtual account to be closed. Example: 5167160d-9d12-4fa8-a8cd-302507782de0 |
account_number | String | Account number of the virtual account to be closed. Example: 1234567812345678 |
Responses
Status Code | Description |
---|---|
200 | Virtual account successfully closed |
400 | Virtual account either does not exist or the account number does not match the provide virtual account id |
Response Content
Key | Type | Description |
---|---|---|
virtual_account_id | String | ID of the virtual account that was closed |
virtual_account_name | String | Name of the virtual account that was closed |
account_number | String | Account number of the virtual account that was closed |
routing_number | String | Routing number of the virtual account that was closed |
account_type | String | Identified account type. Will always be "VIRTUAL_ACCOUNT" for this endpoint |
active | Boolean | Whether the virtual account has not been frozen or not. Will always be False for this endpoint |
closed | Boolean | Whether the virtual account has been closed or not. Will always be True for this endpoint |
Updated 7 months ago