> For the complete documentation index, see [llms.txt](https://edrus.gitbook.io/appgregator-api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://edrus.gitbook.io/appgregator-api-docs/appgregators/payment-gateway/xendit-indonesia-final-version/api/virtual-accounts/create-new-virtual-account.md).

# Create new Virtual Account

| Body Parameter           | Type    | Required | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ------------------------ | ------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| external\_id             | String  | yes      | <p>An ID of your choice. Often it is unique identifier like a phone number, email or transaction ID.<br><br></p><p><strong><code>Characters</code>: Special and alphanumeric</strong><br><strong><code>Minimum character</code>: 1 character</strong><br><strong><code>Maximum characters</code>: 950 characters</strong></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| bank\_code               | String  | yes      | **Available bank codes: `BCA`, `BNI`, `BRI`, `BJB`, `BSI`, `CIMB`, `DBS`, `MANDIRI`, `PERMATA`, `SAHABAT_SAMPOERNA`**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| name                     | String  | yes      | <p></p><p>Name of user/virtual account, - this will be displayed in the bank's user interface, e.g. ATM confirmation screens. Note that this field can only contain letters and spaces and has length restriction depending on the banks. And also cannot contains name from bank/institution/government.<br><br></p><p><strong><code>Characters</code> Only alphabet. For <code>BCA</code> Aggregator, alphabet and number are allowed.</strong><br><strong><code>Minimum length</code> 1 character, except <code>BCA</code> the minimum length is 3 characters</strong><br><br></p><p><strong>Note:</strong><br></p><ul><li>For Individual account type, VA name is not customizable and will always follow your business name.</li><li>BNI VA name will be included a prefix of "XDT-" in the response. This prefix is mandatory from BNI.</li></ul><p></p>                                                                                                                                                                                                              |
| virtual\_account\_number | String  | no       | <p>You can assign specific Virtual Account number using this parameter. If you do not send one, one will be picked at random.<br><br>Make sure the number you specify is within your Virtual Account range. Check your Virtual Account <a href="https://dashboard.xendit.co/settings/payment-methods#virtual-accounts">range in Virtual Account Settings</a>. API will throw error if you include merchant code (first 4 or 5 digits of your VA range, ie <code>26215</code> for BRI).<br><br>Example: If your BRI Virtual Account range: <code>26215 9999000001 - 26215 9999999999</code>, request <code>virtual\_account\_number</code>: <code>9999100101</code> will be accepted as the value is within VA range, while <code>virtual\_account\_number</code>: <code>262159999100101</code> will throw <code>VIRTUAL\_ACCOUNT\_NUMBER\_OUTSIDE\_RANGE</code><br><br><strong>Note:</strong> Your VA range in <code>TEST</code> and <code>LIVE</code> mode might be different. When going live, double check and adjust your request to follow the respective VA range</p> |
| is\_single\_use          | boolean | no       | <p></p><p>There are 2 types of Virtual Account:</p><ul><li>Single-use Virtual Account (<code>is\_single\_use</code>: <code>true</code>) can only be paid once. Used VA number can be recreated for other customer/invoice/transaction</li><li>Multiple-use Virtual Account (<code>is\_single\_use</code>: <code>false</code>) allows your customer to pay to the same Virtual Account continuously</li></ul><p></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| is\_closed               | boolean | no       | <p></p><p>There are 2 types of Virtual Account amount: open or closed amount<br></p><ul><li>Open amount means your customer can pay any amount to the Virtual Account</li><li>Closed amount means your customer can only pay amount specified by you. Payment will be rejected if attempted payment amount deviates from the amount you specified. Specify the amount using <code>expected\_amount</code> parameter below</li></ul><p></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| expected\_amount         | number  | no       | <p></p><p>Required amount to be paid by your customer for closed Virtual Account.<br><br>For <code>MANDIRI</code>,<code>BNI</code>,<code>BJB</code>,<code>BRI</code>,<code>BSI</code>, and <code>SAHABAT\_SAMPOERNA</code>:</p><ul><li>Minimum amount: IDR 1</li><li>Maximum amount: IDR 50,000,000,000</li></ul><p><br>For <code>PERMATA</code>:</p><ul><li>Minimum amount: IDR 1</li><li>Maximum amount: IDR 9,999,999,999</li></ul><p><br>For <code>BCA</code>:</p><ul><li>Minimum amount: IDR 10,000</li><li>Maximum amount: IDR 999,999,999,999</li></ul><p><br>For <code>DBS</code>:</p><ul><li>Minimum amount: USD 1.00</li><li>Maximum amount: USD 50,000,000,000.00</li></ul><p></p>                                                                                                                                                                                                                                                                                                                                                                               |
| min\_amount              | number  | no       | Minimum amount to be paid by your customer for open Virtual Account, it should use an amount above the minimum amount from the bank. Currently only available for `BCA` and `CIMB`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| max\_amount              | number  | no       | Maximum amount to be paid by your customer for open Virtual Account, it should use an amount below the maximum amount from the bank. Currently only available for `BCA` and `CIMB`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| suggested\_amount        | number  | no       | <p>The suggested amount you want to assign<br><br><strong>Note:</strong> Suggested amounts is the amounts that can see as a suggestion, but user can still put any numbers (only supported for BRI, BSI, and Mandiri)<br></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| expiration\_date         | string  | no       | <p>ISO8601 timestamp of Virtual Account expiration time<br><br></p><p><strong>Timezone: <code>UTC+0</code></strong></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| description              | string  | no       | <p>Description for the Virtual Account. Available only for <code>BRI</code> and <code>BSI</code><br><br></p><p><strong><code>Characters</code> Special and alphanumeric</strong><br><strong><code>Minimum length</code> 1 character</strong></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

<details>

<summary>body JSON</summary>

```shell
{
    "external_id" :"va_0017",
    "bank_code" : "BNI",
    "name": "customer",
    "is_single_use" : true,
    "expected_amount": 50000
}
```

</details>

<mark style="color:green;">`POST`</mark> `https://us-central1-appgregator.cloudfunctions.net/xendit/va/create/`

#### Query Parameters

| Name                                               | Type   | Description     |
| -------------------------------------------------- | ------ | --------------- |
| name<mark style="color:red;">\*</mark>             | String | ft-4            |
| connection\_name<mark style="color:red;">\*</mark> | String | xendit-sanbox-1 |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| x-api-key<mark style="color:red;">\*</mark> | String | U2Fsd...    |

{% tabs %}
{% tab title="201: Created create" %}

```shell
{
    "is_closed": false,
    "status": "PENDING",
    "currency": "IDR",
    "owner_id": "6279ce4495d10c9afc3171b8",
    "external_id": "va_0017",
    "bank_code": "BNI",
    "merchant_code": "8808",
    "name": "XDT-aplikasi keuangan",
    "account_number": "8808999924281863",
    "expected_amount": 50000,
    "is_single_use": true,
    "expiration_date": "2053-11-10T17:00:00.000Z",
    "id": "636dfd5bc1cb35297c3ec52a"
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="cURL" %}

```shell
curl --location --request POST 'https://us-central1-appgregator.cloudfunctions.net/xendit/va/create?name=ft-4&connection_name=xendit-sanbox-1' \
--header 'x-api-key: U2Fsd...' \
--header 'Content-Type: application/json' \
--data-raw '{
    "external_id" :"va_0017",
    "bank_code" : "BNI",
    "name": "customer",
    "is_single_use" : true,
    "expected_amount": 50000
}'
```

{% endtab %}

{% tab title="Node Js + Axios" %}

```javascript
var axios = require('axios');
var data = JSON.stringify({
  "external_id": "va_0017",
  "bank_code": "BNI",
  "name": "customer",
  "is_single_use": true,
  "expected_amount": 50000
});

var config = {
  method: 'post',
  url: 'https://us-central1-appgregator.cloudfunctions.net/xendit/va/create?name=ft-4&connection_name=xendit-sanbox-1',
  headers: { 
    'x-api-key': 'U2Fsd...', 
    'Content-Type': 'application/json'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

```

{% endtab %}

{% tab title="PHP + cURL" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://us-central1-appgregator.cloudfunctions.net/xendit/va/create?name=ft-4&connection_name=xendit-sanbox-1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "external_id" :"va_0017",
    "bank_code" : "BNI",
    "name": "customer",
    "is_single_use" : true,
    "expected_amount": 50000
}',
  CURLOPT_HTTPHEADER => array(
    'x-api-key: U2Fsd...',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}
{% endtabs %}
