# How to add the Constructor deposit or withdrawal method

You can use the **Constructor** method for deposits or withdrawals when customization is needed to meet specific requirements.

With **Constructor** methods, you can add and configure fields that clients must fill in when making deposits or withdrawals in the B2CORE UI. This flexibility is useful when additional details, such as bank information, payment references, or required documents, must be provided by clients.

By ensuring that all necessary information is collected, these methods help streamline deposit and withdrawal processing.

To add the **Constructor** method for deposits or withdrawals:

{% stepper %}
{% step %}
Navigate to **System** > **Deposit system** > **Deposit methods** or\
to **System** > **Payout system** > **Payout methods**.
{% endstep %}

{% step %}
Click **+Create** in the upper-right page corner.
{% endstep %}

{% step %}
On the **Create method** page, fill in the following fields:

* In the **Name** field, enter a name for the method, such as `Constructor`. The name must be unique and may only contain Latin letters, numbers, dashes, and underscores.
* In the **Caption** field, enter a caption for the method. This caption will be assigned to the method in the Back Office and will be visible to clients in the B2CORE UI.
* In the **Provider** dropdown, select **Constructor**.
* In the displayed **Currency** dropdown, select a currency for deposits or withdrawals. After creating the method, you can add multiple currencies to it on the **TR Currencies** tab.
* Leave the **Connection** dropdown empty.
  {% endstep %}

{% step %}
Click **Save** to create the method.

The **Constructor** method will appear in the list of methods.
{% endstep %}

{% step %}
Click **Edit** to enter the method details and complete the following fields:

* On the **Settings** tab, select one or more groups in which the method should be included, such as **Fiat**, **Crypto**, or both.
* Review the currencies added on the **TR Currencies** and **PS Currencies** tabs, and add more if necessary (for tab descriptions, refer to [Deposit methods](https://docs.b2core.b2broker.com/back-office-guide/system/deposit-system#details) or [Payout methods](https://docs.b2core.b2broker.com/back-office-guide/system/payout-system#details)).
* Check the method status.

  Keep the method inactive (**No** is displayed in the **Enabled** field) until the method configuration is fully completed, including adding [custom fields](#how-to-add-custom-fields-for-the-constructor-deposit-or-withdrawal-method). Once done, activate the method.
  {% endstep %}

{% step %}
Click **Save** to apply the changes.
{% endstep %}
{% endstepper %}

The initial setup of the **Constructor** method is complete. Next, proceed with adding the required custom fields.

{% embed url="<https://share.synthesia.io/20c02394-a416-4349-93eb-546c6ffe41aa>" %}
Constructor method setup: Part 1
{% endembed %}

## How to add custom fields for the Constructor deposit or withdrawal method

You can add and set up custom fields for deposit and withdrawal methods that use the **Constructor** provider.

To add a custom field:

{% stepper %}
{% step %}
Navigate to **System** > **Deposit system** > **Deposit methods** or\
to **System** > **Payout system** > **Payout methods**.
{% endstep %}

{% step %}
Select the deposit or withdrawal method that uses the **Constructor** provider.
{% endstep %}

{% step %}
Click **Edit** to enter the method details.
{% endstep %}

{% step %}
On the **Settings** tab, navigate to the **Custom fields** section, and then click **Add field**.
{% endstep %}

{% step %}
In the **Add field** popup, fill in the following fields:

* In the **Caption** field, enter a field name. The name will be displayed in the B2CORE UI.

  You can optionally add localizations to the field name by clicking the button on the right side of the **Caption** field and providing translations for the required languages. When switching languages in the B2CORE UI, the field name will be displayed according to the selected language.
* In the **Type** dropdown, select a field type. The following types are available:
  * **Text** — to add a text field.
  * **Select with autocomplete** — to add a field with predefined options. When a client begins typing in this field, options that match the entered characters are displayed, enabling the client to select the desired one.
  * **File** — to add a field for attaching a document necessary for depositing or withdrawing funds.
    {% endstep %}

{% step %}
Click **Save** to add the custom field.
{% endstep %}

{% step %}
To configure properties of the newly added field, click the **Edit** button located in the field row:

* In the displayed **Main field settings** section, you can make the field mandatory by selecting `required` in the **Rules** field.
* For a field of the **Select with autocomplete** type, add a list of predefined options. The options can be added manually or uploaded automatically by connecting to an appropriate API resource (for details, refer to [How to upload a list of predefined options for a custom field](#how-to-upload-a-list-of-predefined-options-for-a-custom-field))
* For a field of the **File** type, in the **Document type** dropdown, select the type of a document that clients should attach. The list of available document types includes all the types configured on the **Verification** > **Document types** page.

  Clients can attach files in JPEG, PNG, or PDF format with the file size up to 3 MB.
  {% endstep %}

{% step %}
Once you have completed the method configuration, activate it by selecting **Yes** in the **Enabled** dropdown.
{% endstep %}

{% step %}
Click **Save** to apply the changes.
{% endstep %}
{% endstepper %}

When clients deposit or withdraw funds with the **Constructor** method, the added custom fields are displayed to them in the same order as they are listed in the **Custom fields** section of the Back Office.

{% embed url="<https://share.synthesia.io/5830fa04-8996-4762-87f5-6448b1d518b5>" %}
Constructor method setup: Part 2
{% endembed %}

## How to upload a list of predefined options for a custom field

For each custom field of the **Select with autocomplete** type, you can automatically upload predefined options that clients can select when they deposit or withdraw funds in the B2CORE UI.

For example, instead of manually adding bank names as predefined options for the “Bank name” field, you can retrieve them from an appropriate resource defined for your application API.

To upload a list of predefined options for a custom field:

{% stepper %}
{% step %}
Navigate to the details of a deposit or withdrawal method that uses the **Constructor** provider.
{% endstep %}

{% step %}
On the **Settings** tab, navigate to the **Custom fields** section.
{% endstep %}

{% step %}
Select a field of the **Select with autocomplete** type for which you want to upload a list of predefined options (such as “Bank name”), and then click **Edit**.
{% endstep %}

{% step %}
Navigate to the **Field dynamic options** section, which is displayed below the **Custom fields** list, and specify the following fields:

* In the **Endpoint** field, specify a URL of a specific API resource that includes field values that you want to use as predefined options for the selected custom field (such as the following sample endpoint: `https://[host]/api/banks`).

  The structure of the specified API resource is displayed in the **Endpoint result preview** field. The following example illustrates a possible resource structure:

<details>

<summary>Show example</summary>

```json
[
  {
    "bankId": 1,
    "bankName": "Bank name 1",
    "countryCode": "AE",
    "countryName": "UAE"
  },
  {
    "bankId": 2,
    "bankName": "Bank name 2",
    "countryCode": "AE",
    "countryName": "UAE"
  },
  {
    "bankId": 3,
    "bankName": "Bank name 3",
    "countryCode": "GE",
    "countryName": "Georgia"
  },
  {
    "bankId": 4,
    "bankName": "Bank name 4",
    "countryCode": "GE",
    "countryName": "Georgia"
  },
  {
    "bankId": 5,
    "bankName": "Bank name 5",
    "countryCode": "MZ",
    "countryName": "Mozambique"
  }
]
```

</details>

* In the **Options from key** dropdown, select the root element of the specified API resource (such as `root`).
* In the **Option value from key** dropdown, select the resource field specifying the values of predefined options displayed for the custom field (such as `bankId`).
* In the **Option caption from key** dropdown, select the resource field specifying the captions of the predefined options (such as `bankName`).
  {% endstep %}

{% step %}
Click **Save** to apply the changes.
{% endstep %}
{% endstepper %}

In the B2CORE UI, the list of predefined options for the “Bank name” custom field will include all the values retrieved from the `bankName` fields of the sample API resource.

{% embed url="<https://share.synthesia.io/585693c4-9f03-4200-8e76-faf4f01af7c1>" %}
Constructor method setup: Part 3
{% endembed %}

## How to dynamically form a list of predefined options for a custom field

A list of predefined options for a custom field can be formed dynamically, with the available options changing based on the selection made in an associated field.

For example, a list of predefined options for the “Bank name” field can depend on the country that is selected in the “Country” field.

{% hint style="info" %}
To form dynamic lists of predefined options, both the associated custom fields must be populated with the options retrieved from the same API resource (for details, refer to [How to upload a list of predefined options for a custom field](#how-to-upload-a-list-of-predefined-options-for-a-custom-field)).
{% endhint %}

To dynamically form a list of predefined options for a custom field:

{% stepper %}
{% step %}
Navigate to the details of a deposit or withdrawal method that uses the **Constructor** provider.
{% endstep %}

{% step %}
On the **Settings** tab, navigate to the **Custom fields** section.
{% endstep %}

{% step %}
Select a field of the **Select with autocomplete** type for which you want to form a dynamic list of predefined options (such as “Bank name”), and then click **Edit**.
{% endstep %}

{% step %}
Navigate to the **Field dynamic options** section, which is displayed below the **Custom fields** list, and specify the following field settings:

* In the **Depends on field** dropdown, select another custom field (such as “Country”) that you want to associate with the “Bank name” field.
* In the **Depends on field by key** dropdown, select the resource field that will be used to filter the options for the “Bank name” field (such as `countryCode`).

<figure><img src="https://514898401-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGoRxAprhHu1goANW7FXt%2Fuploads%2Fgit-blob-e2a30245e1231f0cb2b374a7ca264b71538f6166%2Fconstructor-custom-fields-dynamic-options.png?alt=media" alt="Dynamic options for custom fields"><figcaption><p>Dynamic options for custom fields</p></figcaption></figure>
{% endstep %}

{% step %}
Click **Save** to apply the changes.
{% endstep %}
{% endstepper %}

In the B2CORE UI, the list of bank names displayed for the “Bank name” field will be filtered based on the country selected by the client in the the “Country” field.
