# Create a Dynamic Virtual Account

## Create a dynamic virtual account

<mark style="color:green;">`POST`</mark> `https://api-fsdh360-test.fsdhgroup.com/api/v1/virtualaccounts/dynamic`

To create a dynamic virtual account the below Parameters should be provided.

Attention should be given to parameters marked <mark style="color:red;">\*</mark>`required`.

#### Query Parameters

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| API-version | String |             |

#### Request Body

| Name                                                        | Type   | Description                                                     |
| ----------------------------------------------------------- | ------ | --------------------------------------------------------------- |
| Account name <mark style="color:red;">\*</mark>             | String | Clients account name                                            |
| BVN<mark style="color:red;">\*</mark>                       | String | Clients bank verification number                                |
| Collection Account Number<mark style="color:red;">\*</mark> | String | clients collection account number                               |
| Unique Reference<mark style="color:red;">\*</mark>          | String | Unique reference code                                           |
| Currency Code<mark style="color:red;">\*</mark>             | String | Currency code e.g NGN                                           |
| Valid till<mark style="color:red;">\*</mark>                | String | Specify valid till e.g 2022-11-30T09:42:29.755Z                 |
| Valid for<mark style="color:red;">\*</mark>                 | String | Specify the following "Years" "Months" "Days" "Hours" "Minutes" |
| Is One Time Payment<mark style="color:red;">\*</mark>       | String | Specify "true"                                                  |
| Expected amount                                             | String | Specify expected amount                                         |

{% tabs %}
{% tab title="201: Created Success: created" %}

```json
{
  "accountNumber": "string",
  "accountName": "string",
  "collectionAccountNumber": "string",
  "bvn": "string",
  "accountType": 1,
  "accountCurrency": "string",
  "hasExpired": true,
  "expires": "2022-12-07T10:21:13.041Z",
  "uniqueReference": "string",
  "isOneTimePaymentAccount": true,
  "expectedAmount": "string"
}
```

{% endtab %}

{% tab title="401: Unauthorized Unauthorized" %}

```javascript
```

{% endtab %}

{% tab title="403: Forbidden Forbidden" %}

<pre class="language-javascript"><code class="lang-javascript"><strong>
</strong></code></pre>

{% endtab %}

{% tab title="500: Internal Server Error Internal server error" %}

```javascript
```

{% endtab %}

{% tab title="400 Bad request" %}

```javascript
```

{% endtab %}
{% endtabs %}

#### Request body

To create a dynamic virtual account, the below details are <mark style="color:red;">\*</mark>`required` in the request body.

```json
{
  "accountName": "string",
  "bvn": "string",
  "collectionAccountNumber": "string",
  "uniqueReference": "string",
  "currencyCode": "string",
  "validTill": "2022-04-11T15:26:47.140Z",
  "validFor": {
    "years": 0,
    "months": 0,
    "days": 0,
    "hours": 0,
    "minutes": 0
  },
  "isOneTimePaymentAccount": true
}
```

{% code title="Curl" %}

```json
curl -X POST "https://api-fsdh360-test.fsdhgroup.com/api/v1/virtualaccounts/dynamic" -H  "accept: application/json" -H  "Content-Type: application/json" -d "{\"accountName\":\"string\",\"bvn\":\"string\",\"collectionAccountNumber\":\"string\",\"uniqueReference\":\"string\",\"currencyCode\":\"string\",\"validTill\":\"2022-04-26T10:42:02.951Z\",\"validFor\":{\"years\":0,\"months\":0,\"days\":0,\"hours\":0,\"minutes\":0},\"isOneTimePaymentAccount\":true}"
```

{% endcode %}

#### Response body

Inputting the correct parameters should give you a <mark style="color:green;">`201`</mark>`: Success` response which will populate the below Success details. Also specified are possible responses from the request.

{% tabs %}
{% tab title="201: Success" %}

```json
{
  "accountNumber": "string",
  "accountName": "string",
  "collectionAccountNumber": "string",
  "bvn": "string",
  "accountType": 1,
  "accountCurrency": "string",
  "hasExpired": true,
  "expires": "2022-11-30T09:54:21.389Z",
  "uniqueReference": "string",
  "isOneTimePaymentAccount": true,
  "expectedAmount": "string"
}
```

{% endtab %}

{% tab title="400: Bad Request" %}

```json
{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "traceId": "00-2994c1d099296b42b38997e5ca0a0ece-c7c80751830f0444-00",
  "errors": {
    "CollectionAccountNumber": [
      "The field CollectionAccountNumber must be a string with a minimum length of 10 and a maximum length of 10."
    ]
  }
}
```

{% endtab %}
{% endtabs %}
